Mergado 2: Element-Path

MERGADO 2: Element-Path

We are introducing Element-Path, a language completely created by MERGADO. It is designed for users to take full advantage of all the new features of MERGADO 2 in the rules and queries. Read how this innovation works

:woman_teacher: What is Element-Path

  • a language for specifying values ​​of product elements in MERGADO - path to an element or an attribute
  • it is used in rules and product queries
  • path to an element or element path (element-path) with lowercases denotes an expression written using the Element-Path language
  • the result of one path to an element can be multiple values, ​​and we can use it in rules for simple modification of multiple elements

:question: Differences between MERGADO and MERGADO 2

How the current version of MERGADO works:

  • the products are listed in a table
  • one line = one product
  • one column = one element
  • path to an element (element name) = query of one column in the table
  • MQL is then the query of specific rows in the table

How the new MERGADO 2 works:

  • products are lists of trees
  • one product = one tree from the list
  • one element value = one node in the tree
  • one element = set of nodes in the tree with the same element name
  • path to an element = a query of any number of nodes with the same element name
  • MQL = a query of specific trees from the list

Preview of differences between MERGADO vs. MERGADO 2.

:point_right: Example of using Element-Path on a sample product::

Product:

1. <ITEM id="1">
2. <NAME>Sample product</NAME>
3. <IMAGE>https://www.imgurl.cz/1/</IMAGE>
4. <IMAGE>https://www.imgurl.cz/2/</IMAGE>
5. <IMAGE>https://www.imgurl.cz/3/</IMAGE>
6. <PRICE>30 EUROS</PRICE>
7. <DESCRIPTION lang="en">
8. Suitable for demonstrating the correct use of Element-Path
9. </DESCRIPTION>
10. <DESCRIPTION lang="de">
11. Sample german language value.
12. </DESCRIPTION>
13. <PARAM>
14. <NAME>Color</NAME>
15. <VAL>black</VAL>
16. </PARAM>
17. <PARAM>
18. <NAME>Material</NAME>
19. <VAL>100% cotton</VAL>
20. </PARAM>
21 </ITEM>

:woman_technologist: Different paths to values of elements:

  • NAME: returns the value from line 2.
  • ID: returns the value from line 1.
  • IMAGE: returns values from lines 3., 4., 5.
  • IMAGE { @@POSITION = 2 }: returns the value from line 4.
  • IMAGE { @@POSITION = 4 }: returns nothing
  • DESCRIPTION { @lang = β€œen” }: returns the value from line 8.
  • DESCRIPTION | @lang: returns values from lines 7., 10.
  • PARAM { NAME = β€œColor” } | VAL: returns value from line 15.
  • PARAM { @@POSITION = 2 or NAME = β€œColor” } | VAL: returns values from lines 15., 19.
  • PARAM { VAL = β€œ100% cotton” } | VAL: returns the value from line 19.
  • PARAM | NAME: returns values from lines 14., 18.
  • PARAM | NAME { @@POSITION = 1 }: returns values from lines 14., 18.
  • PARAM | NAME { @@POSITION = 2 }: returns nothing

:clipboard: Element-Path specifics

  • you must wrap multi-word element names in square brackets:

[Engine capacity] = β€œ2 l”→ ! wrap only one element name at a time

  • a large number of elements in the query is undesirable

ID = 1 or ID = 2 or ID = 3 β†’ ID ~ β€œ^(1|2|3)$”

  • numerical constants are converted to a number β†’ problem with 0 at the beginning

ID = β€œ0021”

  • the non-existence of an element is tested using equality to an empty string
  • for multiple elements, it is sufficient that a single value satisfies the condition

Do you have any questions regarding Element-Path or MERGADO 2? Contact our support and follow this forum thread for the latest information.

1 Like