001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.core.metapath; 007 008import java.time.LocalDate; 009import java.time.LocalDateTime; 010 011import dev.metaschema.core.metapath.item.atomic.IDateItem; 012import dev.metaschema.core.metapath.item.atomic.IDateTimeItem; 013import dev.metaschema.core.util.ObjectUtils; 014import edu.umd.cs.findbugs.annotations.NonNull; 015 016/** 017 * Provides constant values for use in Metapath. 018 */ 019@SuppressWarnings("PMD.DataClass") 020public final class MetapathConstants { 021 /** 022 * The namespace URI for Metapath data types and built-in casting functions, as 023 * a string. 024 */ 025 @NonNull 026 public static final String NS_METAPATH = "http://csrc.nist.gov/ns/metaschema/metapath"; 027 /** 028 * The namespace URI for Metapath built-in functions, as a string. 029 * 030 * @see #PREFIX_METAPATH for the default prefix for this namespace 031 */ 032 @NonNull 033 public static final String NS_METAPATH_FUNCTIONS = "http://csrc.nist.gov/ns/metaschema/metapath-functions"; 034 /** 035 * The namespace URI for Metapath math-related built-in functions, as a string. 036 * 037 * @see #PREFIX_METAPATH_FUNCTIONS_MATH for the default prefix for this 038 * namespace 039 */ 040 @NonNull 041 public static final String NS_METAPATH_FUNCTIONS_MATH = NS_METAPATH_FUNCTIONS + "/math"; 042 /** 043 * The namespace URI for Metapath array-related built-in functions, as a string. 044 * 045 * @see #PREFIX_METAPATH_FUNCTIONS_ARRAY for the default prefix for this 046 * namespace 047 */ 048 @NonNull 049 public static final String NS_METAPATH_FUNCTIONS_ARRAY = NS_METAPATH_FUNCTIONS + "/array"; 050 /** 051 * The namespace URI for Metapath map-related built-in functions, as a string. 052 * 053 * @see #PREFIX_METAPATH_FUNCTIONS_MAP for the default prefix for this namespace 054 */ 055 @NonNull 056 public static final String NS_METAPATH_FUNCTIONS_MAP = NS_METAPATH_FUNCTIONS + "/map"; 057 /** 058 * The namespace URI for Metapath extension built-in functions, as a string. 059 * <p> 060 * This is currently an alias for {@link #NS_METAPATH_FUNCTIONS} and can be used 061 * when implementing custom extension functions to distinguish them from core 062 * functions. 063 */ 064 @NonNull 065 public static final String NS_METAPATH_FUNCTIONS_EXTENDED = NS_METAPATH_FUNCTIONS; 066 067 /** 068 * The namespace prefix for Metapath data types and built-in casting functions. 069 * 070 * @see #NS_METAPATH for the corresponding namespace URI 071 */ 072 @NonNull 073 public static final String PREFIX_METAPATH = "meta"; 074 /** 075 * The namespace prefix for Metapath built-in functions. 076 * 077 * @see #NS_METAPATH_FUNCTIONS for the corresponding namespace URI 078 */ 079 @NonNull 080 public static final String PREFIX_METAPATH_FUNCTIONS = "fn"; 081 /** 082 * The namespace prefix for Metapath math-related built-in functions. 083 * 084 * @see #NS_METAPATH_FUNCTIONS_MATH for the corresponding namespace URI 085 */ 086 @NonNull 087 public static final String PREFIX_METAPATH_FUNCTIONS_MATH = "math"; 088 /** 089 * The namespace prefix for Metapath array-related built-in functions. 090 * 091 * @see #NS_METAPATH_FUNCTIONS_ARRAY for the corresponding namespace URI 092 */ 093 @NonNull 094 public static final String PREFIX_METAPATH_FUNCTIONS_ARRAY = "array"; 095 /** 096 * The namespace prefix for Metapath map-related built-in functions. 097 * 098 * @see #NS_METAPATH_FUNCTIONS_MAP for the corresponding namespace URI 099 */ 100 @NonNull 101 public static final String PREFIX_METAPATH_FUNCTIONS_MAP = "map"; 102 103 /** 104 * A reference date/time value for use in date/time related calculations. 105 */ 106 @NonNull 107 public static final IDateTimeItem REFERENCE_DATE_TIME 108 = IDateTimeItem.valueOf(ObjectUtils.notNull(LocalDateTime.of(1972, 1, 1, 0, 0))); 109 110 /** 111 * A reference date value for use in date/time related calculations. 112 */ 113 @NonNull 114 public static final IDateItem REFERENCE_DATE_ITEM = IDateItem.valueOf(ObjectUtils.notNull(LocalDate.of(1972, 1, 1))); 115 116 private MetapathConstants() { 117 // disable construction 118 } 119}