[Cod-bugs] Authors matching in Optimade API
Andrius Merkys
andrius.merkys at gmail.com
Tue Nov 18 09:49:40 EET 2025
Dear Mehmet,
On 2025-11-17 17:03, Mehmet Giritli - STFC UKRI wrote:
> We are looking forward to have exact matches in COD. Thank you so much!
Great - we will look into implementing these queries to the letter of
the specification.
> Regarding "HAS CONTAINS", this does not seem to work with the Lark
> validator we have. In our system, we use a query validator to check for
> valid optimade filters. This is done by the Lark language interpreter
> which the optimade library uses. It gives an error when this combination
> is used. Here is an example:
>
>
> Unable to parse filter ( _psdi_authors HAS CONTAINS " Day " ). Lark
> traceback:
> No terminal matches 'C' in the current parser context, at line 1 col 21
>
> ( _psdi_authors HAS CONTAINS " Day " )
> ^
> Expected one of:
> * SIGNED_INT
> * OPERATOR
> * FALSE
> * SIGNED_FLOAT
> * ESCAPED_STRING
> * TRUE
> * ALL
> * IDENTIFIER
> * ANY
> * ONLY
>
> May I ask you, whenever you get around to it, to double check with
> Optimade spec if this is allowed please? Unless it is a legal Optimade
> query, we will not be able to use it. Moreover, Matthew Evans has done a
> private API for us and CONTAINS operator in the way I showed above is
> how we use it (e.g., author.names CONTAINS "..."). I might be wrong, but
> may be the "authors" is the list here and "authors.name" is actually a
> string? I think Mattew Evans is the best person to answer that, I
> haven't looked to the Optimade spec for a while now 🙂
Queries like 'HAS CONTAINS' were only made possible since the OPTIMADE
specification release v1.2.0 last year
(https://github.com/Materials-Consortia/OPTIMADE/pull/415). Prior to
v1.2.0 they were not supported. I have a hunch that Lark grammar has not
been updated since v1.2.0. We may pull Matthew to the discussion to
check the status of the grammar.
Best wishes,
Andrius
--
Andrius Merkys
Vilnius University Institute of Biotechnology, Saulėtekio al. 7
LT-10257 Vilnius, Lithuania
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Cod-bugs
mailing list