Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
7f1bd4e
feat(types): add missing atomic types, with empty facets
EPMatt Feb 24, 2026
d2f42f2
feat(types): add initial support for the whitespace facet
EPMatt Feb 24, 2026
fda6c9c
feat(types): v0 support of the pattern facet
EPMatt Feb 25, 2026
323a497
fix(types): yearMonthDuration and dayTimeDuration as derived atomic t…
EPMatt Feb 25, 2026
d307971
feat(types): add support for fundamental facets, separate constrainin…
EPMatt Feb 25, 2026
15ad88d
feat(types): define fundamental facets for atomic types
EPMatt Feb 27, 2026
4a44a25
feat(types): migrate numeric to union type
EPMatt Mar 3, 2026
9a7c199
feat(casting): add support for pattern facet check
EPMatt Mar 3, 2026
0df72fa
feat(types): add initial support for untypedatomic type and item
EPMatt Mar 3, 2026
ada13b2
feat(castIterator): add support for xs:untypedAtomic constructors
EPMatt Mar 3, 2026
0348983
fix(comparison): update comparison logic with support for untypedAtom…
EPMatt Mar 3, 2026
702424e
fix(types): correctly treat notation and anyAtomicType as never castable
EPMatt Mar 4, 2026
d937872
fix(castableiterator): fix compilation
EPMatt Mar 4, 2026
abaff6d
feat(comparison): implement normalization for xs:untypedAtomic in gen…
EPMatt Mar 4, 2026
0830be9
fix: define lexical space of primitive atomic types with lexical patt…
EPMatt Mar 9, 2026
b19abce
chore: spotless apply
EPMatt Mar 9, 2026
2ae6b49
feat(casting): define static castability between types as matrix lookup
EPMatt Mar 9, 2026
15c5bf3
fix(cast): correct usage of lexical patterns
EPMatt Mar 9, 2026
39eb9b5
fix(cast): correctly implement casting for derived types
EPMatt Mar 9, 2026
709a5b8
feat(cast): refactor casting to correctly address cross hierarchy cas…
EPMatt Mar 9, 2026
2d1b183
feat: introduce infrastructure for castingPrimitive types
EPMatt Mar 9, 2026
291e9b0
test: update tests
EPMatt Mar 11, 2026
e67fb00
fix(types): fix type error code for casting
EPMatt Mar 11, 2026
f159ba8
fix(types): fix types matrix
EPMatt Mar 11, 2026
6d48873
test: narrow type check in e2e tests
EPMatt Mar 11, 2026
3f595aa
chore: mvn spotless:apply
EPMatt Mar 11, 2026
b5846e9
chore: fix javadoc generation
EPMatt Mar 11, 2026
0a01808
fix(types): fix hex binary lexical pattern
EPMatt Mar 14, 2026
693dfe2
chore: mvn spotless apply
EPMatt Mar 14, 2026
eb01fee
feat(casting): rewrite casting logic to correctly check for facets in…
EPMatt Mar 14, 2026
9874594
chore: mvn spotless apply
EPMatt Mar 14, 2026
a1ee7d0
fix(castiterator): update casting logic to correctly cast xs:int subt…
EPMatt Mar 14, 2026
7b36130
fix(mlutils): fix casting type for integers
EPMatt Mar 14, 2026
18daac9
fix(cast): fix missing exception throwing
EPMatt Mar 14, 2026
5959dd5
fix(types): add missing representation of double
EPMatt Mar 15, 2026
5a6102d
fix(cast): correctly run conversion for derived atomic types
EPMatt Mar 15, 2026
aa76de0
fix(types): fix regex for xs:double
EPMatt Mar 15, 2026
31eeb1a
fix(annotateditem): add missing stub methods
EPMatt Mar 15, 2026
a47bb48
fix(validate): enhance lax validation logic for null values in Valida…
EPMatt Mar 15, 2026
10e03d5
chore: mvn spotless apply
EPMatt Mar 15, 2026
85a3e35
fix(tests): update sample data to match schema in test_jsoniq_pandas_…
EPMatt Mar 15, 2026
b1259b8
fix(validate): improve null value handling in lax mode for ValidateTy…
EPMatt Mar 15, 2026
0e4d77e
fix(cast): improve function call processing and type casting for buil…
EPMatt Mar 15, 2026
91d8d5e
fix(codepoints): enhance error handling for integer validation and co…
EPMatt Mar 15, 2026
e81f52a
fix(types): add regex pattern for positive infinity in BuiltinTypesCa…
EPMatt Mar 15, 2026
fc3a974
Merge branch 'master' into ma/xml-atomic-type-system
EPMatt Mar 16, 2026
d4008c6
fix(codepoints): incorporate XML version handling in codepoint valida…
EPMatt Mar 16, 2026
0af27b7
fix(codepoints): update XML version retrieval in CodepointsToStringFu…
EPMatt Mar 16, 2026
6eb6433
fix(cast): enhance casting logic for union types and improve error ha…
EPMatt Mar 16, 2026
524a680
chore: mvn spotless:apply
EPMatt Mar 16, 2026
5d463f8
refactor(codepoints): streamline control character validation logic i…
EPMatt Mar 16, 2026
62b8c16
feat(array): introduce new methods for handling logical member sequen…
EPMatt Mar 16, 2026
c3070db
feat(array): wire support for arrays with sequences as members
EPMatt Mar 16, 2026
7fb6004
trigger ci
EPMatt Mar 16, 2026
f5ca336
feat(array): add ArrayFunctionCallIterator to support dynamic functio…
EPMatt Mar 17, 2026
6c0dd9c
chore: mvn spotless:apply
EPMatt Mar 17, 2026
307b8cb
feat(functions): register array:size function
EPMatt Mar 17, 2026
7e7b1ea
feat(xquery): add v0 support for array tests
EPMatt Mar 17, 2026
78fb2aa
feat(functions): add support for array:get function
EPMatt Mar 17, 2026
0af6eea
feat(functions): add support for array:tail function
EPMatt Mar 17, 2026
aa3a193
feat(xquery): support item tests
EPMatt Mar 18, 2026
d49bdf8
feat(functions): add support for array:head function
EPMatt Mar 18, 2026
6c9bd51
feat(functions): add support for array:insert-before function
EPMatt Mar 18, 2026
fcb05c5
feat(functions): add support for array:reverse function
EPMatt Mar 18, 2026
00507de
feat(functions): add support for array:subarray function
EPMatt Mar 18, 2026
e4648d1
feat(functions): add support for array:subarray function
EPMatt Mar 18, 2026
45f2112
feat(functions): add support for array:fold-left function
EPMatt Mar 18, 2026
aae3b33
feat(functions): add v0 support for array:for-each function
EPMatt Mar 21, 2026
401b3e0
chore: mvn spotless:apply
EPMatt Mar 21, 2026
03fb57d
feat(api): implement allowsNonSingletons method for array items, swit…
EPMatt Mar 21, 2026
f76efc7
refactor(api): rename member sequence methods memberSequence -> sequ…
EPMatt Mar 21, 2026
002b177
feat(functions): add support for array:fold-right function
EPMatt Mar 21, 2026
e5f1029
feat(functions): add support for array:append function
EPMatt Mar 21, 2026
e6b2668
feat(functions): add support for array:flatten function
EPMatt Mar 21, 2026
955fde9
feat(functions): add support for array:remove function
EPMatt Mar 21, 2026
fc730a6
feat(functions): add v0 upport for array:filter function
EPMatt Mar 21, 2026
bda7ef1
feat(functions): add support for array:join function
EPMatt Mar 21, 2026
d995ccc
feat(functions): add support for array:sort function
EPMatt Mar 21, 2026
54c6314
feat(functions): add v0 support for array:for-each-pair function
EPMatt Mar 21, 2026
2650dda
feat(item): add v0 support for maps
EPMatt Mar 24, 2026
a6f9792
fix(maps): add missing getItemByKey to item api, update implementations
EPMatt Mar 24, 2026
8c7d1d7
feat: add support for generic item keys on postfix and unary map lookups
EPMatt Mar 24, 2026
652d531
chore: fix build and formatting
EPMatt Mar 24, 2026
6c9b251
feat: add support for map constructors, separate MapConstructorExpres…
EPMatt Mar 24, 2026
9bcb0b2
feat(items): spec-compliant implementation of op:same-key, add missin…
EPMatt Mar 24, 2026
7110189
feat(types): introduce lazy caching for sequence type map
EPMatt Mar 25, 2026
aac09ca
feat(types): add v0 support for map item types
EPMatt Mar 25, 2026
b91d6e2
chore: mvn spotless:apply
EPMatt Mar 25, 2026
82ef5d0
feat: add support for map:get function
EPMatt Mar 25, 2026
9bc0621
feat: add support for map:keys function
EPMatt Mar 25, 2026
a5b73e0
feat: add support for map:entry function
EPMatt Mar 25, 2026
59e0680
feat: add support for map:size function
EPMatt Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions src/main/java/org/rumbledb/api/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ default boolean isObject() {
return false;
}

/**
* Tests whether the item is an XDM map (not a JSON object).
*
* @return true if it is a map, false otherwise.
*/
default boolean isMap() {
return false;
}

/**
* Tests whether the item is a function.
*
Expand Down Expand Up @@ -87,6 +96,15 @@ default boolean isString() {
return false;
}

/**
* Tests whether the item is an atomic item of type xs:untypedAtomic.
*
* @return true if it is an atomic item of type xs:untypedAtomic, false otherwise.
*/
default boolean isUntypedAtomic() {
return false;
}

/**
* Tests whether the item is an atomic item of type default boolean.
*
Expand Down Expand Up @@ -457,6 +475,21 @@ default boolean isNode() {
return false;
}

/**
* Whether this array item's runtime representation allows non-singleton member sequences.
* <p>
* For arrays: {@code false} means each member is stored as a single {@link Item} (singleton
* members); {@code true} means members may be arbitrary sequences.
* <p>
* Defined only for array items; other item kinds throw.
*
* @return {@code true} if non-singleton members are supported, {@code false} if members are
* singleton-only in the representation
*/
default boolean allowsNonSingletons() {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the members of the item if it is an array.
*
Expand All @@ -466,6 +499,22 @@ default List<Item> getItems() {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the logical member sequences of the item if it is an array or a map.
* <p>
* Each array or map member is represented as a sequence of items. For arrays or maps whose members are
* all singletons, each member sequence is of length 1.
* <p>
* Implementations that only support singleton members may return a singleton sequence per member.
* <p>
* For maps, the sequences are the value sequences associated with the keys.
*
* @return the list of member sequences (one sequence per array member).
*/
default List<List<Item>> getSequences() {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the member of the item at the specified position if it is an array.
*
Expand All @@ -476,6 +525,18 @@ default Item getItemAt(int position) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the logical member sequence at the specified position if it is an array.
* <p>
* The position is zero-based, consistent with {@link #getItemAt(int)}.
*
* @param position a zero-based member position.
* @return the sequence of items corresponding to that member.
*/
default List<Item> getSequenceAt(int position) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the keys of the item, if it is an object.
*
Expand Down Expand Up @@ -504,6 +565,45 @@ default Item getItemByKey(String key) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the value associated with a specific key, if it is an object.
*
* @param key a key item.
* @return the value associated with key.
*/
default Item getItemByKey(Item key) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the (possibly non-string) atomic keys of the item, if it is a map-like object.
*
* @return the list of atomic keys as items.
*/
default List<Item> getItemKeys() {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the value sequence associated with a key, if it is a map-like object.
*
* @param key an atomic key item.
* @return the value sequence for the key, or null if absent.
*/
default List<Item> getSequenceByKey(Item key) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the value sequence associated with a string key, if it is a map-like object.
*
* @param key a string key.
* @return the value sequence for the key, or null if absent.
*/
default List<Item> getSequenceByKey(String key) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Returns the size of the item, if it is an array.
*
Expand Down Expand Up @@ -746,6 +846,18 @@ default void putItem(Item item) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Appends a logical member sequence, if it is an array.
* <p>
* For arrays whose members are all singletons, this is equivalent to {@link #putItem(Item)}
* when the sequence contains exactly one item.
*
* @param items the member sequence to append as a single array member.
*/
default void appendSequence(List<Item> items) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Add an item at index i, if it is an array.
*
Expand All @@ -756,6 +868,19 @@ default void putItemAt(Item item, int i) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Replace the logical member at index i with the supplied member sequence, if it is an array.
* <p>
* For arrays whose members are all singletons, callers should prefer {@link #putItemAt(Item, int)}
* when possible.
*
* @param items the member sequence to store at the given position.
* @param i a zero-based member index.
*/
default void putSequenceAt(List<Item> items, int i) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Add all items in items at index i, if it is an array.
*
Expand Down Expand Up @@ -794,6 +919,26 @@ default void putItemByKey(String key, Item value) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Adds a key-value pair, if it is a map-like object.
*
* @param key an atomic key.
* @param value a value.
*/
default void putItemByKey(Item key, Item value) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Adds a key-sequence pair, if it is a map-like object.
*
* @param key an atomic key.
* @param valueSequence a value sequence.
*/
default void putSequenceByKey(Item key, List<Item> valueSequence) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Removes a key-value pair, if it is an object item.
*
Expand All @@ -803,6 +948,15 @@ default void removeItemByKey(String key) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Removes a key-value pair, if it is a map-like object.
*
* @param key an atomic key.
*/
default void removeItemByKey(Item key) {
throw new UnsupportedOperationException("Operation not defined for type " + this.getDynamicType());
}

/**
* Adds a key-value pair, if it is an object item. The value is lazily computed.
*
Expand Down
41 changes: 35 additions & 6 deletions src/main/java/org/rumbledb/compiler/CloneVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.rumbledb.expressions.primary.IntegerLiteralExpression;
import org.rumbledb.expressions.primary.NamedFunctionReferenceExpression;
import org.rumbledb.expressions.primary.NullLiteralExpression;
import org.rumbledb.expressions.primary.MapConstructorExpression;
import org.rumbledb.expressions.primary.ObjectConstructorExpression;
import org.rumbledb.expressions.primary.StringLiteralExpression;
import org.rumbledb.expressions.primary.VariableReferenceExpression;
Expand Down Expand Up @@ -421,12 +422,23 @@ public Node visitDynamicFunctionCallExpression(DynamicFunctionCallExpression exp

// region primary
public Node visitArrayConstructor(ArrayConstructorExpression expression, Node argument) {
ArrayConstructorExpression result = new ArrayConstructorExpression(
(expression.getExpression() == null)
? expression.getExpression()
: (Expression) visit(expression.getExpression(), argument),
expression.getMetadata()
);
ArrayConstructorExpression result;
if (expression.isSquareConstructor()) {
List<Expression> clonedMembers = new java.util.ArrayList<>();
if (expression.getMemberExpressions() != null) {
for (Expression memberExpr : expression.getMemberExpressions()) {
clonedMembers.add((Expression) visit(memberExpr, argument));
}
}
result = new ArrayConstructorExpression(clonedMembers, true, expression.getMetadata());
} else {
result = new ArrayConstructorExpression(
(expression.getExpression() == null)
? expression.getExpression()
: (Expression) visit(expression.getExpression(), argument),
expression.getMetadata()
);
}
result.setStaticSequenceType(expression.getStaticSequenceType());
result.setStaticContext(expression.getStaticContext());
return result;
Expand Down Expand Up @@ -458,6 +470,22 @@ public Node visitObjectConstructor(ObjectConstructorExpression expression, Node
}
}

@Override
public Node visitMapConstructor(MapConstructorExpression expression, Node argument) {
List<Expression> keys = expression.getKeys()
.stream()
.map(key -> (Expression) visit(key, argument))
.collect(Collectors.toList());
List<Expression> values = expression.getValues()
.stream()
.map(value -> (Expression) visit(value, argument))
.collect(Collectors.toList());
Expression result = new MapConstructorExpression(keys, values, expression.getMetadata());
result.setStaticContext(expression.getStaticContext());
result.setStaticSequenceType(expression.getStaticSequenceType());
return result;
}

@Override
public Node visitDirElemConstructor(DirElemConstructorExpression expression, Node argument) {
List<Expression> content = expression.getContent()
Expand Down Expand Up @@ -892,6 +920,7 @@ public Node visitComparisonExpr(ComparisonExpression expression, Node argument)
expression.getComparisonOperator(),
expression.getMetadata()
);
result.setOriginalComparisonOperator(expression.getOriginalComparisonOperator());
result.setStaticSequenceType(expression.getStaticSequenceType());
result.setStaticContext(expression.getStaticContext());
return result;
Expand Down
Loading
Loading