diff --git a/src/main/java/org/rumbledb/api/Item.java b/src/main/java/org/rumbledb/api/Item.java index fbc6d5f720..9e922180e1 100644 --- a/src/main/java/org/rumbledb/api/Item.java +++ b/src/main/java/org/rumbledb/api/Item.java @@ -951,9 +951,13 @@ default void removeSequenceAt(int index) throws UnsupportedOperationException { // endregion arrays /** - * Returns the string value of the item, if it is an atomic item. + * XDM 3.1 string-value Accessor. * - * @return the string value. + * For node items, this method corresponds to the {@code dm:string-value} accessor and + * returns the node's string value as defined by its node kind. For atomic items, it + * returns the lexical string value of the atomic item. + * + * @return the string value of the item. */ default String getStringValue() { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); @@ -1462,6 +1466,8 @@ default void addParentToDescendants() { * "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." + * + * This method corresponds directly to that accessor. */ default List attributes() { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); @@ -1475,6 +1481,8 @@ default List attributes() { * "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." + * + * This method corresponds directly to that accessor. */ default List children() { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); @@ -1488,20 +1496,22 @@ default List children() { * "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. + * This method corresponds directly to that accessor. The default implementation is only a + * placeholder on the generic Item interface and must be overridden by XML node + * implementations that support namespaces. */ default List namespaceNodes() { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); } /** - * 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). + * Helper derived from the XDM 3.1 {@code dm:namespace-nodes} 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 {@code xmlns} attributes). * - * Non-element nodes must override this to return the empty sequence. + * Unlike {@link #namespaceNodes()}, this is not a standard XDM accessor; it exposes the + * subset of namespace nodes that are locally declared on the element. */ default List declaredNamespaceNodes() { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); @@ -1611,7 +1621,10 @@ default List typeName() { * atomic items in the XDM sense. */ default List typedValue() { - return this.atomizedValue(); + if (isAtomic()) { + return Collections.singletonList(this); + } + throw new UnsupportedOperationException("Operation not defined for class " + this.getClass().getName()); } /** @@ -1669,24 +1682,6 @@ default Item parent() { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); } - /** - * 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(). - */ - default List atomizedValue() { - if (isAtomic()) - return Collections.singletonList(this); - else - throw new UnsupportedOperationException("Operation not defined for class " + this.getClass().getName()); - } - default void setParent(Item parent) { throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType()); } diff --git a/src/main/java/org/rumbledb/items/AnnotatedItem.java b/src/main/java/org/rumbledb/items/AnnotatedItem.java index 23e006591e..d68984bcad 100644 --- a/src/main/java/org/rumbledb/items/AnnotatedItem.java +++ b/src/main/java/org/rumbledb/items/AnnotatedItem.java @@ -771,7 +771,8 @@ public List typeName() { @Override public List typedValue() { - return this.itemToAnnotate.typedValue(); + // An annotated atomic item yields itself as typed value so its annotation is preserved. + return this.isAtomic() ? List.of(this) : this.itemToAnnotate.typedValue(); } @Override @@ -869,13 +870,6 @@ public void setTopLevelOrder(double topLevelOrder) { this.itemToAnnotate.setTopLevelOrder(topLevelOrder); } - @Override - public List atomizedValue() { - // An annotated atomic item atomizes to itself. Delegating to the - // wrapped item would discard the annotation and lose its subtype. - return this.isAtomic() ? List.of(this) : this.itemToAnnotate.atomizedValue(); - } - @Override public String serialize() { return Item.super.serialize(); diff --git a/src/main/java/org/rumbledb/items/ArrayItem.java b/src/main/java/org/rumbledb/items/ArrayItem.java index c57a2a4a00..d680195247 100644 --- a/src/main/java/org/rumbledb/items/ArrayItem.java +++ b/src/main/java/org/rumbledb/items/ArrayItem.java @@ -328,10 +328,10 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { List result = new ArrayList<>(); for (Item member : this.arrayItems) { - result.addAll(member.atomizedValue()); + result.addAll(member.typedValue()); } return result; } diff --git a/src/main/java/org/rumbledb/items/FunctionItem.java b/src/main/java/org/rumbledb/items/FunctionItem.java index 7cd724ee2f..49625bd463 100644 --- a/src/main/java/org/rumbledb/items/FunctionItem.java +++ b/src/main/java/org/rumbledb/items/FunctionItem.java @@ -423,7 +423,7 @@ public void setModuleDynamicContext(DynamicContext dynamicModuleContext) { } @Override - public List atomizedValue() { + public List typedValue() { throw new CannotAtomizeException("tried to atomize Function", ExceptionMetadata.EMPTY_METADATA); } diff --git a/src/main/java/org/rumbledb/items/MapEntryItem.java b/src/main/java/org/rumbledb/items/MapEntryItem.java index d59a15ff3c..ff30d093f2 100644 --- a/src/main/java/org/rumbledb/items/MapEntryItem.java +++ b/src/main/java/org/rumbledb/items/MapEntryItem.java @@ -299,7 +299,7 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { throw new CannotAtomizeException("tried to atomize Map", ExceptionMetadata.EMPTY_METADATA); } diff --git a/src/main/java/org/rumbledb/items/MapItem.java b/src/main/java/org/rumbledb/items/MapItem.java index c853e3d0e8..2960a3d80e 100644 --- a/src/main/java/org/rumbledb/items/MapItem.java +++ b/src/main/java/org/rumbledb/items/MapItem.java @@ -479,7 +479,7 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { throw new CannotAtomizeException("tried to atomize Map", ExceptionMetadata.EMPTY_METADATA); } diff --git a/src/main/java/org/rumbledb/items/MapWithAdditionalEntryItem.java b/src/main/java/org/rumbledb/items/MapWithAdditionalEntryItem.java index 604c9e6a38..b7b561000c 100644 --- a/src/main/java/org/rumbledb/items/MapWithAdditionalEntryItem.java +++ b/src/main/java/org/rumbledb/items/MapWithAdditionalEntryItem.java @@ -323,7 +323,7 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { throw new CannotAtomizeException("tried to atomize Map", ExceptionMetadata.EMPTY_METADATA); } diff --git a/src/main/java/org/rumbledb/items/MapWithRemovedEntryItem.java b/src/main/java/org/rumbledb/items/MapWithRemovedEntryItem.java index 908db0d2db..9b7f543867 100644 --- a/src/main/java/org/rumbledb/items/MapWithRemovedEntryItem.java +++ b/src/main/java/org/rumbledb/items/MapWithRemovedEntryItem.java @@ -318,7 +318,7 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { throw new CannotAtomizeException("tried to atomize Map", ExceptionMetadata.EMPTY_METADATA); } diff --git a/src/main/java/org/rumbledb/items/ObjectItem.java b/src/main/java/org/rumbledb/items/ObjectItem.java index 16b4a4f86d..bd52adfd22 100644 --- a/src/main/java/org/rumbledb/items/ObjectItem.java +++ b/src/main/java/org/rumbledb/items/ObjectItem.java @@ -550,7 +550,7 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { throw new CannotAtomizeException("tried to atomize Object", ExceptionMetadata.EMPTY_METADATA); } diff --git a/src/main/java/org/rumbledb/items/SequenceArrayItem.java b/src/main/java/org/rumbledb/items/SequenceArrayItem.java index b0e2efc351..9c1f189a5d 100644 --- a/src/main/java/org/rumbledb/items/SequenceArrayItem.java +++ b/src/main/java/org/rumbledb/items/SequenceArrayItem.java @@ -379,11 +379,11 @@ public String getSparkSQLType() { } @Override - public List atomizedValue() { + public List typedValue() { List result = new ArrayList<>(); for (List memberSequence : this.memberSequences) { for (Item item : memberSequence) { - result.addAll(item.atomizedValue()); + result.addAll(item.typedValue()); } } return result; diff --git a/src/main/java/org/rumbledb/items/xml/AttributeItem.java b/src/main/java/org/rumbledb/items/xml/AttributeItem.java index 40bf99a3c7..c0a3ed8d35 100644 --- a/src/main/java/org/rumbledb/items/xml/AttributeItem.java +++ b/src/main/java/org/rumbledb/items/xml/AttributeItem.java @@ -185,7 +185,7 @@ public int hashCode() { } @Override - public List atomizedValue() { + public List typedValue() { if (this.typeAnnotation != null) { Item typedValue = CastIterator.castItemToType( ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue), diff --git a/src/main/java/org/rumbledb/items/xml/CommentItem.java b/src/main/java/org/rumbledb/items/xml/CommentItem.java index becbbee5f6..bead9f0540 100644 --- a/src/main/java/org/rumbledb/items/xml/CommentItem.java +++ b/src/main/java/org/rumbledb/items/xml/CommentItem.java @@ -102,7 +102,7 @@ public String getStringValue() { } @Override - public List atomizedValue() { + public List typedValue() { return Collections.singletonList(ItemFactory.getInstance().createStringItem(this.content)); } diff --git a/src/main/java/org/rumbledb/items/xml/DocumentItem.java b/src/main/java/org/rumbledb/items/xml/DocumentItem.java index aeffaba0c5..0fb6ee1f84 100644 --- a/src/main/java/org/rumbledb/items/xml/DocumentItem.java +++ b/src/main/java/org/rumbledb/items/xml/DocumentItem.java @@ -254,11 +254,14 @@ public List typeName() { * For a Document Node, dm:typed-value returns the typed value of the document node as a * sequence of zero or more atomic values. * - * This implementation delegates to atomizedValue(). + * This implementation delegates to the typed value of the document element. */ @Override public List typedValue() { - return this.atomizedValue(); + if (this.documentElement != null) { + return this.documentElement.typedValue(); + } + return Collections.singletonList(ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue)); } /** @@ -299,14 +302,6 @@ public int hashCode() { return this.documentPos.hashCode(); } - @Override - public List atomizedValue() { - if (this.documentElement != null) { - return this.documentElement.typedValue(); - } - return Collections.singletonList(ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue)); - } - @Override public List namespaceNodes() { return Collections.emptyList(); diff --git a/src/main/java/org/rumbledb/items/xml/ElementItem.java b/src/main/java/org/rumbledb/items/xml/ElementItem.java index ab9f1c4362..cfeba71f60 100644 --- a/src/main/java/org/rumbledb/items/xml/ElementItem.java +++ b/src/main/java/org/rumbledb/items/xml/ElementItem.java @@ -369,13 +369,26 @@ public List typeName() { * "For an Element Node, dm:typed-value returns the typed value of the element node as a * sequence of zero or more atomic values." * - * This implementation delegates to atomizedValue(), which currently computes a - * best-effort typed value by concatenating the atomized values of the element's - * children in document order. + * This implementation computes a best-effort typed value from the element's string value + * and optional type annotation. */ @Override public List typedValue() { - return this.atomizedValue(); + if (this.typeAnnotation != null) { + Item typedValue = CastIterator.castItemToType( + ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue), + this.typeAnnotation, + org.rumbledb.exceptions.ExceptionMetadata.EMPTY_METADATA + ); + return Collections.singletonList(typedValue); + } + // For untyped elements, atomization yields the element's typed value as xs:untypedAtomic. + // For element nodes, typed-value is based on the element's string value, which is the + // concatenation of descendant text nodes in document order and therefore excludes comment + // and processing-instruction content. + return Collections.singletonList( + ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue) + ); } @Override @@ -464,25 +477,6 @@ public int hashCode() { return this.documentPos.hashCode(); } - @Override - public List atomizedValue() { - if (this.typeAnnotation != null) { - Item typedValue = CastIterator.castItemToType( - ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue), - this.typeAnnotation, - org.rumbledb.exceptions.ExceptionMetadata.EMPTY_METADATA - ); - return Collections.singletonList(typedValue); - } - // For untyped elements, atomization yields the element's typed value as xs:untypedAtomic. - // For element nodes, typed-value is based on the element's string value, which is the - // concatenation of descendant text nodes in document order and therefore excludes comment - // and processing-instruction content. - return Collections.singletonList( - ItemFactory.getInstance().createUntypedAtomicItem(this.stringValue) - ); - } - @Override public boolean getEffectiveBooleanValue() { return true; diff --git a/src/main/java/org/rumbledb/items/xml/NamespaceItem.java b/src/main/java/org/rumbledb/items/xml/NamespaceItem.java index 23115b4c6e..18424dce0b 100644 --- a/src/main/java/org/rumbledb/items/xml/NamespaceItem.java +++ b/src/main/java/org/rumbledb/items/xml/NamespaceItem.java @@ -145,7 +145,7 @@ public int hashCode() { } @Override - public List atomizedValue() { + public List typedValue() { // Spec: "dm: typed-value Returns the value of the uri property as an xs:string ." return Collections.singletonList(ItemFactory.getInstance().createStringItem(this.uri)); } diff --git a/src/main/java/org/rumbledb/items/xml/ProcessingInstructionItem.java b/src/main/java/org/rumbledb/items/xml/ProcessingInstructionItem.java index 701cc75660..29df258469 100644 --- a/src/main/java/org/rumbledb/items/xml/ProcessingInstructionItem.java +++ b/src/main/java/org/rumbledb/items/xml/ProcessingInstructionItem.java @@ -97,7 +97,7 @@ public boolean isProcessingInstructionNode() { } @Override - public List atomizedValue() { + public List typedValue() { return Collections.singletonList(ItemFactory.getInstance().createStringItem(this.content)); } diff --git a/src/main/java/org/rumbledb/items/xml/TextItem.java b/src/main/java/org/rumbledb/items/xml/TextItem.java index 468dd814c6..5c05f3626a 100644 --- a/src/main/java/org/rumbledb/items/xml/TextItem.java +++ b/src/main/java/org/rumbledb/items/xml/TextItem.java @@ -152,7 +152,7 @@ public List children() { } @Override - public List atomizedValue() { + public List typedValue() { return Collections.singletonList(ItemFactory.getInstance().createUntypedAtomicItem(this.content)); } diff --git a/src/main/java/org/rumbledb/runtime/flwor/clauses/GroupByClauseIterator.java b/src/main/java/org/rumbledb/runtime/flwor/clauses/GroupByClauseIterator.java index 35dd2c038d..7ef76c165c 100644 --- a/src/main/java/org/rumbledb/runtime/flwor/clauses/GroupByClauseIterator.java +++ b/src/main/java/org/rumbledb/runtime/flwor/clauses/GroupByClauseIterator.java @@ -217,7 +217,7 @@ private HashMap> mapTuplesToPairs() { .getLocalVariableValue(groupVariableName, getMetadata()); List atomizedGroupValues = new ArrayList<>(); for (Item groupVariableValue : groupVariableValues) { - atomizedGroupValues.addAll(groupVariableValue.atomizedValue()); + atomizedGroupValues.addAll(groupVariableValue.typedValue()); } if (atomizedGroupValues.size() > 1) { throw new UnexpectedTypeException( diff --git a/src/main/java/org/rumbledb/runtime/functions/arrays/ArraySortFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/arrays/ArraySortFunctionIterator.java index 6890707586..33515a8218 100644 --- a/src/main/java/org/rumbledb/runtime/functions/arrays/ArraySortFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/arrays/ArraySortFunctionIterator.java @@ -232,7 +232,7 @@ private void fnDataAppend(Item item, List out) { if (item.isFunction()) { throw new CannotAtomizeException("The sequence cannot be atomized.", getMetadata()); } - out.addAll(item.atomizedValue()); + out.addAll(item.typedValue()); } private List invokeKeyFunction( diff --git a/src/main/java/org/rumbledb/runtime/functions/maps/MapFunctionCallIterator.java b/src/main/java/org/rumbledb/runtime/functions/maps/MapFunctionCallIterator.java index a4a28b4a39..ac66c3b241 100644 --- a/src/main/java/org/rumbledb/runtime/functions/maps/MapFunctionCallIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/maps/MapFunctionCallIterator.java @@ -79,7 +79,7 @@ private void initializeResults(DynamicContext context) { this.keyIterator.materialize(context, rawKey); List atomized = new ArrayList<>(); for (Item it : rawKey) { - atomized.addAll(it.atomizedValue()); + atomized.addAll(it.typedValue()); } if (atomized.size() != 1 || !atomized.get(0).isAtomic()) { throw new UnexpectedTypeException( diff --git a/src/main/java/org/rumbledb/runtime/functions/maps/MapGetFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/maps/MapGetFunctionIterator.java index 28c8ade904..ad8362cefe 100644 --- a/src/main/java/org/rumbledb/runtime/functions/maps/MapGetFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/maps/MapGetFunctionIterator.java @@ -84,7 +84,7 @@ private void initializeResults(DynamicContext context) { List atomized = new ArrayList<>(); for (Item it : rawKey) { - atomized.addAll(it.atomizedValue()); + atomized.addAll(it.typedValue()); } if (atomized.size() != 1 || !atomized.get(0).isAtomic()) { @@ -146,4 +146,3 @@ public JSoundDataFrame getDataFrame(DynamicContext dynamicContext) { throw new OurBadException("map:get is currently supported only in local execution mode."); } } - diff --git a/src/main/java/org/rumbledb/runtime/functions/maps/MapPutFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/maps/MapPutFunctionIterator.java index 869539c73f..01c367aaca 100644 --- a/src/main/java/org/rumbledb/runtime/functions/maps/MapPutFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/maps/MapPutFunctionIterator.java @@ -74,7 +74,7 @@ public Item materializeFirstItemOrNull(DynamicContext context) { List atomized = new ArrayList<>(); for (Item it : rawKey) { - atomized.addAll(it.atomizedValue()); + atomized.addAll(it.typedValue()); } if (atomized.size() != 1 || !atomized.get(0).isAtomic()) { @@ -126,4 +126,3 @@ public Item materializeFirstItemOrNull(DynamicContext context) { } } } - diff --git a/src/main/java/org/rumbledb/runtime/functions/maps/MapRemoveFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/maps/MapRemoveFunctionIterator.java index 353dc556a0..808e93cf45 100644 --- a/src/main/java/org/rumbledb/runtime/functions/maps/MapRemoveFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/maps/MapRemoveFunctionIterator.java @@ -87,7 +87,7 @@ private void initializeResult(DynamicContext context) { List keysToRemove = new ArrayList<>(); for (Item it : rawKeys) { - List atomized = it.atomizedValue(); + List atomized = it.typedValue(); for (Item a : atomized) { if (a == null || !a.isAtomic()) { throw new UnexpectedTypeException( diff --git a/src/main/java/org/rumbledb/runtime/functions/sequences/general/AtomizationClosure.java b/src/main/java/org/rumbledb/runtime/functions/sequences/general/AtomizationClosure.java index aea2d16318..9af54f3658 100644 --- a/src/main/java/org/rumbledb/runtime/functions/sequences/general/AtomizationClosure.java +++ b/src/main/java/org/rumbledb/runtime/functions/sequences/general/AtomizationClosure.java @@ -16,6 +16,6 @@ public AtomizationClosure() { @Override public Iterator call(Item arg0) throws Exception { - return arg0.atomizedValue().iterator(); + return arg0.typedValue().iterator(); } }; diff --git a/src/main/java/org/rumbledb/runtime/functions/sequences/general/DataFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/sequences/general/DataFunctionIterator.java index 13693f8a9c..4f8086ec6c 100644 --- a/src/main/java/org/rumbledb/runtime/functions/sequences/general/DataFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/sequences/general/DataFunctionIterator.java @@ -118,7 +118,7 @@ public void setNextResult() { return; } try { - this.nextResults = this.sequenceIterator.next().atomizedValue(); + this.nextResults = this.sequenceIterator.next().typedValue(); if (this.nextResults.isEmpty()) { this.hasNext = false; } else { @@ -137,7 +137,7 @@ public void setNextResult() { if (items.size() != 1) { throw new OurBadException("The context item is not a singleton.", getMetadata()); } - this.nextResults = items.get(0).atomizedValue(); + this.nextResults = items.get(0).typedValue(); if (this.nextResults.isEmpty()) { this.hasNext = false; } else { diff --git a/src/main/java/org/rumbledb/runtime/functions/sequences/general/SortFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/sequences/general/SortFunctionIterator.java index 1dcd03c83f..0107783ac4 100644 --- a/src/main/java/org/rumbledb/runtime/functions/sequences/general/SortFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/sequences/general/SortFunctionIterator.java @@ -169,7 +169,7 @@ private void fnDataAppend(Item item, List out) { if (item.isObject() || item.isFunction()) { throw new CannotAtomizeException("The sequence cannot be atomized.", getMetadata()); } - out.addAll(item.atomizedValue()); + out.addAll(item.typedValue()); } private List invokeKeyFunction( diff --git a/src/main/java/org/rumbledb/runtime/functions/sequences/value/DeepEqualFunctionIterator.java b/src/main/java/org/rumbledb/runtime/functions/sequences/value/DeepEqualFunctionIterator.java index 312e189e5b..d05c9363c6 100644 --- a/src/main/java/org/rumbledb/runtime/functions/sequences/value/DeepEqualFunctionIterator.java +++ b/src/main/java/org/rumbledb/runtime/functions/sequences/value/DeepEqualFunctionIterator.java @@ -341,7 +341,7 @@ private boolean checkAttributeNodesDeepEqual(Item attr1, Item attr2) { // 4b: The typed value of $i1 is deep-equal to the typed value of $i2. // Note: we do not support type annotations on attribute nodes yet. // For now, the typed value of the attribute node is the same as its string value - return checkDeepEqual(attr1.atomizedValue(), attr2.atomizedValue()); + return checkDeepEqual(attr1.typedValue(), attr2.typedValue()); } /** diff --git a/src/main/java/org/rumbledb/runtime/primary/MapConstructorRuntimeIterator.java b/src/main/java/org/rumbledb/runtime/primary/MapConstructorRuntimeIterator.java index 41e55d5780..0a358515e4 100644 --- a/src/main/java/org/rumbledb/runtime/primary/MapConstructorRuntimeIterator.java +++ b/src/main/java/org/rumbledb/runtime/primary/MapConstructorRuntimeIterator.java @@ -64,7 +64,7 @@ private static Item atomizeSingleMapKey( keyIterator.materialize(dynamicContext, keySequence); List atomized = new ArrayList<>(); for (Item item : keySequence) { - atomized.addAll(item.atomizedValue()); + atomized.addAll(item.typedValue()); } if (atomized.size() != 1) { throw new UnexpectedTypeException( diff --git a/src/main/java/org/rumbledb/runtime/typing/CastIterator.java b/src/main/java/org/rumbledb/runtime/typing/CastIterator.java index 85fb737b09..0e9693abdb 100644 --- a/src/main/java/org/rumbledb/runtime/typing/CastIterator.java +++ b/src/main/java/org/rumbledb/runtime/typing/CastIterator.java @@ -146,7 +146,7 @@ public static Item castItemToType( // first we try to atomize if item is not atomic if (!item.isAtomic()) { try { - List atomized = item.atomizedValue(); + List atomized = item.typedValue(); if (atomized.size() > 1) { throw new UnexpectedTypeException( "Atomization in cast resulted in more than one item.", diff --git a/src/main/java/org/rumbledb/runtime/xml/PostfixLookupClosure.java b/src/main/java/org/rumbledb/runtime/xml/PostfixLookupClosure.java index 28d2038d9c..aae6c6da6c 100644 --- a/src/main/java/org/rumbledb/runtime/xml/PostfixLookupClosure.java +++ b/src/main/java/org/rumbledb/runtime/xml/PostfixLookupClosure.java @@ -66,7 +66,7 @@ public Iterator call(Item arg0) throws Exception { } } else { for (Item rawKey : this.keys) { - List atomized = rawKey.atomizedValue(); + List atomized = rawKey.typedValue(); if (atomized.size() != 1 || !atomized.get(0).isAtomic()) { throw new UnexpectedTypeException( "Map lookup key must atomize to a single atomic value [err:XPTY0004].", diff --git a/src/main/java/org/rumbledb/runtime/xml/PostfixLookupIterator.java b/src/main/java/org/rumbledb/runtime/xml/PostfixLookupIterator.java index 064c7913e9..4eec36f447 100644 --- a/src/main/java/org/rumbledb/runtime/xml/PostfixLookupIterator.java +++ b/src/main/java/org/rumbledb/runtime/xml/PostfixLookupIterator.java @@ -117,7 +117,7 @@ public void setNextResult() { } } else { for (Item rawKey : this.lookupKeys) { - List atomized = rawKey.atomizedValue(); + List atomized = rawKey.typedValue(); if (atomized.size() != 1 || !atomized.get(0).isAtomic()) { throw new UnexpectedTypeException( "Map lookup key must atomize to a single atomic value [err:XPTY0004].", diff --git a/src/main/java/org/rumbledb/runtime/xml/UnaryLookupIterator.java b/src/main/java/org/rumbledb/runtime/xml/UnaryLookupIterator.java index b0d9c98019..f5b4c72d79 100644 --- a/src/main/java/org/rumbledb/runtime/xml/UnaryLookupIterator.java +++ b/src/main/java/org/rumbledb/runtime/xml/UnaryLookupIterator.java @@ -84,7 +84,7 @@ public void open(DynamicContext context) { } else { for (Item rawKey : this.lookupKeys) { - List atomized = rawKey.atomizedValue(); + List atomized = rawKey.typedValue(); if (atomized.size() != 1 || !atomized.get(0).isAtomic()) { throw new UnexpectedTypeException( "Map lookup key must atomize to a single atomic value [err:XPTY0004].",