Both sides previous revision Previous revision Next revision | Previous revision |
user_guide:howto:poly_db_tutorial [2019/01/25 13:40] – ↷ Page moved from user_guide:poly_db_tutorial to user_guide:howto:poly_db_tutorial oroehrig | user_guide:howto:poly_db_tutorial [2019/09/09 21:08] (current) – [Introduction to polyDB] paffenholz |
---|
====== Introduction to polyDB ====== | ====== Introduction to polyDB ====== |
| |
The polyDB extension provides access to the [[../data|polyDB database]]. It comes bundled with ''polymake'', so there is no need to install extra software, except for the MongoDB.pm perl package. If you encounter any errors or problems concerning polyDB, please don't hesitate to [[https://forum.polymake.org/|ask in the forum]]. | The polyDB extension provides access to the [[:polydb|polyDB database]]. It comes bundled with ''polymake'', so there is no need to install extra software, except for the MongoDB.pm perl package. If you encounter any errors or problems concerning polyDB, please don't hesitate to [[https://forum.polymake.org/|ask in the forum]]. |
| |
| (For the new version of polyDB see [[user_guide:howto:polydb_tutorial|here]] (currently only for developers, will be released soon). |
===== The polymake database ===== | ===== The polymake database ===== |
| |
The database is hosted on the polymake server (at [[http://db.polymake.org|db.polymake.org]], where you also find a web interface). The objects are arranged in collections which reside in so-called databases. See [[../data|here]] for a list of available databases and collections. | The database is hosted on the polymake server (at [[http://db.polymake.org|db.polymake.org]], where you also find a web interface). The objects are arranged in collections which reside in so-called databases. See [[:polydb|here]] for a list of available databases and collections. |
| |
From the polymake shell the function ''[[https://polymake.org/release_docs/latest/common.html#common__db_info__284|db_info]]'' prints information about available databases and collections. | From the polymake shell the function ''[[https://polymake.org/release_docs/latest/common.html#common__db_info__284|db_info]]'' prints information about available databases and collections. |
gives polytopes with 12 edges (the entry at position one of the f-vector). | gives polytopes with 12 edges (the entry at position one of the f-vector). |
| |
For more sophisticated querying see the [[user_guide:poly_db_tutorial#advanced_queries|section on advanced queries]]. | For more sophisticated querying see the [[user_guide:howto:poly_db_tutorial#advanced_queries|section on advanced queries]]. |
| |
| |
=== db_query === | === db_query === |
| |
Note that you should **not** use this function if you expect a large number of objects to match your search criteria. ([[https://polymake.org/release_docs/latest/common.html#common__db_count__285|Check this with db_count]].) In this case create a DatabaseCursor instead, as explained [[user_guide:poly_db_tutorial#using_a_databasecursor|here]]. | Note that you should **not** use this function if you expect a large number of objects to match your search criteria. ([[https://polymake.org/release_docs/latest/common.html#common__db_count__285|Check this with db_count]].) In this case create a DatabaseCursor instead, as explained [[user_guide:howto:poly_db_tutorial#using_a_databasecursor|here]]. |
| |
The function ''[[https://polymake.org/release_docs/latest/common.html#common__db_query__283|db_query]]'' expects a query, and as options a database and a collection name. The following code returns an Array<LatticePolytope> of all 3-dimensional polytopes in our collection of smooth reflexive lattice polytopes. | The function ''[[https://polymake.org/release_docs/latest/common.html#common__db_query__283|db_query]]'' expects a query, and as options a database and a collection name. The following code returns an Array<LatticePolytope> of all 3-dimensional polytopes in our collection of smooth reflexive lattice polytopes. |
Note that (depending on server capacity and network speed) this may take a while. Sometimes it might even result in a time out. In this case just try again (and feel free to contact us if the problem persists). | Note that (depending on server capacity and network speed) this may take a while. Sometimes it might even result in a time out. In this case just try again (and feel free to contact us if the problem persists). |
| |
Check the [[user_guide:poly_db_tutorial#custom_variables|section on custom variables]] to omit having to enter ''db'' and ''collection'' on every query. | Check the [[user_guide:howto:poly_db_tutorial#custom_variables|section on custom variables]] to omit having to enter ''db'' and ''collection'' on every query. |
| |
Now we can browse through the elements of ''$a'' and inspect their properties, e.g.: | Now we can browse through the elements of ''$a'' and inspect their properties, e.g.: |