The idea is that such Functions/arithmetic expressions can only be calcualted on-the-fly during the queries:
functions:
count(pbc) > 2
any(Z > 14)
date("19-02-03")
any(norm(forces, 2) > 3)
arithmetics:
energy/natoms > -2.0 which is equilaent to
energy > -2.0 * natoms where are proerties on both side
mixture:
sum(Z = 14 or Z=6) > natoms
Possible solution:
It is relatively easy to parse the query but is way more difficult to compile it into an eg.: mongo query. One possible solution is to precalculate and store them in some kind of cache for all the expressions. In this case, the reconstructed query itself contains regular terms only. (Note: the cache may need to be cleaned occasionally)
Another possible way is the usage of the exec command. A snippet of python code generates a new property which is directly queriable. This could be the return value of (multiple) simple or (few) complex expression.
Note: The first option could provide better performance if the precalculation can happen within the mongo framework (JAVA) but it takes huge development effort to implement it. If the precalculation part happens in Python the two methods have the same performance.
Decision: although the grammar still contains all the features, but their implementation will raise an error because right now there is a new alternative way to use complex queries (#79).
The idea is that such Functions/arithmetic expressions can only be calcualted on-the-fly during the queries:
functions:
count(pbc) > 2
any(Z > 14)
date("19-02-03")
any(norm(forces, 2) > 3)
arithmetics:
energy/natoms > -2.0
which is equilaent toenergy > -2.0 * natoms
where are proerties on both sidemixture:
sum(Z = 14 or Z=6) > natoms
Possible solution:
It is relatively easy to parse the query but is way more difficult to compile it into an eg.: mongo query. One possible solution is to precalculate and store them in some kind of cache for all the expressions. In this case, the reconstructed query itself contains regular terms only. (Note: the cache may need to be cleaned occasionally)
Another possible way is the usage of the
exec
command. A snippet of python code generates a new property which is directly queriable. This could be the return value of (multiple) simple or (few) complex expression.Note: The first option could provide better performance if the precalculation can happen within the mongo framework (JAVA) but it takes huge development effort to implement it. If the precalculation part happens in Python the two methods have the same performance.