Package org.rumbledb.types
Interface ItemType
- All Superinterfaces:
com.esotericsoftware.kryo.KryoSerializable,Serializable
- All Known Implementing Classes:
ArrayItemType,AtomicItemType,AttributeNodeItemType,DerivedAtomicItemType,DocumentNodeItemType,ElementNodeItemType,FunctionItemType,ItemItemType,ItemTypeReference,JsonItemType,MapItemType,NeutralItemType,NodeItemType,ObjectItemType,PINodeItemType,UnionItemType,XmlNodeItemType,XQueryArrayItemType
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanBePromotedTo(ItemType itemType) booleanTests for itemType equality.default ItemTypeFinds a lax (non-strict) common supertype that can incorporate anonymous facets when possible.default ItemTypedefault ItemTypedefault Booleandefault CardinalityFacetValuedefault ItemTypeCasting-specific primitive normalization used by cast/castable logic.default booleandefault TimezoneFacetdefault Integerdefault Stringdefault IntegerReturns the lexical-space patterns for this item type.default ItemTypedefault SequenceTypedefault Itemdefault Itemdefault Integerdefault SequenceTypedefault Itemdefault Itemdefault Integerdefault NamegetName()default Booleandefault Map<String,FieldDescriptor> default OrderedFacetValueReturns the pattern facet for this item type.default ItemTypedefault FunctionSignaturedefault StringReturns the SparkSQL type of the item type for use in a query.default IntegergetTypes()intdefault WhitespaceFacetdefault booleanhasName()Tests for QName.default booleandefault booleandefault booleanCasting-specific primitive notion from XPath/XQuery Functions and Operators 3.1 §19: in addition to XML Schema primitive types, xs:integer, xs:yearMonthDuration, and xs:dayTimeDuration are treated as primitive for casting.default booleanisCompatibleWithDataFrames(RumbleRuntimeConfiguration configuration) Checks compatibility with DataFrames.default booleanTests for itemType equality.default booleandefault booleandefault booleandefault booleandefault booleandefault booleandefault booleandefault booleandefault booleanisStaticallyCastableAs(ItemType other) Check at static time if [this] could be casted to [other] item type, requires [this] to be an atomic typedefault booleanisSubtypeOf(ItemType superType) default booleandefault booleandefault booleandefault booleandefault voidresolve(DynamicContext context, ExceptionMetadata metadata) default voidresolve(StaticContext context, ExceptionMetadata metadata) toString()Methods inherited from interface com.esotericsoftware.kryo.KryoSerializable
read, write
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
-
Method Details
-
equals
Tests for itemType equality. -
isEqualTo
Tests for itemType equality.- Parameters:
otherType- another item type.- Returns:
- true it is equal to other, false otherwise.
-
isTopmostItemType
default boolean isTopmostItemType()- Returns:
- true it [this] is the topmost item type.
-
isAtomicItemType
default boolean isAtomicItemType()- Returns:
- true it [this] is a subtype of an atomic item type.
-
isObjectItemType
default boolean isObjectItemType()- Returns:
- true it [this] is an object item type.
-
isArrayItemType
default boolean isArrayItemType()- Returns:
- true it [this] is an array item type.
-
isXQueryArrayItemType
default boolean isXQueryArrayItemType()- Returns:
- true it [this] is an XQuery array item type.
-
isMapItemType
default boolean isMapItemType()- Returns:
- true if [this] is an XQuery map item type (map(*) or map(K, V)).
-
isJsonItemType
default boolean isJsonItemType()- Returns:
- test if [this] is a subptype of a json item type
-
isNodeItemType
default boolean isNodeItemType()- Returns:
- true if [this] is a node item type (node() or any of its 7 concrete subtypes).
-
isUnionType
default boolean isUnionType() -
isFunctionItemType
default boolean isFunctionItemType()- Returns:
- true it [this] is a function item type.
-
isNumeric
default boolean isNumeric()- Returns:
- [true] if this is a numeric item type, false otherwise
-
hasName
default boolean hasName()Tests for QName.- Returns:
- true if [this] item type has a QName
-
getName
- Returns:
- the itemtype QName if available
-
getSignature
- Returns:
- the signature of the function item type if available
-
isSubtypeOf
- Parameters:
superType- another item type- Returns:
- true if [this] is a subtype of [superType], any type is considered a subtype of itself. If [this] has a name, then this is determined strictly based on the hierarchy. If [this] does not have a name, then this is determined based on facets.
-
findLeastCommonSuperTypeWith
- Parameters:
other- another item type- Returns:
- the common supertype between [this] and [other], that would be the LCA in the item type tree of [this] and [other] (does not take into account union types as common ancestor, but only the type tree)
-
findLeastCommonSuperTypeLax
Finds a lax (non-strict) common supertype that can incorporate anonymous facets when possible. The default implementation falls back to the strict least-common-supertype logic.- Parameters:
other- another item type- Returns:
- a lax common supertype between [this] and [other]
-
getTypeTreeDepth
int getTypeTreeDepth()- Returns:
- an int representing the depth of the item type in the type tree ('item' is the root with depth 0)
-
getBaseType
ItemType getBaseType()- Returns:
- the base type for a type, return null for the topmost item type
-
isStaticallyCastableAs
Check at static time if [this] could be casted to [other] item type, requires [this] to be an atomic type- Parameters:
other- a strict subtype of atomic item type to which we are trying to cast- Returns:
- true if it is possible at static time to cast [this] to [other], false otherwise
-
canBePromotedTo
- Parameters:
itemType- another item type- Returns:
- true if [this] can be promoted to [itemType]
-
isUserDefined
default boolean isUserDefined()- Returns:
- [true] if it is a user-defined type, false otherwise
-
isPrimitive
default boolean isPrimitive()- Returns:
- [true] if it is a primitive type
-
isCastingPrimitive
default boolean isCastingPrimitive()Casting-specific primitive notion from XPath/XQuery Functions and Operators 3.1 §19: in addition to XML Schema primitive types, xs:integer, xs:yearMonthDuration, and xs:dayTimeDuration are treated as primitive for casting.- Returns:
- [true] if this type is considered primitive for casting semantics.
-
getPrimitiveType
- Returns:
- the primitive type for a derived type, throw an error for primitive types
-
getCastingPrimitiveType
Casting-specific primitive normalization used by cast/castable logic.- Returns:
- this type if it is a casting primitive; otherwise its casting primitive ancestor.
-
getAllowedFacets
Set<ConstrainingFacetTypes> getAllowedFacets()- Returns:
- a set containing the allowed facets for restricting the type
-
getEnumerationFacet
- Returns:
- the list of possible values for [this] item type or null if the enumeration facet is not set
-
getConstraintsFacet
- Returns:
- the list of constraints in the implementation-defined language for [this] item type (note that this facet is cumulative) or an empty list if the constraints facet is not set
-
getMinLengthFacet
- Returns:
- the minimum length facet value for [this] item type or null if the restriction is not set
-
getLengthFacet
- Returns:
- the length facet value for [this] item type or null if the restriction is not set
-
getMaxLengthFacet
- Returns:
- the maximum length facet value for [this] item type or null if the restriction is not set
-
getMinExclusiveFacet
- Returns:
- an item representing the minimum possible value (excluded) for [this] item type or null if the restriction is not set
-
getMinInclusiveFacet
- Returns:
- an item representing the minimum possible value (included) for [this] item type or null if the restriction is not set
-
getMaxExclusiveFacet
- Returns:
- an item representing the maximum possible value (excluded) for [this] item type or null if the restriction is not set
-
getMaxInclusiveFacet
- Returns:
- an item representing the maximum possible value (included) for [this] item type or null if the restriction is not set
-
getTotalDigitsFacet
- Returns:
- the total digits facet value for [this] item type or null if the restriction is not set
-
getFractionDigitsFacet
- Returns:
- the fraction digits facet value for [this] item type or null if the restriction is not set
-
getExplicitTimezoneFacet
- Returns:
- the explicit timezone facet value for [this] item type or null if the restriction is not set
-
getWhitespaceFacet
- Returns:
- the whiteSpace facet value for [this] item type or null if the restriction is not set
-
getPatternFacet
Returns the pattern facet for this item type. This reflects pattern facets applied via derivation (for example onDerivedAtomicItemType), not the full lexical space of a primitive atomic type.- Returns:
- the list of pattern regex strings for this derivation step, or null if no pattern restriction is set
-
getLexicalSpacePatterns
Returns the lexical-space patterns for this item type. For primitive atomic types, this describes the lexical space defined by the specification (for example, the allowed literals for xs:boolean or the lexical grammar for xs:decimal). For derived atomic types, this typically delegates to the primitive type. Implementations that do not provide additional constraints should return an empty list.- Returns:
- a list of regular expressions describing the lexical space of this type, or an empty list if no regex-based restriction is modeled.
-
getOrderedFacet
- Returns:
- the ordered fundamental facet value, or null if not set
-
getBoundedFacet
- Returns:
- the bounded fundamental facet value, or null if not set
-
getCardinalityFacet
- Returns:
- the cardinality fundamental facet value, or null if not set
-
getNumericFacet
- Returns:
- the numeric fundamental facet value, or null if not set
-
getObjectContentFacet
- Returns:
- content facet value for object item types (cumulative facet)
-
getClosedFacet
default boolean getClosedFacet()- Returns:
- closed facet value for object item types
-
getArrayContentFacet
- Returns:
- content facet value for array item types
-
getMapKeyItemType
- Returns:
- atomic key type for map item types (map(K, V)).
-
getMapValueSequenceType
- Returns:
- value sequence type for map item types (map(K, V)).
-
getMemberSequenceType
- Returns:
- the sequence type for the members of the array item type
- Throws:
UnsupportedOperationException- if the item type is not an xquery array item type
-
getTypes
- Returns:
- content facet value for union item types
-
getIdentifierString
- Returns:
- a String that uniquely identify an item type
-
isCompatibleWithDataFrames
Checks compatibility with DataFrames.- Returns:
- true if compatible with DataFrames and false otherwise.
-
getSparkSQLType
Returns the SparkSQL type of the item type for use in a query.- Returns:
- String representing the SparkSQL type of the item type.
-
toString
String toString() -
isResolved
default boolean isResolved() -
resolve
-
resolve
-