Database API
This web site offers an application programming interface (API) which can be used to retrieve data programmatically with other programs for further processing. The API is based on PostgREST and documented in detail here.
Basic usage
The API can be accessed over HTTPS and the basic structure of the URL is
https://cycluster.mpim-bonn.mpg.de/api/<table>?select=<field list>&<filter>
The only table available so far is operators, the list of Calabi-Yau operators (AESZ). The select part determines the columns to be shown in the output, the filter can be a combination of column names and conditions to narrow the set of displayed results.
When you search the AESZ table using the online form you can see (and copy) the corresponding API URL with filter at the foot of the results table.
Without the select part, all details about an operator are returned. Without the filter, all operators are returned.
For instance, https://cycluster.mpim-bonn.mpg.de/api/operators?nn=eq.4.3.1 returns all details about the operator with new number 4.3.1.
The query https://cycluster.mpim-bonn.mpg.de/api/operators?select=nn,operator_tex°theta=eq.2 lists new number and operator TeX of all operators with \theta-degree=2.
With curl in the terminal
A convenient way to access the API from a terminal and to store data locally to files, is using the curl download tool and optionally the jq JSON processor.
For instance, retrieve all details for the operator with new number 4.3.1 and save to a file:
curl 'https://cycluster.mpim-bonn.mpg.de/api/operators?nn=eq.4.3.1' \
| jq > op-4-3-1.jsonHere jq will only pretty print the JSON data, but it could also be used for complicated filtering, processing and rewriting of the data.
With Python
In Python the requests library offers a simple way to retrieve JSON data, which can be processed with sympy:
import requests
import sympy
json = (requests
.get("https://cycluster.mpim-bonn.mpg.de/api/operators?nn=eq.4.3.1")
.json()[0])
z, theta, x = sympy.symbols("z theta X")
op = sum([ z**i * sympy.parse_expr(p, transformations='all')
for i, p in enumerate(json['pols_list']) ])
print(op.subs(x,theta))
With Pari/GP
Pari cannot connect to web APIs directly, but we can call curl and jq as external programs. For instance, we can load the coefficients of the mirror map z(q) for operator 4.3.1 with:
zq = eval(externstr( \
"curl -s 'https://cycluster.mpim-bonn.mpg.de/api/operators?nn=eq.4.3.1' | " \
"jq -r '.[0].zq_list | \"[\" + join(\", \") + \"]\"' ")[1])Here jq is used to transform JSON data into a Pari compatible string that can be evaluated.
With Mathematica
In a Mathematica notebook run
operator = Association @
Import["https://cycluster.mpim-bonn.mpg.de/api/operators?nn=eq.4.3.1"];
L = Total[MapIndexed[z^(#2[[1]] - 1)*#1 &,
ToExpression[operator["pols_list"]]]] /. X -> \[Theta]
instantons = ToExpression /@ operator["inst_list"]to get a specific CY operator L. Other data can be accessed from the corresponding keyword, e.g., the list of instanton numbers.
Swagger Interface
You can explore the API and all tables and columns using the Swagger User Interface: