I'm currently implementing the functionality of Contains and ContainsAll -queries in SQL indexing, and I'm wondering a little about the semantics of these queris in more complex cases.

As long as collection property has depth of 1 (ie Property<Collection<X>> , where X is not collection), everything is simple and understandable. When we go to collections of depth of 2 (ie Property<Set<List<X>>> ) or more, things get a little complicated. What kind of arguments are legal and illegal for Contains -query in a nested collection property? More generally speaking, should we query for match in collection structure, or only match in leaf elements?

With a little examples: assuming we have a following Property: Property<List<Set<String>>> myProp() and there is an entity which has [["String1", "String2"]["String3", "String4"]] as value of that property.

1. Should the entity match for querying contains(myProp, ["String1", "String2", "String3", "String4"]) ? How about contains(myProp, [["String1"]["String2", "String3", "String4"]]) ? Both have same leaf items, however their structure is different. 2. Same goes for containsAll - should it match the collection structure? Or should only leaf items, disregard the ordering and structure, match?

Of course easiest to implement would be only leaf-item matching, without ordering and such. One might even argue that if a user wants to match collection structure, he/she should change the collections into value composites. What do you think?


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to