no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | user_guide:tutorials:latest:json_and_polydb [2023/11/06 10:57] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== polymake file format and the polyDB ====== | ||
+ | |||
+ | ===== Polymake Data Files ===== | ||
+ | |||
+ | ==== JSON File Format ==== | ||
+ | |||
+ | With release 4.0 polymake adopts a new file format for its data files. In the new version all data is now serialized to JSON instead of XML. | ||
+ | |||
+ | polymake can still read files in XML format. | ||
+ | |||
+ | <code perl> | ||
+ | > $p = new Polytope(POINTS=> | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | JSON is a pretty simple format. Entries in a JSON object are either | ||
+ | |||
+ | * number: no distinction between float and int | ||
+ | * string | ||
+ | * boolean: true/false | ||
+ | * array: comma separated list of elements in square brackets | ||
+ | * object: comma separeted key-value pairs in curly brackets. associative array | ||
+ | * null | ||
+ | |||
+ | Polymake stores | ||
+ | |||
+ | * perl builtin numbers a number | ||
+ | * vectors, matrices as array | ||
+ | * tuples as object | ||
+ | * Integer/ | ||
+ | * Bool as boolean | ||
+ | * big objects as objects (with properties as keys) | ||
+ | |||
+ | Type information that cannot be infered from the rule base (sparse, attachment) is stored in an separate key-value pair. | ||
+ | |||
+ | There are only a few meta tags left in a data file: | ||
+ | |||
+ | * _id: name | ||
+ | * _ns: mark it as a polymake file | ||
+ | * _info: credits and description | ||
+ | * _type: big object type | ||
+ | * _attrs: additional attributes for properties, marks e.g. attachments, | ||
+ | * _ext: extensions | ||
+ | * _load: further applications needed to read data file | ||
+ | * _polyDB: database information, | ||
+ | |||
+ | ==== Object Arrays ==== | ||
+ | |||
+ | You can now use standard perl arrays to store a list of objects. | ||
+ | |||
+ | <code perl> | ||
+ | > $cube = cube(2); | ||
+ | > $simplex = simplex(2); | ||
+ | > $array = [ $cube, $simplex ]; | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | [ | ||
+ | 0, | ||
+ | 2 | ||
+ | ], | ||
+ | [ | ||
+ | 1, | ||
+ | 3 | ||
+ | ], | ||
+ | [ | ||
+ | 0, | ||
+ | 1 | ||
+ | ], | ||
+ | [ | ||
+ | 2, | ||
+ | 3 | ||
+ | ], | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | ==== Background: JSON Schemata ==== | ||
+ | |||
+ | <code perl> | ||
+ | > $p = new Polytope(VERTICES=> | ||
+ | > $p-> | ||
+ | > $schema = create_restrictive_schema($p); | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | > print $schema-> | ||
+ | true | ||
+ | </ | ||
+ | We can use a schema to modify a data file so that it validates against the schema | ||
+ | |||
+ | <code perl> | ||
+ | > $q = new Polytope(VERTICES=> | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | > help " | ||
+ | core/ | ||
+ | prescribe_property_types(properties; | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | or in PolyDB using this schema. | ||
+ | |||
+ | Note: This function does not try to verify that the properties can be serialized as the given type | ||
+ | or will be successfully deserialized when reading the object from a file or retrieving it from a database. | ||
+ | | ||
+ | |||
+ | Arguments: | ||
+ | Any __properties__ list of pairs PROPERTY_NAME => type | ||
+ | A property in a subobject is written in dotted path notation: " | ||
+ | Types can be specified by name in a string or as a typeof expression or as a type of an exsiting data object. | ||
+ | Specifying undef or " | ||
+ | This operation might be useful e.g. to update the schema after a data mode change. | ||
+ | |||
+ | Examples: | ||
+ | |||
+ | *) Require FACETS to be stored as a sparse matrix | ||
+ | > $schema-> | ||
+ | *) Require F_VECTOR and F2_VECTOR to be stored with simple integer entries | ||
+ | > $schema-> | ||
+ | *) Require VERTICES to be stored as declared in the rules, that is, as a dense matrix | ||
+ | > $schema-> | ||
+ | </ | ||
+ | We can change the type of VERTICES in our schema: | ||
+ | |||
+ | <code perl> | ||
+ | > $schema-> | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | We can also create a schema for a complete big object type | ||
+ | |||
+ | <code perl> | ||
+ | > $full_schema=create_permissive_schema(typeof graph:: | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | > $m=graph:: | ||
+ | > print $full_schema-> | ||
+ | true | ||
+ | </ | ||
+ | ===== PolyDB ===== | ||
+ | |||
+ | ==== General Information ==== | ||
+ | |||
+ | Database for mathematical objects. Intended for data related to the projects within OSCAR. | ||
+ | |||
+ | Database is independent of particular software package, but information necessary for in-/output to a software can be stored alongside. | ||
+ | |||
+ | Currently accessible via web (still at an experimental stage) and via polymake. | ||
+ | |||
+ | https:// | ||
+ | |||
+ | A database connection is established by calling the function '' | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_default=polyDB(); | ||
+ | </ | ||
+ | ==== Get info ==== | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_default-> | ||
+ | =============== | ||
+ | available polydb collections | ||
+ | =============== | ||
+ | |||
+ | SECTION: 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:// | ||
+ | |||
+ | SECTION: Matroids | ||
+ | This database contains various classes of matroids. | ||
+ | |||
+ | COLLECTION: SelfDual | ||
+ | Collection of identically self-dual matroids of rank 2 to 5, based on the computational results in the paper '' | ||
+ | |||
+ | COLLECTION: Small | ||
+ | Collection of small matroids based on the census by Yoshitake Matsumoto, Sonoko Moriyama, Hiroshi Imai, David Bremner. | ||
+ | |||
+ | SECTION: Polytopes | ||
+ | A collection of families of polytopes | ||
+ | |||
+ | SECTION: Polytopes.Combinatorial | ||
+ | This database contains various classes of combinatorial polytopes. | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | |||
+ | COLLECTION: CombinatorialTypes | ||
+ | Combinatorial types of polytopes of small dimension and number of vertices | ||
+ | |||
+ | COLLECTION: FacesBirkhoffPolytope | ||
+ | Combinatorial types of faces up to dimension | ||
+ | |||
+ | COLLECTION: SmallSpheresDim4 | ||
+ | Combinatorial 3-spheres with up to 9 vertices | ||
+ | |||
+ | SECTION: Polytopes.Geometric | ||
+ | This database contains various classes of geometric polytopes. | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | |||
+ | SECTION: Polytopes.Lattice | ||
+ | This database contains various classes of lattice polytopes. | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | |||
+ | COLLECTION: ExceptionalMaximalHollow | ||
+ | Exceptional maximal hollow lattice polytopes up to dimension 3 | ||
+ | |||
+ | COLLECTION: FewLatticePoints3D | ||
+ | 3-dimensional lattice polytopes of width at least 2 and few lattice points. | ||
+ | |||
+ | COLLECTION: NonSpanning3D | ||
+ | Non-spanning 3-dimensional lattice polytopes of width at least 2 and at most 200 lattice points. | ||
+ | |||
+ | COLLECTION: Panoptigons | ||
+ | Non-hyperelliptic Panoptigons of lattice diameter at least 3 | ||
+ | |||
+ | COLLECTION: Reflexive | ||
+ | Reflexive Polytopes in dimension 4 | ||
+ | |||
+ | COLLECTION: SmallVolume | ||
+ | Lattice Polytopes with low volume | ||
+ | |||
+ | COLLECTION: SmoothReflexive | ||
+ | Smooth reflexive polytopes in dimensions 1 to 9 with splitting data | ||
+ | |||
+ | SECTION: Polytopes.Combinatorial | ||
+ | This database contains various classes of combinatorial polytopes. | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | |||
+ | COLLECTION: CombinatorialTypes | ||
+ | Combinatorial types of polytopes of small dimension and number of vertices | ||
+ | |||
+ | COLLECTION: FacesBirkhoffPolytope | ||
+ | Combinatorial types of faces up to dimension | ||
+ | |||
+ | COLLECTION: SmallSpheresDim4 | ||
+ | Combinatorial 3-spheres with up to 9 vertices | ||
+ | |||
+ | SECTION: Polytopes.Geometric | ||
+ | This database contains various classes of geometric polytopes. | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | |||
+ | SECTION: Polytopes.Lattice | ||
+ | This database contains various classes of lattice polytopes. | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | |||
+ | COLLECTION: ExceptionalMaximalHollow | ||
+ | Exceptional maximal hollow lattice polytopes up to dimension 3 | ||
+ | |||
+ | COLLECTION: FewLatticePoints3D | ||
+ | 3-dimensional lattice polytopes of width at least 2 and few lattice points. | ||
+ | |||
+ | COLLECTION: NonSpanning3D | ||
+ | Non-spanning 3-dimensional lattice polytopes of width at least 2 and at most 200 lattice points. | ||
+ | |||
+ | COLLECTION: Panoptigons | ||
+ | Non-hyperelliptic Panoptigons of lattice diameter at least 3 | ||
+ | |||
+ | COLLECTION: Reflexive | ||
+ | Reflexive Polytopes in dimension 4 | ||
+ | |||
+ | COLLECTION: SmallVolume | ||
+ | Lattice Polytopes with low volume | ||
+ | |||
+ | COLLECTION: SmoothReflexive | ||
+ | Smooth reflexive polytopes in dimensions 1 to 9 with splitting data | ||
+ | |||
+ | SECTION: Tropical | ||
+ | This database contains tropical objects. | ||
+ | |||
+ | COLLECTION: Cubics | ||
+ | Regular unimodular triangulations of the triple tetrahedron and their motifs. | ||
+ | |||
+ | COLLECTION: Polytropes | ||
+ | Representatives for all combinatorial tropical types of full-dimensional polytropes in TP3. | ||
+ | |||
+ | COLLECTION: QuarticCurves | ||
+ | Regular unimodular triangulations of the fourth dilation of the standard 2-dimensional simplex and their dual deformation motifs. | ||
+ | |||
+ | COLLECTION: SchlaefliFan | ||
+ | Regular unimodular triangulations of the triple tetrahedron and their motifs. | ||
+ | |||
+ | COLLECTION: TOM | ||
+ | All known non-realisable tropical oriented matroids with parameters n=6, d=3 or n=d=4. | ||
+ | </ | ||
+ | For individual collections we can get more detailed information: | ||
+ | |||
+ | * level 1: short description (default if no collection is given), | ||
+ | * level 2: description, | ||
+ | * level 3: description, | ||
+ | * level 4: full info | ||
+ | * level 5: full info and list of recommended search fields, if defined in info (default if collection is given) | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_default-> | ||
+ | =============== | ||
+ | available polydb collections | ||
+ | =============== | ||
+ | |||
+ | SECTION: Polytopes.Combinatorial | ||
+ | This database contains various classes of combinatorial polytopes. | ||
+ | |||
+ | COLLECTION: CombinatorialTypes | ||
+ | Combinatorial types of polytopes of small dimension and number of vertices, see [[http:// | ||
+ | Author(s): | ||
+ | Hiroyuki Miyata, University of Tokyo, Bunkyo-ku, Tokyo, Japan, hmiyata@is.s.u-tokyo.ac.jp | ||
+ | Sonoko Moriyama, Tokuyama laboratory, System Information Sciences, Graduate School of Information Sciences, Tohoku University, moriso@dais.is.tohoku.ac.jp | ||
+ | Komei Fukuda, Theory of Combinatorial Algorithms, Department of Mathematics, | ||
+ | Contributor(s): | ||
+ | Constantin Fischer, TU Berlin, cfischer@mailbox.tu-berlin.de | ||
+ | Maintainer(s): | ||
+ | Constantin Fischer, TU Berlin, cfischer@mailbox.tu-berlin.de | ||
+ | Online Resources: | ||
+ | Classification of Oriented Matroids: http:// | ||
+ | </ | ||
+ | ==== Reading Data from polymake ==== | ||
+ | |||
+ | === Simple reading === | ||
+ | |||
+ | <code perl> | ||
+ | > $coll_default=$pdb_default-> | ||
+ | > $a=$coll_default-> | ||
+ | </ | ||
+ | This returns a cursor over the data. | ||
+ | |||
+ | <code perl> | ||
+ | > print $a-> | ||
+ | true | ||
+ | > $p=$a-> | ||
+ | > print $p-> | ||
+ | 8 12 6 | ||
+ | > while ( $p = $a->next ) { | ||
+ | > print $p-> | ||
+ | > } | ||
+ | 6 9 5 | ||
+ | 10 15 7 | ||
+ | 12 18 8 | ||
+ | 10 15 7 | ||
+ | 8 12 6 | ||
+ | 8 12 6 | ||
+ | 10 15 7 | ||
+ | 10 15 7 | ||
+ | 12 18 8 | ||
+ | 8 12 6 | ||
+ | 8 12 6 | ||
+ | 8 12 6 | ||
+ | 6 9 5 | ||
+ | 6 9 5 | ||
+ | 8 12 6 | ||
+ | 6 9 5 | ||
+ | 4 6 4 | ||
+ | </ | ||
+ | === Objects from the database know where they come from === | ||
+ | |||
+ | <code perl> | ||
+ | > $a=$coll_default-> | ||
+ | > $p=$a-> | ||
+ | > $info=$p-> | ||
+ | > foreach (keys %$info) { print $_, ": ", $info-> | ||
+ | id: F.3D.0000 | ||
+ | uri: http:// | ||
+ | section: Polytopes.Lattice | ||
+ | collection: SmoothReflexive | ||
+ | version: 2.1 | ||
+ | app: polytope | ||
+ | database: LatticePolytopes | ||
+ | tag: object | ||
+ | creation_date: | ||
+ | type: polytope:: | ||
+ | </ | ||
+ | ==== Queries ==== | ||
+ | |||
+ | <code perl> | ||
+ | > $cur=$coll_default-> | ||
+ | </ | ||
+ | A query usually returns a cursor over all matching results. | ||
+ | |||
+ | <code perl> | ||
+ | > while ( $p = $cur-> | ||
+ | > print " | ||
+ | > } | ||
+ | (3, 8) (3, 8) (3, 8) (3, 8) (3, 8) (3, 8) (3, 8) | ||
+ | </ | ||
+ | The cursor keeps its position, so to return to the first result we need to reset the cursor. | ||
+ | |||
+ | <code perl> | ||
+ | > $cur=$coll_default-> | ||
+ | > while ( $p = $cur-> | ||
+ | > print " | ||
+ | > } | ||
+ | (3, 8) (3, 8) (3, 8) (3, 8) (3, 8) (3, 8) (3, 8) | ||
+ | </ | ||
+ | We can collect all results into an array. | ||
+ | |||
+ | <code perl> | ||
+ | > $a=$coll_default-> | ||
+ | > print scalar(@$a); | ||
+ | 7 | ||
+ | </ | ||
+ | We can ask for ranges: | ||
+ | |||
+ | <code perl> | ||
+ | > $a=$coll_default-> | ||
+ | > print scalar(@$a); | ||
+ | 25 | ||
+ | > foreach (@$a) { | ||
+ | > print $_-> | ||
+ | > } | ||
+ | |||
+ | 2 | ||
+ | 3 3 | ||
+ | 4 4 | ||
+ | 4 4 | ||
+ | 5 5 | ||
+ | 6 6 | ||
+ | 8 12 6 | ||
+ | 6 9 5 | ||
+ | 10 15 7 | ||
+ | 12 18 8 | ||
+ | 10 15 7 | ||
+ | 8 12 6 | ||
+ | 8 12 6 | ||
+ | 10 15 7 | ||
+ | 10 15 7 | ||
+ | 12 18 8 | ||
+ | 8 12 6 | ||
+ | 8 12 6 | ||
+ | 8 12 6 | ||
+ | 6 9 5 | ||
+ | 6 9 5 | ||
+ | 8 12 6 | ||
+ | 6 9 5 | ||
+ | 4 6 4 | ||
+ | </ | ||
+ | Boolean operations are possible: | ||
+ | |||
+ | <code perl> | ||
+ | > $a=$coll_default-> | ||
+ | > foreach (@$a) { | ||
+ | > print $_-> | ||
+ | > } | ||
+ | 3 3 | ||
+ | 4 4 | ||
+ | 4 4 | ||
+ | 5 5 | ||
+ | 6 6 | ||
+ | 11 22 18 7 | ||
+ | 8 16 14 6 | ||
+ | 17 34 25 8 | ||
+ | 13 26 20 7 | ||
+ | 15 30 23 8 | ||
+ | 18 36 27 9 | ||
+ | 15 30 23 8 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 12 24 19 7 | ||
+ | 15 30 23 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 13 26 20 7 | ||
+ | 12 24 19 7 | ||
+ | 12 24 19 7 | ||
+ | 9 18 15 6 | ||
+ | 21 42 30 9 | ||
+ | 17 34 25 8 | ||
+ | 17 34 25 8 | ||
+ | 23 46 32 9 | ||
+ | 30 60 40 10 | ||
+ | 13 26 20 7 | ||
+ | 17 34 25 8 | ||
+ | 15 30 23 8 | ||
+ | 18 36 27 9 | ||
+ | 16 32 24 8 | ||
+ | 15 30 23 8 | ||
+ | 12 24 19 7 | ||
+ | 17 34 25 8 | ||
+ | 21 42 30 9 | ||
+ | 21 42 30 9 | ||
+ | 18 36 26 8 | ||
+ | 24 48 33 9 | ||
+ | 18 36 26 8 | ||
+ | 17 34 25 8 | ||
+ | 16 32 24 8 | ||
+ | 13 26 20 7 | ||
+ | 13 26 20 7 | ||
+ | 12 24 19 7 | ||
+ | 15 30 23 8 | ||
+ | 12 24 19 7 | ||
+ | 9 18 15 6 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 20 40 29 9 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 20 40 29 9 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 20 40 29 9 | ||
+ | 20 40 29 9 | ||
+ | 16 32 24 8 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 20 40 29 9 | ||
+ | 21 42 30 9 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 24 48 34 10 | ||
+ | 20 40 29 9 | ||
+ | 20 40 29 9 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 25 50 35 10 | ||
+ | 30 60 41 11 | ||
+ | 36 72 48 12 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 20 40 29 9 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 20 40 29 9 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 17 34 25 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 20 40 29 9 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 15 30 23 8 | ||
+ | 18 36 27 9 | ||
+ | 15 30 23 8 | ||
+ | 20 40 29 9 | ||
+ | 24 48 34 10 | ||
+ | 18 36 27 9 | ||
+ | 15 30 23 8 | ||
+ | 15 30 23 8 | ||
+ | 16 32 24 8 | ||
+ | 11 22 18 7 | ||
+ | 11 22 18 7 | ||
+ | 12 24 19 7 | ||
+ | 12 24 19 7 | ||
+ | 12 24 19 7 | ||
+ | 13 26 20 7 | ||
+ | 16 32 24 8 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 12 24 19 7 | ||
+ | 12 24 19 7 | ||
+ | 8 16 14 6 | ||
+ | 8 16 14 6 | ||
+ | 12 24 19 7 | ||
+ | 9 18 15 6 | ||
+ | 16 32 24 8 | ||
+ | 12 24 19 7 | ||
+ | 8 16 14 6 | ||
+ | 8 16 14 6 | ||
+ | 9 18 15 6 | ||
+ | 5 10 10 5 | ||
+ | > $a=$coll_default-> | ||
+ | > foreach (@$a) { | ||
+ | > print $_-> | ||
+ | > } | ||
+ | 4 4 | ||
+ | 4 4 | ||
+ | </ | ||
+ | Type matters | ||
+ | |||
+ | <code perl> | ||
+ | > $a=$coll_default-> | ||
+ | > print scalar(@$a); | ||
+ | 0 | ||
+ | > $a=$coll_default-> | ||
+ | > print scalar(@$a); | ||
+ | 2 | ||
+ | </ | ||
+ | ==== Creating and filling new collections ==== | ||
+ | |||
+ | Some preparations for a test database | ||
+ | |||
+ | <code perl> | ||
+ | > $PolyDB:: | ||
+ | > $PolyDB:: | ||
+ | > $pdb_local_admin = polyDB(user=>" | ||
+ | > $pdb_local_admin-> | ||
+ | </ | ||
+ | We initiate a new collection. MongoDB is lazy, so what this function actually does is just creating access permisssions. The collection is only created when the first document is inserted. | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_local_admin-> | ||
+ | </ | ||
+ | We insert an info document for the section. This can only be done by database admins. A documentation entry is necessary, otherwise the section is not listed by the '' | ||
+ | |||
+ | <code perl> | ||
+ | > $section_doc=load_json(" | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | > $pdb_local_admin-> | ||
+ | </ | ||
+ | From now on we can hand over the administration of the collection to a user that has admin permissions just on this collection, not the whole database. We create a new one, we could also extend an existing user. | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_local_admin-> | ||
+ | > print $pdb_local_admin-> | ||
+ | true | ||
+ | </ | ||
+ | Now we can connect as the newly created user with admin rights on the new collection. | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_local = polyDB(user=>" | ||
+ | > $coll_local = $pdb_local-> | ||
+ | </ | ||
+ | We first set the documentation for the collection. Again, without a documentation entry the collection is not listed by the '' | ||
+ | |||
+ | <code perl> | ||
+ | > $collection_doc=load_json(" | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | > $coll_local-> | ||
+ | </ | ||
+ | We need to insert two further documents before we can insert data: | ||
+ | |||
+ | * a schema | ||
+ | * an info document with some meta information on the collection. The second needs the id of the schema, so the schema must be inserted first. | ||
+ | |||
+ | We create a schema from a polymake object. | ||
+ | |||
+ | <code perl> | ||
+ | > $a = load_data(" | ||
+ | > print join " ", $a-> | ||
+ | CONE_AMBIENT_DIM VERTICES | ||
+ | > $p=$a-> | ||
+ | > $p-> | ||
+ | > print join " ", $p-> | ||
+ | CONE_AMBIENT_DIM VERTICES FEASIBLE N_VERTICES POINTED BOUNDED FAR_FACE AFFINE_HULL CONE_DIM LINEALITY_DIM LINEALITY_SPACE COMBINATORIAL_DIM SIMPLICITY SIMPLICIALITY SIMPLE SIMPLICIAL FACETS N_FACETS F_VECTOR | ||
+ | > $schema=create_restrictive_schema($p); | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | > $coll_local-> | ||
+ | </ | ||
+ | Now we can insert the info document. | ||
+ | |||
+ | <code perl> | ||
+ | > $info_doc=load_json(" | ||
+ | > print JSON-> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | > $coll_local-> | ||
+ | </ | ||
+ | Now the new collection is fully prepared and is listed with '' | ||
+ | |||
+ | <code perl> | ||
+ | > $pdb_local-> | ||
+ | =============== | ||
+ | available polydb collections | ||
+ | =============== | ||
+ | |||
+ | SECTION: Polytopes | ||
+ | A collection of families of polytopes | ||
+ | |||
+ | COLLECTION: 01Polytopes | ||
+ | 0/ | ||
+ | </ | ||
+ | We can now insert our data. | ||
+ | |||
+ | <code perl> | ||
+ | > $coll_local-> | ||
+ | > print $coll_local-> | ||
+ | 14 | ||
+ | > $b=$coll_local-> | ||
+ | > print scalar(@$b); | ||
+ | 14 | ||
+ | > $p=$coll_local-> | ||
+ | > print join " ", $p-> | ||
+ | CONE_DIM FACETS VERTICES POINTED AFFINE_HULL COMBINATORIAL_DIM SIMPLICIALITY N_VERTICES FAR_FACE FEASIBLE SIMPLE F_VECTOR LINEALITY_SPACE N_FACETS BOUNDED LINEALITY_DIM SIMPLICIAL CONE_AMBIENT_DIM SIMPLICITY | ||
+ | > $coll_local-> | ||
+ | > print $coll_local-> | ||
+ | 13 | ||
+ | </ | ||