Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:poly_db_querying [2017/08/07 15:26] – paffenholz | tutorial:poly_db_querying [2018/02/10 11:38] (current) – deleted after merging into doku.php/tutorial/poly_db_tutorial oroehrig | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Querying the Database ==== | ||
- | There are three commands that can be used to query the database: | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | If you expect a large number of results (which you can check with '' | ||
- | |||
- | === Queries === | ||
- | |||
- | Queries are given as perl hashes. In its most basic form a query has the form | ||
- | { " | ||
- | for example | ||
- | { " | ||
- | Note that the database is pretty strict with types, so strings always need to be quoted, while integers should not be. The following would fail: | ||
- | { " | ||
- | The empty query is allowed: | ||
- | {} | ||
- | returns all objects of a collection. You can query elements in an array with their index, e.g. | ||
- | { " | ||
- | gives polytopes with 12 edges (the entry at position one of the f-vector). | ||
- | |||
- | You can query ranges with '' | ||
- | { DIM => { ' | ||
- | to obtain polytopes of dimension less than 4. Observe the single quotation marks around '' | ||
- | { DIM => { ' | ||
- | to obtain those polytopes with dimensions between 4 and 10. | ||
- | |||
- | '' | ||
- | |||
- | === Obtain Objects that Satisfy a Query === | ||
- | |||
- | With '' | ||
- | { $a=db_query({' | ||
- | which returns all three dimensional smooth reflexive polytopes. The first argument (the query) can be any query as in the previous section. | ||
- | |||
- | The name of the database and the collection can be stored in custom variables: | ||
- | |||
- | | ||
- | | ||
- | |||
- | We assume this in the following. If you want to make this persistent over the next polymake sessions then add '' | ||
- | { $a=db_query({' | ||
- | |||
- | If you just want to have one (random) object that satisfies your query, then you can add '' | ||
- | { $a=db_query({' | ||
- | |||
- | If you want, for a given property, the set of values that can be attained for this property, then you can use the option '' | ||
- | { $a=db_query({' | ||
- | returns an array that contains all values '' | ||
- | |||
- | With the option '' | ||
- | |||
- | With the option '' | ||
- | skip => { " | ||
- | sorts by the nuber of vertices. | ||
- | |||
- | === Count Objects that Satisfy a Query === | ||
- | |||
- | Using '' | ||
- | |||
- | === Obtain Object '' | ||
- | |||
- | Using '' | ||
- | |||
- | === Obtain Objects using a Cursor === | ||
- | |||
- | This is done with '' | ||
- | |||
- | Specifically, | ||
- | | ||
- | A cursor has four special methods: | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | Hence, a typical computation could be | ||
- | | ||
- | | ||
- | print $p-> | ||
- | |||
- | === Obtain Information about available Databases and Collections === | ||
- | |||
- | You can obtain information on the databases and collections in the database using the '' | ||
- | < | ||
- | polytope> | ||
- | DATABASE: LatticePolytopes | ||
- | This database contains various classes of lattice polytopes. | ||
- | |||
- | Collection: SmoothReflexive | ||
- | A complete collection of smooth reflexive lattice polytopes in dimensions up to 9, up to lattice equivalence. The lists were computed with the algorithm of | ||
- | Mikkel Oebro (see [[http:// | ||
- | of Andreas Paffenholz]]. | ||
- | |||
- | In dimensions up to 7 the database contains the properties: | ||
- | H_STAR_VECTOR, | ||
- | contributor, | ||
- | FEASIBLE, LINEALITY_SPACE, | ||
- | |||
- | In dimension 8 the lattice points are not stored, and in dimension 9 also NORMAL is not computed | ||
- | |||
- | __________________ | ||
- | |||
- | DATABASE: Manifolds | ||
- | This database contains combinatorial manifolds | ||
- | |||
- | Collection: DIM2_3 | ||
- | This is a collection of combinatorial 2- and 3-manifolds with up to 10 vertices given as triangulations and calculcated by Frank Lutz found at: | ||
- | http:// | ||
- | |||
- | [...] | ||
- | </ | ||
- | The command takes the options '' | ||
- | |||
- | === Obtain Information about Searchable Fields in a Collection === | ||
- | |||
- | You can list all searchable entries of a collection with the command '' | ||
- | < | ||
- | db_print_searchable_fields(db=>" | ||
- | |||
- | Entries for smooth reflexive polytopes in dimensions 1 to 7 | ||
- | ---------------------------- | ||
- | AFFINE_HULL | ||
- | CENTROID | ||
- | CONE_AMBIENT_DIM | ||
- | CONE_DIM | ||
- | EHRHART_POLYNOMIAL_COEFF | ||
- | FACETS | ||
- | FACET_WIDTHS | ||
- | FULL_DIM | ||
- | F_VECTOR | ||
- | GORENSTEIN | ||
- | H_STAR_VECTOR | ||
- | LATTICE_CODEGREE | ||
- | LATTICE_DEGREE | ||
- | LATTICE_POINTS_GENERATORS | ||
- | LATTICE_VOLUME | ||
- | LINEALITY_SPACE | ||
- | NORMAL | ||
- | N_BOUNDARY_LATTICE_POINTS | ||
- | N_FACETS | ||
- | N_INTERIOR_LATTICE_POINTS | ||
- | N_LATTICE_POINTS | ||
- | N_VERTICES | ||
- | POINTED | ||
- | REFLEXIVE | ||
- | SMOOTH | ||
- | VERTICES | ||
- | VERY_AMPLE | ||
- | </ | ||
- | |||
- | === Type Information === | ||
- | |||
- | For most objects in the database there is a corresponding type information entry that specifies the properties present in the objects following this type information and some metadate information on the objects. Usually this is only interesting when inserting the objects into the database to ensure that all objects in a collection contain the same information (to allow comprehensive searches on the data). There can be more than one type information entry for a collection, e.g. if for some part of a collection should or cannot be computed or stored in the database (e.g. storing all lattice points for the nin-dimensional Fano polytopes is not feasible). To distinguish between these type information entries each entry in the database has a key specifying the type information used. In the objects retrieved from the database this is stored in the '' | ||
- | |||
- | You can retrieve the type information entry with '' | ||
- | $t = db_get_type_information(db=>" | ||
- | |||
- | For the format of such a typer information entry in the database see [[devel/ | ||
- |