The PolyDB REST API (version 0.2)

Download OpenAPI specification:Download

Introduction

This is the REST Api of the PolyDB database for data in Discrete Geometry and related areas such as Combinatorial Algebra, Graph Theory and Discrete Mathematics.

Development of this API is still ongoing. Not all errors are properly propagated yet and some endpoints may change. Please check this page for changes to the endpoints.

Usage

Queries

All queries for data must follow the MongoDB specification and must be given as JSON. Some examples are

{ "DIM" : 5 }

or

{ "N_VERTICES" : {"$gt" : 7}, "N_FACETS": 10 }

Search modifiers

Most queries for data accept the following modifiers:

  • skip=N: skip the first N results (that match the query)
  • limit=N: only return the first N results (that match the query, counting from the position gven by skip)

Queries for Documentation accept the following modifiers:

  • short: only return the short description of a section or collection
  • recursive: recursively list all subsections below a section

Responses

All responses follow the content type application/json, and are serialized with JSON and encoded in UTF-8.

JSON Data Response format

A single returned data response contains the following required parameters beside the actual data:

  • _ns: A namespace defining how to interpret the data (e.g. "polymake")
  • _polyDB: contains the following information:
    • template_key: The key for the JSON schema used to validate the data, usually there is only one per collection
    • collection: The name of the collection the data came from
    • section: The section of the collection
    • creation_date: The creation date
    • uri: A uri for the software package used to create the object
  • The actual data as defined by the schema and the computer algebra system used to create the object

Authentication

Currently only the public collections can be accessed with this API, and no authentication is required. This will liekly change in future versions of the API. So please check back regularly.

Modifying Objects and Creating new Collections

Modifying data and adding collections is not yet implemented via this API. Pleas use one of the computer algebra systems with full interfaces or contact us. We will be happy to integrate the data into the PolyDB and set the documention with the information and references you provide.

Citation

If you use this API and data from polyDB in your work please cite

  • for the data: the appropriate references for the collection as given in the documentation of the collection. You can find this information at polydb.org or in the document returned by collection/.
  • for polyDB:

    Paffenholz, A., polyDB: A Database for Polytopes and Related Objects.

    In: Böckle, G., Decker, W., Malle, G. (eds), Algorithmic and Experimental Methods in Algebra, Geometry, and Number Theory.

    Springer, Cham., 2017

    DOI: 10.1007/978-3-319-70566-8-23, arxiv:1711.02936

Other Software Packages with access to the PolyDB database

The computer algebra systems polymake and oscar provide an interface to polyDB.


The API endpoints

Sections

Sections are used to organize the data in polyDB into groups of collections of objects from the same area of mathematics. Currently the main categories are

  • Polytopes for objects from discrete and combinatorial geometry
  • Matroids for collections of matroids
  • Manifolds for collections of objects from combinatorial topology and triangulations, in particular simplicial complexes
  • Tropical for collections of objects in tropical geometry

Sections can be nested for a finer distinction. All queries use fully qualified section names starting at the root section. The names are connected with dots. So the subsection Lattice for collections of lattice polytopes can be accessed with

Polytopes.Lattice

Endpoints that return information on available sections are

  • section/ for information on the objects contained in this section and a list of collections on this leve
  • sections/ for a list of collections and subsections in a section

Information about a Section

This endpoint returns information about a single section in the polyDB.

path Parameters
section
required
string
Example: Polytopes

the section name

query Parameters
recursive
boolean
Example: recursive=false

whether we should recursively list subsections

short
boolean
Example: short=false

whether to return a short description

Responses

Request samples

http GET 'https://polydb.org/rest/current/section/Polytopes?recursive=false&short=false'

Response samples

Content type
application/json
{
  • "description": "A collection of families of polytopes",
  • "subsections": [
    ],
  • "collections": [
    ]
}

List subsections of a section

This endpoint returns a list of all subsections of a section

path Parameters
section
required
string
Example: Polytopes

the name of the section

query Parameters
recursive
boolean
Example: recursive=true

whether we should recursively list subsections

Responses

Request samples

http GET 'https://polydb.org/rest/current/sections/Polytopes?recursive=true'

Response samples

Content type
application/json
[
  • "Polytopes.Combinatorial",
  • "Polytopes.Geometric",
  • "Polytopes.Lattice"
]

Collections

Collections in polyDB contain the actual families of mathematical objects, e.g. the list of all reflexive lattice polytopes in dimension 4. All objects in a collections satisfy the same JSON schema for the list of their properties.

You can obtain information on the available collections and on the objects in a specific collection with the following endpoints:

  • collections/ returns a list of all collections contained in a section of polyDB.
  • collection/ returns a description of the objects in a collection, information about the authors of the data, the contributors and maintainers, references into the literature about the objects, and links to the original sources for the data. You should check this to obtain the correct citation if you use the data.

Information for a single collection

This endpoint returns a description of the data in the collection, the authors of the data, its contributors and maintainers, references to relevant literature, and links to the original source of the data.

path Parameters
collection
required
string
Example: Polytopes.Combinatorial.01Polytopes

the fully qualified name of the collection

Responses

Request samples

http GET https://polydb.org/rest/current/collection/Polytopes.Combinatorial.01Polytopes

Response samples

Content type
application/json
{
  • "description": "0/1-Polytopes up to lattice equivalence",
  • "author": [
    ],
  • "maintainer": [
    ],
  • "contributor": [
    ],
  • "references": []
}

List collections in a section

This endpoint returns a list of all subsections of a section

path Parameters
section
required
string
Example: Polytopes.Lattice

the fully qualified name of the section

Responses

Request samples

http GET https://polydb.org/rest/current/collections/Polytopes.Lattice

Response samples

Content type
application/json
[
  • "Polytopes.Lattice.Reflexive",
  • "Polytopes.Lattice.SmoothReflexive",
  • "Polytopes.Lattice.01Polytopes"
]

Collection Metadata

Each object in a specific collection in polyDB is described by a JSON schema that specifies which mathematical information can be found in each object. You can use the schema to validate the objects and check which data can be queried for the objects.

Obtain the JSON schema for a collection

This endpoint returns the the JSON schema describing all objects in a collection

path Parameters
collection
required
string
Example: Polytopes.Lattice.01Polytopes

the fully qualified name of the collection

Responses

Request samples

http GET https://polydb.org/rest/current/schema/Polytopes.Lattice.01Polytopes

Response samples

Content type
application/json
{
  • "_id": "string"
}

Obtain Documents

All data in a polyDB collection can be accessed with a query operation. Depending on the endpoint the query returns a single document or an array of all documents that satisfy the given query. All queries must follow the Mongo DB query language, which basically is a JSON document specifying the query parameters. Some examples are

{ "DIM" : 5 }

to find one or all objects of dimension 5, or

{ "N_VERTICES" : {"&gt" : 7}, "N_FACETS": 10 }

to find one or all objects with more than seven vertices and exactly 10 facets. The names of the properties you can query for can be found in the schema of the collection or in tis documentation. In the examples we follow the naming conventions of polymake.

All endpoints (except id/) in this section accept the following modifiers:

  • skip=N: skip the first N results (that match the query)
  • limit=N: only return the first N results (that match the query, counting from the position gven by skip)

Some endpoints also allow to specify a projection of the data. This is a JSON document that specifies either which properties of the object should be returned by the query, or which properties should be dropped in the return. A valid projection may look like this:

{ "DIM" : 1, "N_VERTICES" : 1, "N_FACETS" : 1 }

which returns only the dimension, the number of vertices and facets, and the id of the object in the polyDB (this is alwyas returned and need not be specified)

find one object

finds an object in a collection

path Parameters
collection
required
string
Example: Polytopes.Lattice.01Polytopes

the fully qualified collection name

query Parameters
skip
integer >= 0
Default: 0
Example: skip=5

skip the first N results

required
object
Example: query="{"DIM":3}"

the filter query for the documents

Responses

Request samples

http GET 'https://polydb.org/rest/current/find_one/Polytopes.Lattice.01Polytopes?skip=5&query=%257B%2522DIM%2522%253A3%257D'

Response samples

Content type
application/json
{
  • "_id": "n10r0_00000000",
  • "SERIES_PARALLEL": false,
  • "TERNARY": true,
  • "SPLIT_FLACETS": [ ],
  • "N_CONNECTED_COMPONENTS": 10,
  • "G_INVARIANT": [
    ],
  • "_ns": {},
  • "TRANSVERSAL": true,
  • "SELF_DUAL": false,
  • "TUTTE_POLYNOMIAL": [
    ],
  • "_type": "matroid::Matroid",
  • "_polyDB": {
    },
  • "LAMINAR": true,
  • "SIMPLE": false,
  • "N_AUTOMORPHISMS": 3628800,
  • "REGULAR": true,
  • "PAVING": true,
  • "N_CIRCUITS": 10,
  • "BINARY": true,
  • "NESTED": true,
  • "_info": {
    },
  • "N_FLATS": 1,
  • "N_BASES": 1,
  • "RANK": 0,
  • "N_LOOPS": 10,
  • "N_CYCLIC_FLATS": 1,
  • "DUAL": {
    },
  • "REVLEX_BASIS_ENCODING": "*",
  • "N_ELEMENTS": 10,
  • "_attrs": {
    },
  • "IDENTICALLY_SELF_DUAL": false,
  • "CONNECTED": false,
  • "BETA_INVARIANT": "0"
}

find one object

This endpoint returns one document in a collection that satisfies the given filter. The collection must be given as a query parameter.

query Parameters
collection
required
string
Example: collection=Polytopes.Lattice.01Polytopes

the fully qualified collection name

skip
integer >= 0
Default: 0
Example: skip=5

skip the first N results

required
object
Example: query="{"DIM":3}"

the filter query for the documents

object
Example: projection="{"DIM":1,"N_VERTICES":1}"

A projection applied to the document. You can either specify which properties should be remved from the document, or which properties should be included

Responses

Request samples

http GET 'https://polydb.org/rest/current/find_one?collection=Polytopes.Lattice.01Polytopes&skip=5&query=%257B%2522DIM%2522%253A3%257D&projection=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A1%257D'

Response samples

Content type
application/json
{
  • "_id": "n10r0_00000000",
  • "SERIES_PARALLEL": false,
  • "TERNARY": true,
  • "SPLIT_FLACETS": [ ],
  • "N_CONNECTED_COMPONENTS": 10,
  • "G_INVARIANT": [
    ],
  • "_ns": {},
  • "TRANSVERSAL": true,
  • "SELF_DUAL": false,
  • "TUTTE_POLYNOMIAL": [
    ],
  • "_type": "matroid::Matroid",
  • "_polyDB": {
    },
  • "LAMINAR": true,
  • "SIMPLE": false,
  • "N_AUTOMORPHISMS": 3628800,
  • "REGULAR": true,
  • "PAVING": true,
  • "N_CIRCUITS": 10,
  • "BINARY": true,
  • "NESTED": true,
  • "_info": {
    },
  • "N_FLATS": 1,
  • "N_BASES": 1,
  • "RANK": 0,
  • "N_LOOPS": 10,
  • "N_CYCLIC_FLATS": 1,
  • "DUAL": {
    },
  • "REVLEX_BASIS_ENCODING": "*",
  • "N_ELEMENTS": 10,
  • "_attrs": {
    },
  • "IDENTICALLY_SELF_DUAL": false,
  • "CONNECTED": false,
  • "BETA_INVARIANT": "0"
}

find objects

Returns an array of documents in the given collection that satisfy the filter. The name of the collection must be given in the path.

path Parameters
collection
required
string
Example: Polytopes.Lattice.01Polytopes

the fully qualified collection name

query Parameters
skip
integer >= 0
Default: 0
Example: skip=5

skip the first N results

limit
integer >= 0
Default: 10
Example: limit=10

return at most N results

object
Example: sort_by="{"DIM":1,"N_VERTICES":-1}"

Specify a sort order for the results. This is applied before the parameters skip or limit specify the range of results returned.

required
object
Example: query="{"DIM":3}"

the filter query for the documents

object
Example: projection="{"DIM":1,"N_VERTICES":1}"

A projection applied to the document. You can either specify which properties should be remved from the document, or which properties should be included

Responses

Request samples

http GET 'https://polydb.org/rest/current/find/Polytopes.Lattice.01Polytopes?skip=5&limit=10&sort_by=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A-1%257D&query=%257B%2522DIM%2522%253A3%257D&projection=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A1%257D'

Response samples

Content type
application/json
{
  • "_id": "n10r0_00000000",
  • "SERIES_PARALLEL": false,
  • "TERNARY": true,
  • "SPLIT_FLACETS": [ ],
  • "N_CONNECTED_COMPONENTS": 10,
  • "G_INVARIANT": [
    ],
  • "_ns": {},
  • "TRANSVERSAL": true,
  • "SELF_DUAL": false,
  • "TUTTE_POLYNOMIAL": [
    ],
  • "_type": "matroid::Matroid",
  • "_polyDB": {
    },
  • "LAMINAR": true,
  • "SIMPLE": false,
  • "N_AUTOMORPHISMS": 3628800,
  • "REGULAR": true,
  • "PAVING": true,
  • "N_CIRCUITS": 10,
  • "BINARY": true,
  • "NESTED": true,
  • "_info": {
    },
  • "N_FLATS": 1,
  • "N_BASES": 1,
  • "RANK": 0,
  • "N_LOOPS": 10,
  • "N_CYCLIC_FLATS": 1,
  • "DUAL": {
    },
  • "REVLEX_BASIS_ENCODING": "*",
  • "N_ELEMENTS": 10,
  • "_attrs": {
    },
  • "IDENTICALLY_SELF_DUAL": false,
  • "CONNECTED": false,
  • "BETA_INVARIANT": "0"
}

find objects

Returns an array of documents in the given collection that satisfy the filter. The name of the collection must be given in the query.

query Parameters
collection
required
string
Example: collection=Polytopes.Lattice.01Polytopes

the fully qualified collection name

skip
integer >= 0
Default: 0
Example: skip=5

skip the first N results

limit
integer >= 0
Default: 10
Example: limit=10

return at most N results

object
Example: sort_by="{"DIM":1,"N_VERTICES":-1}"

Specify a sort order for the results. This is applied before the parameters skip or limit specify the range of results returned.

required
object
Example: query="{"DIM":3}"

the filter query for the documents

object
Example: projection="{"DIM":1,"N_VERTICES":1}"

A projection applied to the document. You can either specify which properties should be remved from the document, or which properties should be included

Responses

Request samples

http GET 'https://polydb.org/rest/current/find?collection=Polytopes.Lattice.01Polytopes&skip=5&limit=10&sort_by=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A-1%257D&query=%257B%2522DIM%2522%253A3%257D&projection=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A1%257D'

Response samples

Content type
application/json
{
  • "_id": "n10r0_00000000",
  • "SERIES_PARALLEL": false,
  • "TERNARY": true,
  • "SPLIT_FLACETS": [ ],
  • "N_CONNECTED_COMPONENTS": 10,
  • "G_INVARIANT": [
    ],
  • "_ns": {},
  • "TRANSVERSAL": true,
  • "SELF_DUAL": false,
  • "TUTTE_POLYNOMIAL": [
    ],
  • "_type": "matroid::Matroid",
  • "_polyDB": {
    },
  • "LAMINAR": true,
  • "SIMPLE": false,
  • "N_AUTOMORPHISMS": 3628800,
  • "REGULAR": true,
  • "PAVING": true,
  • "N_CIRCUITS": 10,
  • "BINARY": true,
  • "NESTED": true,
  • "_info": {
    },
  • "N_FLATS": 1,
  • "N_BASES": 1,
  • "RANK": 0,
  • "N_LOOPS": 10,
  • "N_CYCLIC_FLATS": 1,
  • "DUAL": {
    },
  • "REVLEX_BASIS_ENCODING": "*",
  • "N_ELEMENTS": 10,
  • "_attrs": {
    },
  • "IDENTICALLY_SELF_DUAL": false,
  • "CONNECTED": false,
  • "BETA_INVARIANT": "0"
}

Object with given id

This endpoint returns the document of the given collection with the given id

path Parameters
collection
required
string
Example: Polytopes.Lattice.01Polytopes

the fully qualified name of the collection

id
required
string
Example: 4d.10v.10f.L0

the id of the document

Responses

Request samples

http GET https://polydb.org/rest/current/id/Polytopes.Lattice.01Polytopes/4d.10v.10f.L0

Response samples

Content type
application/json
{
  • "_id": "n10r0_00000000",
  • "SERIES_PARALLEL": false,
  • "TERNARY": true,
  • "SPLIT_FLACETS": [ ],
  • "N_CONNECTED_COMPONENTS": 10,
  • "G_INVARIANT": [
    ],
  • "_ns": {},
  • "TRANSVERSAL": true,
  • "SELF_DUAL": false,
  • "TUTTE_POLYNOMIAL": [
    ],
  • "_type": "matroid::Matroid",
  • "_polyDB": {
    },
  • "LAMINAR": true,
  • "SIMPLE": false,
  • "N_AUTOMORPHISMS": 3628800,
  • "REGULAR": true,
  • "PAVING": true,
  • "N_CIRCUITS": 10,
  • "BINARY": true,
  • "NESTED": true,
  • "_info": {
    },
  • "N_FLATS": 1,
  • "N_BASES": 1,
  • "RANK": 0,
  • "N_LOOPS": 10,
  • "N_CYCLIC_FLATS": 1,
  • "DUAL": {
    },
  • "REVLEX_BASIS_ENCODING": "*",
  • "N_ELEMENTS": 10,
  • "_attrs": {
    },
  • "IDENTICALLY_SELF_DUAL": false,
  • "CONNECTED": false,
  • "BETA_INVARIANT": "0"
}

Count Documents

All data in a polyDB collection can be accessed with a count operation. Edpoints return the total number of documents that satisfy the given query and search modifiers. All queries must follow the Mongo DB query language, which basically is a JSON document specifying the query parameters. Some examples are

{ "DIM" : 5 }

to find one or all objects of dimension 5, or

{ "N_VERTICES" : {"&gt" : 7}, "N_FACETS": 10 }

to count all documents with more than seven vertices and exactly 10 facets. The names of the properties you can query for can be found in the schema of the collection or in tis documentation. In the examples we follow the naming conventions of polymake.

All endpoints in this section accept the following modifiers:

  • skip=N: skip the first N results (that match the query)
  • limit=N: only return the first N results (that match the query, counting from the position gven by skip)

Count documents

This endpoint counts the number of documents in a collection that satisfy the conditions given in the filter and the search modifiers. The collection must be given in the query.

query Parameters
collection
required
string
Example: collection=Polytopes.Lattice.01Polytopes

the fully qualified collection name

skip
integer >= 0
Default: 0
Example: skip=10

skip the first N results

limit
integer >= 0
Default: 10
Example: limit=10

return at most N results

object
Example: sort_by="{"DIM":1,"N_VERTICES":-1}"

Specify a sort order for the results. This is applied before the parameters skip or limit specify the range of results returned.

required
object
Example: query="{"DIM":4}"

the filter query for the documents

object
Example: projection="{"DIM":1,"N_VERTICES":1}"

A projection applied to the document. You can either specify which properties should be remved from the document, or which properties should be included

Responses

Request samples

http GET 'https://polydb.org/rest/current/count?collection=Polytopes.Lattice.01Polytopes&skip=10&limit=10&sort_by=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A-1%257D&query=%257B%2522DIM%2522%253A4%257D&projection=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A1%257D'

Response samples

Content type
application/json
0
0

Count documents

This endpoint counts the number of documents in a collection that satisfy the conditions given in the filter and the search modifiers. The collection must be given in the path.

query Parameters
collection
required
string
Example: collection=Polytopes.Lattice.01Polytopes

the fully qualified collection name

skip
integer >= 0
Default: 0
Example: skip=10

skip the first N results

limit
integer >= 0
Default: 10
Example: limit=10

return at most N results

object
Example: sort_by="{"DIM":1,"N_VERTICES":-1}"

Specify a sort order for the results. This is applied before the parameters skip or limit specify the range of results returned.

required
object
Example: query="{"DIM":4}"

the filter query for the documents

object
Example: projection="{"DIM":1,"N_VERTICES":1}"

A projection applied to the document. You can either specify which properties should be remved from the document, or which properties should be included

Responses

Request samples

http GET 'https://polydb.org/rest/current/count/%7Bcollection%7D?collection=Polytopes.Lattice.01Polytopes&skip=10&limit=10&sort_by=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A-1%257D&query=%257B%2522DIM%2522%253A4%257D&projection=%257B%2522DIM%2522%253A1%252C%2522N_VERTICES%2522%253A1%257D'

Response samples

Content type
application/json
0
0

Aggregate Information

Data in polyDB can be aggregated in various ways. The REST API currently allows to obtain lists of distinct values for a property, and lists of document ids.

Both endpoints accept a filter that is applied before the distinct values or the ids are retrieved. Some examples for a filter are

{ "DIM" : 5 }

to restrict to documents of objects of dimension 5, or

{ "N_VERTICES" : {"&gt" : 7}, "N_FACETS": 10 }

to restrict to objects with more than seven vertices and exactly 10 facets. The names of the properties you can query for can be found in the schema of the collection or in tis documentation. In the examples we follow the naming conventions of polymake.

Distinct values for a property

This endpoint returns a list of distinct values for a property in all objects the match the filter query and the search modifiers.

path Parameters
collection
required
string
Example: Polytopes.Lattice.01Polytopes

the fully qualified collection name

property
required
string
Example: N_VERTICES

the property for which all distinct values should be returned

query Parameters
required
object
Example: query="{"DIM":4,"N_FACETS":{"$lte":6}}"

the filter query for the documents

Responses

Request samples

http GET 'https://polydb.org/rest/current/distinct/Polytopes.Lattice.01Polytopes/N_VERTICES?query=%257B%2522DIM%2522%253A4%252C%2522N_FACETS%2522%253A%257B%2522%2524lte%2522%253A6%257D%257D'

Response samples

Content type
application/json
[
  • 5,
  • 6,
  • 7,
  • 8,
  • 9
]

Get a list of IDs

This endpoint returns a list of Ids for documents that match the filter conditions and the search modifiers.

path Parameters
collection
required
string
Example: Polytopes.Lattice.01Polytopes

the fully qualified name of the collection

query Parameters
skip
integer >= 0
Default: 0
Example: skip=10

skip the first N results

limit
integer >= 0
Default: 10
Example: limit=5

return at most N results

required
object
Example: query="{"DIM":5}"

the filter query for the documents

Responses

Request samples

http GET 'https://polydb.org/rest/current/ids/Polytopes.Lattice.01Polytopes?skip=10&limit=5&query=%257B%2522DIM%2522%253A5%257D'

Response samples

Content type
application/json
[
  • "5d.10v.10f.L18",
  • "5d.10v.10f.L19",
  • "5d.10v.10f.L2",
  • "5d.10v.10f.L20",
  • "5d.10v.10f.L21"
]