Package org.rumbledb.api
Interface Item
- All Superinterfaces:
com.esotericsoftware.kryo.KryoSerializable,Serializable
- All Known Implementing Classes:
AnnotatedItem,AnyURIItem,ArrayItem,AttributeItem,Base64BinaryItem,BooleanItem,CommentItem,DateItem,DateTimeItem,DateTimeStampItem,DayTimeDurationItem,DecimalItem,DocumentItem,DoubleItem,DurationItem,ElementItem,FloatItem,FunctionItem,gDayItem,gMonthDayItem,gMonthItem,gYearItem,gYearMonthItem,HexBinaryItem,IntegerItem,IntItem,LazyObjectItem,MapItem,NamespaceItem,NullItem,ObjectItem,ProcessingInstructionItem,QNameItem,SequenceArrayItem,StringItem,TextItem,TimeItem,UntypedAtomicItem,YearMonthDurationItem
An instance of this class is an item in the JSONiq data model.
JSONiq manipulates sequences of items.
All calls should be made via this interface. Objects of type Item should never be cast to a subclass (in a subsequent
version,
we will make the classes implementing this interface visible only at the package level).
An item can be structured or atomic or a function.
Structured items include objects and arrays. Objects are mappings from strings (keys) to items. Arrays are ordered
lists of items.
Atomic items have a lexical value and a type. Rumble does not support all atomic types yet.
- Author:
- Ghislain Fourny, Stefan Irimescu, Can Berker Cikis
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidMethod sets the parent item for all descendents of the current item.default voidDeprecated.default voidappendItem(Item item) Appends an item to the item, if it is an array.default voidappendSequence(List<Item> sequence) Appends a sequence to the item, if it is an array.XDM 3.1 Section 5.12 string-value Accessor.XDM 3.1 Section 5.1 attributes Accessor.baseUri()XDM 3.1 Section 5.2 base-uri Accessor.default BigDecimalCasts the item to a decimal value (must be a numeric).default doubleCasts the item to a double value (must be a numeric).default floatCasts the item to a float value (must be a numeric).default BigIntegerCasts the item to a big integer value (must be a numeric).default intCasts the item to an integer value (must be a numeric).children()XDM 3.1 Section 5.3 children Accessor.Helper accessor for XML element nodes: returns namespace nodes for the namespace bindings declared directly on the element.XDM 3.1 Section 5.4 document-uri Accessor.booleanTests for logical equality.default NativeClauseContextgenerateNativeQuery(NativeClauseContext context) Get sparkSql string for the itemdefault byte[]Returns the byte[] value of the item, if it is an atomic item of type hexBinary or Base64Binary.default RuntimeIteratorReturns the body iterator, if it is a function item.default booleanReturns the boolean value of the item, if it is a boolean.default CollectionReturns the collection to which the item belongs, if any.default booleanTests whether the item is an XML Text node.default OffsetDateTimeReturns the dateTime value of the item, if it is an atomic item of type dateTimeItem or dateItem or timeItem.default intgetDay()Return only day of the item, if it's DateTime or Duration It will not convert months and years into days.default BigDecimalReturns the decimal value of the item, if it is a decimal.default Map<Name,JSoundDataFrame> Returns the DataFrame variable bindings, if it is a function item.default doubleReturns the double value of the item, if it is a double.default DurationReturns the duration value of the item, if it is a duration.default ItemTypeReturns the dynamic type of the item (only for error message purposes).default booleanReturns the effective boolean value of the item, if atomic.default longReturns the EpochMillis of the item, if it's DateTime or Duration It will collect all the parts of the item and compress it into the EpochMillisdefault org.apache.spark.ml.Estimator<?>default floatReturns the float value of the item, if it is a float.default intgetHour()Return only hour of the item, if it's DateTime, Time or Durationdefault FunctionIdentifierReturns the identifier (name and arity) of the function, if it is a function item.default BigIntegerReturns the integer value of the item as a bit integer, if it is an integer.default intReturns the int value of the item, if it is an int.default ItemgetItemAt(int position) Returns the member of the item at the specified position if it is an array.default ItemgetItemByKey(String key) Returns the value item associated with a specific key, if it is a map.default ItemgetItemByKey(Item key) Returns the value item associated with a specific key, if it is an object.Returns the (possibly non-string) atomic keys of the item, if it is a map-like object.Returns the members of the item, if it is an array.getItems()Deprecated.usegetItemMembers()insteadReturns the values of the item, if it is a map.getKeys()Deprecated.usegetStringKeys()insteadReturns the local variable bindings, if it is a function item.default intReturn only minutes of the item, if it's DateTime, Time or Duration It will not convert hours into minutesdefault DynamicContextReturns the module dynamic context, if it is a function item.default intgetMonth()Return only month of the item, if it's DateTime or Duration It will not convert years into monthsdefault intReturns the mutability level of the item.default intReturn the only nanoseconds of the item, if it's DateTime, Time or Duration It will not convert hours, minutes and seconds into nanoseconds It exists only if the value in seconds will have decimal values, otherwise it will return 0default intOffset is an integer between −840 and 840 inclusiveReturns the names of the parameters of the function, if it is a function item.default StringReturns the path from the top level object of a DeltaFile for the item.default PeriodReturns the period value of the item, if it is a duration.default NameReturns the expanded name of this item when it is an xs:QName.Returns the RDD variable bindings, if it is a function item.default doubleReturn only seconds of the item, if it's DateTime, Time or Duration It will not convert hours and minutes into secondsgetSequenceAt(int position) Returns the member of the item at the specified position if it is an array.getSequenceByKey(String key) Returns the value sequence associated with a string key, if it is a map.getSequenceByKey(Item key) Returns the value sequence associated with a key, if it is a map-like object.Returns the member sequences of the item, if it is an array.Returns the value sequences of the item, if it is a map.default FunctionSignatureReturns the signature of the function, if it is a function item.default intgetSize()Returns the size of the item, if it is an array.default StringReturns the SparkSQL type of the item for use in a query.default StringReturns the SparkSQL value of the item for use in a query.default StringgetSparkSQLValue(ItemType itemType) Returns the SparkSQL value of the item for use in a query.Returns the string keys of the item, if it is a map.default StringReturns the string value of the item, if it is an atomic item.default StringReturns the location of the DeltaFile for the item.default StringReturns the string value of the text item, if it is a text item.default OffsetTimeReturns the time value of the item, if it is an atomic item of type or timeItem.default longReturns the top level ID of the item.default doubleReturns the top level order (sequence number) identifierdefault org.apache.spark.ml.TransformerDeprecated.usegetItemValues()insteaddefault ObjectReturns the Object containing the converted value of the item for a DataFrame.default XMLDocumentPositionGet the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniquenessdefault intgetYear()Return year of the item, if it's DateTime or Durationdefault booleanTests whether the item contains a representation of date or time (or both).inthashCode()Computes a hash code.default booleandefault booleanisAnyURI()Tests whether the item is an atomic item of type anyURI.default booleanisArray()Tests whether the item is an array.default booleanTests whether the item is an array of items.default booleanisAtomic()Tests whether the item is an atomic item.default booleanTests whether the item is an XML Attribute node.default booleanTests whether the item is an atomic item of type base64Binary.default booleanisBinary()Tests whether the item is an atomic item of type base64Binary or hexBinary.default booleanTests whether the item is an atomic item of type default boolean.default booleanWhether this item is a function item representing a builtin function.default booleandefault booleanisDate()Tests whether the item is an atomic item of type date.default booleanTests whether the item is an atomic item of type dateTime.default booleanTests whether the item is an atomic item of type dayTimeDuration.default booleanTests whether the item is an atomic item of type decimal.default booleanTests whether the item is an XML Document node.default booleanisDouble()Tests whether the item is an atomic item of type double.default booleanTests whether the item is an atomic item of type duration.default booleanTests whether the item is an XML Element node.default booleandefault booleanisFloat()Tests whether the item is an atomic item of type float.default booleanTests whether the item is a function.default booleanisGDay()Tests whether the item is an atomic item of type gDay.default booleanisGMonth()Tests whether the item is an atomic item of type gMonth.default booleanTests whether the item is an atomic item of type gMonthDay.default booleanisGYear()Tests whether the item is an atomic item of type gYear.default booleanTests whether the item is an atomic item of type gMonthDay.default booleanTests whether the item is an atomic item of type hexBinary.default booleanisId()XDM 3.1 Section 5.5 is-id Accessor.default booleanisIdrefs()XDM 3.1 Section 5.6 is-idrefs Accessor.default booleanisInt()Tests whether the item is an atomic item of type int.default booleanTests whether the item is an atomic item of type integer.default booleanisMap()Tests whether the item is a map.default booleanTests whether the item is an XML Namespace node.default booleanisNaN()Checks doubles and floats for NaN.default booleanisNode()Tests whether the item is an XML node.default booleanisNull()Tests whether the item is the null item.default booleanTests whether the item is a number (decimal or double).default booleanisObject()Tests whether the item is an object.default booleanisPeriod()Tests whether the item is an atomic item of type period.default booleanTests whether the item is an XML Processing Instruction node.default booleanisQName()Tests whether the item is an atomic item of type xs:QName (expanded QName, seeName).default booleanisString()Tests whether the item is an atomic item of type string.default booleandefault booleanisTime()Tests whether the item is an atomic item of type time.default booleandefault booleanTests whether the item is an atomic item of type xs:untypedAtomic.default booleanTests whether the item is an atomic item of type yearMonthDuration.XDM 3.1 Section 5.7 namespace-nodes Accessor.nilled()XDM 3.1 Section 5.8 nilled Accessor.default StringnodeKind()XDM 3.1 Section 5.9 node-kind Accessor.default NamenodeName()XDM 3.1 Section 5.10 node-name Accessor.default Itemparent()XDM 3.1 Section 5.11 parent Accessor.default booleanphysicalEquals(Object other) Tests for physical equality.default voidPuts an item at the given index, if it is an array.default voidputItemByKey(String key, Item value) Adds a key-value pair, if it is a map.default voidputItemByKey(Item key, Item value) Adds a key-value pair, if it is a map.default voidputItemsAt(List<Item> items, int i) Add all items in items at index i, if it is an array.default voidputLazyItemByKey(String key, RuntimeIterator iterator, DynamicContext context, boolean isArray) Adds a key-value pair, if it is a lazy object item.default voidputSequenceAt(List<Item> sequence, int index) Puts a sequence at the given index, if it is an array.default voidputSequenceByKey(String key, List<Item> valueSequence) Adds a key-sequence pair, if it is a map.default voidputSequenceByKey(Item key, List<Item> valueSequence) Adds a key-sequence pair, if it is a map.default voidputSequencesAt(List<List<Item>> sequences, int index) Puts sequences at the given index, if it is an array.default voidremoveItemAt(int index) Removes the item at the given index, if it is an array.default voidremoveItemByKey(String key) Removes a key-value pair, if it is a map.default voidremoveItemByKey(Item key) Removes a key-value pair, if it is a map.default voidremoveSequenceAt(int index) Removes the sequence at the given index, if it is an array.default Stringdefault Stringdefault voidsetCollection(Collection collection) Sets the collection to which the item belongs.default voidsetMutabilityLevel(int mutabilityLevel) Sets the mutability level of the item to a supplied value.default voiddefault voidSets the path from the top level object of a DeltaFile for the item to a supplied value.default voidsetTableLocation(String location) Sets the location of the DeltaFile for the item to a supplied value.default voidsetTopLevelID(long topLevelID) Sets the top level ID of the item to a supplied value.default voidsetTopLevelOrder(double topLevelOrder) Sets the top level order parameter (rowOrder)default intsetXmlDocumentPosition(String path, int current) Set the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniquenessXDM 3.1 Section 5.14 typed-value Accessor.typeName()XDM 3.1 Section 5.13 type-name Accessor.unparsedEntityPublicId(String name) XDM 3.1 Section 5.15 unparsed-entity-public-id Accessor.unparsedEntitySystemId(String name) XDM 3.1 Section 5.16 unparsed-entity-system-id Accessor.Methods inherited from interface com.esotericsoftware.kryo.KryoSerializable
read, write
-
Method Details
-
isFunction
default boolean isFunction()Tests whether the item is a function.- Returns:
- true if it is a function, false otherwise
-
isBuiltinFunction
default boolean isBuiltinFunction()Whether this item is a function item representing a builtin function. -
isAtomic
default boolean isAtomic()Tests whether the item is an atomic item.- Returns:
- true if it is an atomic item, false otherwise.
-
isString
default boolean isString()Tests whether the item is an atomic item of type string.- Returns:
- true if it is an atomic item of type string, false otherwise.
-
isUntypedAtomic
default boolean isUntypedAtomic()Tests whether the item is an atomic item of type xs:untypedAtomic.- Returns:
- true if it is an atomic item of type xs:untypedAtomic, false otherwise.
-
isBoolean
default boolean isBoolean()Tests whether the item is an atomic item of type default boolean.- Returns:
- true if it is an atomic item of type default boolean, false otherwise.
-
isNull
default boolean isNull()Tests whether the item is the null item.- Returns:
- true if it is the null item, false otherwise.
-
isNumeric
default boolean isNumeric()Tests whether the item is a number (decimal or double).- Returns:
- true if it is a number, false otherwise.
-
isDecimal
default boolean isDecimal()Tests whether the item is an atomic item of type decimal.- Returns:
- true if it is an atomic item of type decimal, false otherwise.
-
isInteger
default boolean isInteger()Tests whether the item is an atomic item of type integer.- Returns:
- true if it is an atomic item of type integer, false otherwise.
-
isInt
default boolean isInt()Tests whether the item is an atomic item of type int.- Returns:
- true if it is an atomic item of type int, false otherwise.
-
isDouble
default boolean isDouble()Tests whether the item is an atomic item of type double.- Returns:
- true if it is an atomic item of type double, false otherwise.
-
isFloat
default boolean isFloat()Tests whether the item is an atomic item of type float.- Returns:
- true if it is an atomic item of type float, false otherwise.
-
isDuration
default boolean isDuration()Tests whether the item is an atomic item of type duration.- Returns:
- true if it is an atomic item of type duration, false otherwise.
-
isPeriod
default boolean isPeriod()Tests whether the item is an atomic item of type period.- Returns:
- true if it is an atomic item of type period, false otherwise.
-
isYearMonthDuration
default boolean isYearMonthDuration()Tests whether the item is an atomic item of type yearMonthDuration.- Returns:
- true if it is an atomic item of type yearMonthDuration, false otherwise.
-
isDayTimeDuration
default boolean isDayTimeDuration()Tests whether the item is an atomic item of type dayTimeDuration.- Returns:
- true if it is an atomic item of type dayTimeDuration, false otherwise.
-
getMonth
default int getMonth()Return only month of the item, if it's DateTime or Duration It will not convert years into months- Returns:
- only month
-
getYear
default int getYear()Return year of the item, if it's DateTime or Duration- Returns:
- year
-
getDay
default int getDay()Return only day of the item, if it's DateTime or Duration It will not convert months and years into days.- Returns:
- only day
-
getOffset
default int getOffset()Offset is an integer between −840 and 840 inclusive- Returns:
- offset in minutes
-
getHour
default int getHour()Return only hour of the item, if it's DateTime, Time or Duration- Returns:
- only hour
-
getMinute
default int getMinute()Return only minutes of the item, if it's DateTime, Time or Duration It will not convert hours into minutes- Returns:
- only minute
-
getSecond
default double getSecond()Return only seconds of the item, if it's DateTime, Time or Duration It will not convert hours and minutes into seconds- Returns:
- only seconds
-
getNanosecond
default int getNanosecond()Return the only nanoseconds of the item, if it's DateTime, Time or Duration It will not convert hours, minutes and seconds into nanoseconds It exists only if the value in seconds will have decimal values, otherwise it will return 0- Returns:
- only nanoseconds
-
isDateTime
default boolean isDateTime()Tests whether the item is an atomic item of type dateTime.- Returns:
- true if it is an atomic item of type dateTime, false otherwise.
-
isDate
default boolean isDate()Tests whether the item is an atomic item of type date.- Returns:
- true if it is an atomic item of type date, false otherwise.
-
isTime
default boolean isTime()Tests whether the item is an atomic item of type time.- Returns:
- true if it is an atomic item of type time, false otherwise.
-
isGDay
default boolean isGDay()Tests whether the item is an atomic item of type gDay.- Returns:
- true if it is an atomic item of type gDay, false otherwise.
-
isGMonth
default boolean isGMonth()Tests whether the item is an atomic item of type gMonth.- Returns:
- true if it is an atomic item of type gMonth, false otherwise.
-
isGYear
default boolean isGYear()Tests whether the item is an atomic item of type gYear.- Returns:
- true if it is an atomic item of type gYear, false otherwise.
-
isGMonthDay
default boolean isGMonthDay()Tests whether the item is an atomic item of type gMonthDay.- Returns:
- true if it is an atomic item of type gMonthDay, false otherwise.
-
isGYearMonth
default boolean isGYearMonth()Tests whether the item is an atomic item of type gMonthDay.- Returns:
- true if it is an atomic item of type gMonthDay, false otherwise.
-
isAnyURI
default boolean isAnyURI()Tests whether the item is an atomic item of type anyURI.- Returns:
- true if it is an atomic item of type anyURI, false otherwise.
-
isQName
default boolean isQName()Tests whether the item is an atomic item of type xs:QName (expanded QName, seeName).- Returns:
- true if it is an xs:QName item, false otherwise.
-
getQNameValue
Returns the expanded name of this item when it is an xs:QName. Value equality followsName: same namespace URI and local name; the prefix is not significant for equality.- Returns:
- the expanded name.
- Throws:
UnsupportedOperationException- if the item is not an xs:QName.
-
isBinary
default boolean isBinary()Tests whether the item is an atomic item of type base64Binary or hexBinary.- Returns:
- true if it is an atomic item of type base64Binary or hexBinary, false otherwise.
-
isHexBinary
default boolean isHexBinary()Tests whether the item is an atomic item of type hexBinary.- Returns:
- true if it is an atomic item of type hexBinary, false otherwise.
-
isBase64Binary
default boolean isBase64Binary()Tests whether the item is an atomic item of type base64Binary.- Returns:
- true if it is an atomic item of type base64Binary, false otherwise.
-
isElementNode
default boolean isElementNode()Tests whether the item is an XML Element node.- Returns:
- true if it is an XML Element node, false otherwise.
-
isAttributeNode
default boolean isAttributeNode()Tests whether the item is an XML Attribute node.- Returns:
- true if it is an XML Attribute node, false otherwise.
-
getContent
default boolean getContent()Tests whether the item is an XML Text node.- Returns:
- true if it is an XML Text node, false otherwise.
-
isDocumentNode
default boolean isDocumentNode()Tests whether the item is an XML Document node.- Returns:
- true if it is an XML Document node, false otherwise.
-
isTextNode
default boolean isTextNode() -
isCommentNode
default boolean isCommentNode() -
isNamespaceNode
default boolean isNamespaceNode()Tests whether the item is an XML Namespace node.- Returns:
- true if it is an XML Namespace node, false otherwise.
-
isProcessingInstructionNode
default boolean isProcessingInstructionNode()Tests whether the item is an XML Processing Instruction node.- Returns:
- true if it is an XML Processing Instruction node, false otherwise.
-
isNode
default boolean isNode()Tests whether the item is an XML node.- Returns:
- true if it is an XML node, false otherwise.
-
isMap
default boolean isMap()Tests whether the item is a map.- Returns:
- true if it is a map, false otherwise.
-
isObject
default boolean isObject()Tests whether the item is an object. Object items are legacy JSONiq objects, that allow only for - string keys - singleton values- Returns:
- true if it is an object, false otherwise.
-
getKeys
Deprecated.usegetStringKeys()insteadReturns the string keys of the item, if it is a map.- Returns:
- the list of the keys.
-
getStringKeys
Returns the string keys of the item, if it is a map.- Returns:
- a list of strings, corresponding to the keys of the map.
- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the map contains non-string keys.
-
getItemKeys
Returns the (possibly non-string) atomic keys of the item, if it is a map-like object.- Returns:
- the list of atomic keys as items.
- Throws:
UnsupportedOperationException- if the item is not a map.
-
getValues
Deprecated.usegetItemValues()insteadReturns the values of the item, if it is a map.- Returns:
- the list of the value items.
-
getItemValues
Returns the values of the item, if it is a map.- Returns:
- a list containing, for each key in the map, the item associated with that key.
- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the map contains non-singleton values.
-
getSequenceValues
Returns the value sequences of the item, if it is a map.- Returns:
- a list containing, for each key in the map, the sequence of items associated with that key.
- Throws:
UnsupportedOperationException- if the item is not a map.
-
getItemByKey
Returns the value item associated with a specific key, if it is a map.- Parameters:
key- a string key.- Returns:
- the item associated with the key, or null if absent.
- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the value item associated with the key is not a singleton.
-
getItemByKey
Returns the value item associated with a specific key, if it is an object.- Parameters:
key- a key item.- Returns:
- the item associated with the key, or null if absent.
- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the value item associated with the key is not a singleton.
-
getSequenceByKey
Returns the value sequence associated with a string key, if it is a map.- Parameters:
key- a string key.- Returns:
- the value sequence for the key, or null if absent.
- Throws:
UnsupportedOperationException- if the item is not a map.
-
getSequenceByKey
Returns the value sequence associated with a key, if it is a map-like object.- Parameters:
key- an atomic key item.- Returns:
- the value sequence for the key, or null if absent.
- Throws:
UnsupportedOperationException- if the item is not a map.
-
putItemByKey
default void putItemByKey(String key, Item value) throws UnsupportedOperationException, OurBadException Adds a key-value pair, if it is a map.- Parameters:
key- a key.value- a value.- Throws:
UnsupportedOperationException- if the item is not a map.DuplicateObjectKeyException- if the key is already present.OurBadException
-
putItemByKey
default void putItemByKey(Item key, Item value) throws UnsupportedOperationException, OurBadException, DuplicateObjectKeyException Adds a key-value pair, if it is a map.- Parameters:
key- an atomic key.value- a value.- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the key is not atomic, or if the key is not a string item and the item does not support non-string keys.DuplicateObjectKeyException- if the key is already present.
-
putSequenceByKey
default void putSequenceByKey(String key, List<Item> valueSequence) throws UnsupportedOperationException, OurBadException, DuplicateObjectKeyException Adds a key-sequence pair, if it is a map.- Parameters:
key- an atomic key.valueSequence- a value sequence.- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the value sequence is not a singleton and the item does not support non-singleton values.DuplicateObjectKeyException- if the key is already present.
-
putSequenceByKey
default void putSequenceByKey(Item key, List<Item> valueSequence) throws UnsupportedOperationException, OurBadException, DuplicateObjectKeyException Adds a key-sequence pair, if it is a map.- Parameters:
key- an atomic key.valueSequence- a value sequence.- Throws:
UnsupportedOperationException- if the item is not a map.OurBadException- if the value sequence is not a singleton and the item does not support non-singleton values.OurBadException- if the key is not atomic, or if the key is not a string item and the item does not support non-string keys.DuplicateObjectKeyException- if the key is already present.
-
removeItemByKey
Removes a key-value pair, if it is a map.- Parameters:
key- a key.- Throws:
UnsupportedOperationException- if the item is not a map.
-
removeItemByKey
Removes a key-value pair, if it is a map.- Parameters:
key- an atomic key.- Throws:
UnsupportedOperationException- if the item is not a map.
-
putLazyItemByKey
default void putLazyItemByKey(String key, RuntimeIterator iterator, DynamicContext context, boolean isArray) throws UnsupportedOperationException Adds a key-value pair, if it is a lazy object item. The value is lazily computed.- Parameters:
key- a key.iterator- a runtime iterator.context- a dynamic context.isArray- whether to always wrap the result in an array.- Throws:
UnsupportedOperationException- if the item is not a lazy object.
-
isArray
default boolean isArray()Tests whether the item is an array.- Returns:
- true if it is an array, false otherwise.
-
isArrayOfItems
default boolean isArrayOfItems()Tests whether the item is an array of items. Arrays of items are arrays whose members are singletons.- Returns:
- true if it is an array of items, false otherwise.
-
getSize
Returns the size of the item, if it is an array.- Returns:
- the size as an int.
- Throws:
UnsupportedOperationException- if the item is not an array.
-
getItems
Deprecated.usegetItemMembers()insteadReturns the members of the item if it is an array.- Returns:
- the list of the array members.
-
getItemMembers
Returns the members of the item, if it is an array.- Returns:
- the list of the members.
- Throws:
UnsupportedOperationException- if the item is not an array.OurBadException- if any member of the array is a non-singleton.
-
getSequenceMembers
Returns the member sequences of the item, if it is an array.- Returns:
- the list of the members.
- Throws:
UnsupportedOperationException- if the item is not an array.
-
getItemAt
default Item getItemAt(int position) throws UnsupportedOperationException, OurBadException, ArrayIndexOutOfBoundsException Returns the member of the item at the specified position if it is an array.- Parameters:
position- the position of the member.- Returns:
- the member.
- Throws:
UnsupportedOperationException- if the item is not an array.OurBadException- if the member is a non-singleton.ArrayIndexOutOfBoundsException- if the position is out of bounds.
-
getSequenceAt
default List<Item> getSequenceAt(int position) throws UnsupportedOperationException, ArrayIndexOutOfBoundsException Returns the member of the item at the specified position if it is an array.- Parameters:
position- the position of the member.- Returns:
- the member.
- Throws:
UnsupportedOperationException- if the item is not an array.ArrayIndexOutOfBoundsException- if the position is out of bounds.
-
append
Deprecated.useappendItem(Item)insteadAppends an item to the item, if it is an array.- Parameters:
item- the item to append.- Throws:
UnsupportedOperationException- if the item is not an array.
-
appendItem
Appends an item to the item, if it is an array.- Parameters:
item- the item to append.- Throws:
UnsupportedOperationException- if the item is not an array.
-
appendSequence
default void appendSequence(List<Item> sequence) throws UnsupportedOperationException, OurBadException Appends a sequence to the item, if it is an array.- Parameters:
sequence- the sequence to append.- Throws:
UnsupportedOperationException- if the item is not an array.OurBadException- if the member is a non-singleton sequence and the array does not support non-singleton members.
-
putItemAt
Puts an item at the given index, if it is an array.- Parameters:
item- the item to put.index- the index to put the item at.- Throws:
UnsupportedOperationException- if the item is not an array.
-
putSequenceAt
default void putSequenceAt(List<Item> sequence, int index) throws UnsupportedOperationException, OurBadException Puts a sequence at the given index, if it is an array.- Parameters:
sequence- the sequence to put.index- the index to put the sequence at.- Throws:
UnsupportedOperationException- if the item is not an array.OurBadException- if the member is a non-singleton sequence and the array does not support non-singleton members.
-
putItemsAt
Add all items in items at index i, if it is an array.- Parameters:
items- a list of items.i- an integer.- Throws:
UnsupportedOperationException- if the item is not an array.
-
putSequencesAt
default void putSequencesAt(List<List<Item>> sequences, int index) throws UnsupportedOperationException, OurBadException Puts sequences at the given index, if it is an array.- Parameters:
sequences- the sequences to put.index- the index to put the sequence at.- Throws:
UnsupportedOperationException- if the item is not an array.OurBadException- if any member is a non-singleton sequence and the array does not support non-singleton members.
-
removeItemAt
Removes the item at the given index, if it is an array.- Parameters:
index- the index to remove the item at.- Throws:
UnsupportedOperationException- if the item is not an array.
-
removeSequenceAt
Removes the sequence at the given index, if it is an array.- Parameters:
index- the index to remove the sequence at.- Throws:
UnsupportedOperationException- if the item is not an array.
-
getStringValue
Returns the string value of the item, if it is an atomic item.- Returns:
- the string value.
-
getBooleanValue
default boolean getBooleanValue()Returns the boolean value of the item, if it is a boolean.- Returns:
- the boolean value.
-
getDoubleValue
default double getDoubleValue()Returns the double value of the item, if it is a double.- Returns:
- the double value.
-
getFloatValue
default float getFloatValue()Returns the float value of the item, if it is a float.- Returns:
- the float value.
-
getIntValue
default int getIntValue()Returns the int value of the item, if it is an int.- Returns:
- the integer value as an int.
-
getIntegerValue
Returns the integer value of the item as a bit integer, if it is an integer.- Returns:
- the integer value as a BigInteger.
-
getDecimalValue
Returns the decimal value of the item, if it is a decimal.- Returns:
- the decimal value as a BigDecimal.
-
getPeriodValue
Returns the period value of the item, if it is a duration.- Returns:
- the period value as a Period.
-
getDurationValue
Returns the duration value of the item, if it is a duration.- Returns:
- the duration value as a Duration.
-
getEpochMillis
default long getEpochMillis()Returns the EpochMillis of the item, if it's DateTime or Duration It will collect all the parts of the item and compress it into the EpochMillis- Returns:
- the EpochMillis
-
getDateTimeValue
Returns the dateTime value of the item, if it is an atomic item of type dateTimeItem or dateItem or timeItem.- Returns:
- the dateTime value as a OffsetDateTime.
-
getTimeValue
Returns the time value of the item, if it is an atomic item of type or timeItem.- Returns:
- the time value as a OffsetTime.
-
getBinaryValue
default byte[] getBinaryValue()Returns the byte[] value of the item, if it is an atomic item of type hexBinary or Base64Binary.- Returns:
- the binary value as an array of bytes.
-
getDynamicType
Returns the dynamic type of the item (only for error message purposes).- Returns:
- the dynamic type as an item type.
-
getIdentifier
Returns the identifier (name and arity) of the function, if it is a function item.- Returns:
- the function identifier.
-
getParameterNames
Returns the names of the parameters of the function, if it is a function item.- Returns:
- the function parameter names.
-
getSignature
Returns the signature of the function, if it is a function item.- Returns:
- the function signature.
-
getBodyIterator
Returns the body iterator, if it is a function item.- Returns:
- the function signature.
-
getLocalVariablesInClosure
Returns the local variable bindings, if it is a function item.- Returns:
- the function signature.
-
getRDDVariablesInClosure
Returns the RDD variable bindings, if it is a function item.- Returns:
- the function signature.
-
getDFVariablesInClosure
Returns the DataFrame variable bindings, if it is a function item.- Returns:
- the function signature.
-
getModuleDynamicContext
Returns the module dynamic context, if it is a function item.- Returns:
- the function signature.
-
hasTimeZone
default boolean hasTimeZone()- Returns:
- true if the Item has a timeZone, false otherwise
-
hasDateTime
default boolean hasDateTime()Tests whether the item contains a representation of date or time (or both).- Returns:
- true if it is an atomic item of type time, date or dateTime, false otherwise.
-
getEffectiveBooleanValue
default boolean getEffectiveBooleanValue()Returns the effective boolean value of the item, if atomic.- Returns:
- the effective boolean value.
-
castToDoubleValue
default double castToDoubleValue()Casts the item to a double value (must be a numeric).- Returns:
- the double value.
-
castToFloatValue
default float castToFloatValue()Casts the item to a float value (must be a numeric).- Returns:
- the float value.
-
castToDecimalValue
Casts the item to a decimal value (must be a numeric).- Returns:
- the BigDecimal value.
-
castToIntegerValue
Casts the item to a big integer value (must be a numeric).- Returns:
- the BigInteger value.
-
castToIntValue
default int castToIntValue()Casts the item to an integer value (must be a numeric).- Returns:
- the int value.
-
isNaN
default boolean isNaN()Checks doubles and floats for NaN.- Returns:
- true if NaN, false if not NaN.
-
getMutabilityLevel
default int getMutabilityLevel()Returns the mutability level of the item.- Returns:
- an int representing nestedness of the item inside transform expressions.
-
setMutabilityLevel
default void setMutabilityLevel(int mutabilityLevel) Sets the mutability level of the item to a supplied value.- Parameters:
mutabilityLevel- new mutability level.
-
getTopLevelID
default long getTopLevelID()Returns the top level ID of the item.- Returns:
- int representing the rowID of the item within a DeltaFile.
-
setTopLevelID
default void setTopLevelID(long topLevelID) Sets the top level ID of the item to a supplied value.- Parameters:
topLevelID- new top level ID.
-
getPathIn
Returns the path from the top level object of a DeltaFile for the item.- Returns:
- String representing the path of the item from the top level within a DeltaFile.
-
setPathIn
Sets the path from the top level object of a DeltaFile for the item to a supplied value.- Parameters:
pathIn- new path from top level.
-
getTableLocation
Returns the location of the DeltaFile for the item.- Returns:
- String representing the location of the DeltaFile for the item.
-
setTableLocation
Sets the location of the DeltaFile for the item to a supplied value.- Parameters:
location- new location of the DeltaFile for the item.
-
getTopLevelOrder
default double getTopLevelOrder()Returns the top level order (sequence number) identifier- Returns:
- double representing rowOrder of the tuple
-
setTopLevelOrder
default void setTopLevelOrder(double topLevelOrder) Sets the top level order parameter (rowOrder)- Parameters:
topLevelOrder- new rowOrder value
-
getSparkSQLValue
Returns the SparkSQL value of the item for use in a query.- Returns:
- String representing the SparkSQL value of the item.
-
getSparkSQLValue
Returns the SparkSQL value of the item for use in a query.- Returns:
- String representing the SparkSQL value of the item.
-
getSparkSQLType
Returns the SparkSQL type of the item for use in a query.- Returns:
- String representing the SparkSQL type of the item.
-
getVariantValue
Returns the Object containing the converted value of the item for a DataFrame. For use to build Variant columns.- Returns:
- Object representing the converted value of the item.
-
physicalEquals
Tests for physical equality. The semantics are that of the eq operator.- Parameters:
other- another item.- Returns:
- true it is equal to other, false otherwise.
-
equals
Tests for logical equality. The semantics are that of the eq operator. -
hashCode
int hashCode()Computes a hash code. -
serialize
-
serializeAsJSON
-
generateNativeQuery
Get sparkSql string for the item- Parameters:
context- input context- Returns:
- String representing the item in a sparksql query or null if it is not supported for the item
-
isEstimator
default boolean isEstimator() -
getEstimator
default org.apache.spark.ml.Estimator<?> getEstimator() -
isTransformer
default boolean isTransformer() -
getTransformer
default org.apache.spark.ml.Transformer getTransformer() -
getTextValue
Returns the string value of the text item, if it is a text item.- Returns:
- the string value.
-
addParentToDescendants
default void addParentToDescendants()Method sets the parent item for all descendents of the current item. -
attributes
XDM 3.1 Section 5.1 attributes Accessor. dm:attributes($n as node()) as attribute()* "The dm:attributes accessor returns the dynamic, unordered set of attribute nodes that have the node as their parent. It is defined only on element and document nodes; for other node kinds it returns the empty sequence." -
children
XDM 3.1 Section 5.3 children Accessor. dm:children($n as node()) as node()* "The dm:children accessor returns the dynamic, ordered sequence of child nodes of the node. It is defined on all node kinds except attribute and namespace nodes; for those node kinds it returns the empty sequence." -
namespaceNodes
XDM 3.1 Section 5.7 namespace-nodes Accessor. dm:namespace-nodes($n as node()) as namespace-node()* "The dm:namespace-nodes accessor returns the dynamic, unordered set of Namespace Nodes. It is defined on all seven node kinds." This default implementation is only a placeholder on the generic Item interface and must be overridden by XML node implementations that support namespaces. -
declaredNamespaceNodes
Helper accessor for XML element nodes: returns namespace nodes for the namespace bindings declared directly on the element. This does not include inherited or statically known namespaces — only the bindings explicitly declared on the element (for example via xmlns attributes). Non-element nodes must override this to return the empty sequence. -
nodeKind
XDM 3.1 Section 5.9 node-kind Accessor. dm:node-kind($n as node()) as xs:string "The dm:node-kind accessor returns the kind of the node. The node kind is one of the strings \"document\", \"element\", \"attribute\", \"text\", \"namespace\", \"processing-instruction\", or \"comment\"." This default implementation is only a placeholder on the generic Item interface and must be overridden by XML node implementations. -
baseUri
XDM 3.1 Section 5.2 base-uri Accessor. dm:base-uri($n as node()) as xs:anyURI? "The dm:base-uri accessor returns the value of the base-uri property of the node, if it has one; otherwise it returns the empty sequence." -
documentUri
XDM 3.1 Section 5.4 document-uri Accessor. dm:document-uri($n as document-node()) as xs:anyURI? "The dm:document-uri accessor returns the value of the document-uri property of a document node, if it has one; otherwise it returns the empty sequence." -
isId
default boolean isId()XDM 3.1 Section 5.5 is-id Accessor. dm:is-id($n as node()) as xs:boolean "The dm:is-id accessor returns true if the node is an attribute node whose type is xs:ID or is derived by restriction from xs:ID; otherwise it returns false." -
isIdrefs
default boolean isIdrefs()XDM 3.1 Section 5.6 is-idrefs Accessor. dm:is-idrefs($n as node()) as xs:boolean "The dm:is-idrefs accessor returns true if the node is an attribute node whose type is xs:IDREF or xs:IDREFS or is derived by restriction from one of these types; otherwise it returns false." -
nilled
XDM 3.1 Section 5.8 nilled Accessor. dm:nilled($n as node()) as xs:boolean? "The dm:nilled accessor returns true if the element node is nilled, false if the element node is not nilled, or the empty sequence if the concept of nilled does not apply." In this API, the optional xs:boolean result is represented as a sequence of zero or one Items. -
typeName
XDM 3.1 Section 5.13 type-name Accessor. dm:type-name($n as node()) as xs:QName? "The dm:type-name accessor returns the name of the dynamic type of the node, or the empty sequence if the node is untyped." -
typedValue
XDM 3.1 Section 5.14 typed-value Accessor. dm:typed-value($n as node()) as xs:anyAtomicType* "The dm:typed-value accessor returns the typed value of the node as a sequence of zero or more atomic values." In this API, the typed value is exposed as a sequence of Items, which are expected to be atomic items in the XDM sense. -
unparsedEntityPublicId
XDM 3.1 Section 5.15 unparsed-entity-public-id Accessor. dm:unparsed-entity-public-id($n as document-node(), $name as xs:string) as xs:string? "The dm:unparsed-entity-public-id accessor returns the public identifier of an unparsed entity with a given name in the document, or the empty sequence if there is no such entity or if it has no public identifier." -
unparsedEntitySystemId
XDM 3.1 Section 5.16 unparsed-entity-system-id Accessor. dm:unparsed-entity-system-id($n as document-node(), $name as xs:string) as xs:anyURI? "The dm:unparsed-entity-system-id accessor returns the system identifier of an unparsed entity with a given name in the document, or the empty sequence if there is no such entity or if it has no system identifier." -
nodeName
XDM 3.1 Section 5.10 node-name Accessor. dm:node-name($n as node()) as xs:QName? "The dm:node-name accessor returns the name of the node as an xs:QName, or the empty sequence if the node does not have a name."- Returns:
- the expanded name (
Name) of the node, ornullwhen the accessor yields the empty sequence - Throws:
UnsupportedOperationException- if called on an item that is not a node
-
parent
XDM 3.1 Section 5.11 parent Accessor. dm:parent($n as node()) as node()? "The dm:parent accessor returns the parent of the node, or the empty sequence if the node has no parent." -
atomizedValue
XDM 3.1 Section 5.12 string-value Accessor. dm:string-value($n as node()) as xs:string "The dm:string-value accessor returns the string-value of the node as defined for each node kind." In this API, node string values are exposed via getStringValue() and the default implementation of dm:typed-value delegates to atomizedValue(). -
setParent
-
getXmlDocumentPosition
Get the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniqueness- Returns:
- the XML document position
-
setXmlDocumentPosition
Set the position of the Node inside the XML document (and path incase of multiple docs) for sorting / uniqueness- Parameters:
path- the path of the XML documentcurrent- the current position- Returns:
- the new position
-
getCollection
Returns the collection to which the item belongs, if any. Only defined for top-level items.- Returns:
- the collection.
-
setCollection
Sets the collection to which the item belongs. Only defined for top-level items.- Parameters:
collection- the collection.
-
appendItem(Item)instead