Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for SMARTS filter language (filter_smarts) #398

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,10 @@ Or, fully URL encoded :

- :query-url:`http://example.org/optimade/v1/structures?filter=_exmpl_melting_point%3C300+AND+nelements%3D4+AND+chemical_formula_descriptive%3D%22SiO2%22&response_format=xml`

Aside from the OPTIMADE filter language, OPTIMADE has provisions to support other filters, for example, external filter languages.
Supported filters are described below in `Other filters`_.
If more than one filter is used in the same query, for example, :query-param:`filter` and :query-param:`filter_sql`, all filters MUST be combined as logical conjunction AND.

Lexical Tokens
--------------

Expand Down Expand Up @@ -1786,6 +1790,21 @@ Optional filter features
Some features of the filtering language are marked OPTIONAL.
An implementation that encounters an OPTIONAL feature that it does not support MUST respond with error ``501 Not Implemented`` with an explanation of which OPTIONAL construct the error refers to.

Other filters
-------------

filter_smarts
~~~~~~~~~~~~~

`SMARTS <https://www.daylight.com/dayhtml/doc/theory/theory.smarts.html>`__ is a query language for matching subgraph patterns in molecules, introduced by Daylight.
When provided, URL parameter :query-param:`filter_smarts` MUST be understood as Daylight-conforming SMARTS query.
Providers may support this OPTIONAL filtering feature for entry types describing molecules, for example, :entry:`structures`.
Lack of support for :query-param:`filter_smarts` in an implementation MUST be reported with error ``501 Not Implemented``.

Example:

- :query-url:`http://example.org/optimade/v1/structures?filter_smarts=CaaO`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the example indeed filter_smarts=CaaO, or is it filter=smarts=CaaO? And what is 'CaaO' maybe it should be 'CaO'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is filter_smarts, and the example is supposed to be CaaO, as taken from Daylight's SMARTS examples.

Property Definitions
====================

Expand Down