We are building a enterprise application with ML as the back end DB. One of the requirements is to find distinct values of a particular element in XML across various documents.
Can I get the distinct entity_type using a structured query/combined query
All the below documents are part of entity collection:
Document 1
<xml>
<entities>
<entity_name>Imprezza</entity_name>
<entity_type>Car</entity_type>
<entity_color>Red</entity_color>
<entities>
<xml>
Document 2
<xml>
<entities>
<entity_name>Ducati</entity_name>
<entity_type>Bike</entity_type>
<entity_color>White</entity_color>
<entities>
<xml>
Document 3
<xml>
<entities>
<entity_name>Lancia</entity_name>
<entity_type>Car</entity_type>
<entity_color>Red</entity_color>
<entities>
<xml>
Document 4
<xml>
<entities>
<entity_name>Scania</entity_name>
<entity_type>Truck</entity_type>
<entity_color>Black</entity_color>
<entities>
<xml>
Requirement: Give me all distinct entity_type in the collection
Result: Car,Bike,Truck
P.S: Need to get the result in Java layer. We currently have an API which generates MarkLogic combined queries (Structured query + options query) based on input. Can I get the distinct entities using a structured query/combined query ??