Difference between revisions of "Examples of querying the CSDMS model repository"

From CSDMS
 
Line 6: Line 6:
|-
|-
| List all models created by the user with the last name Tucker
| List all models created by the user with the last name Tucker
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BLast+name::Tucker%5D%5D&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Last+name::Tucker]]&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BLast+name::Tucker%5D%5D&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Tucker]]&format=json</nowiki>]
|-
|-
| List all models written in C
| List all models written in C
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BProgramming%20language::C%5D%5D&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Programming%20language::C]]&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BProgramming%20language::C%5D%5D&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming%20language::C]]&format=json</nowiki>]
|-
|-
| Really list all models written in C
| Really list all models written in C
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BProgramming%20language::C%5D%5D%7Climit=10000&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Programming%20language::C]]|limit=10000&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BProgramming%20language::C%5D%5D%7Climit=10000&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming%20language::C]]|limit=10000&format=json</nowiki>]
|-
|-
| List all models from user Tucker written in C
| List all models from user Tucker written in C
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BLast+name::Tucker%5D%5D%5B%5BProgramming+language::C%5D%5D&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Last+name::Tucker]][[Programming+language::C]]&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BLast+name::Tucker%5D%5D%5B%5BProgramming+language::C%5D%5D&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Tucker]][[Programming+language::C]]&format=json</nowiki>]
|-
|-
| List the first three models written by user Hutton
| List the first three models written by user Hutton
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BLast+name::Hutton%5D%5D%7Climit=3&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Last+name::Hutton]]|limit=3&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BLast+name::Hutton%5D%5D%7Climit=3&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Hutton]]|limit=3&format=json</nowiki>]
|-
|-
| List five models written in C, starting at item 20 from the full list
| List five models written in C, starting at item 20 from the full list
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BProgramming+language::C%5D%5D%7Climit=5%7Coffset=20 <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Programming+language::C]]|limit=5|offset=20</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BProgramming+language::C%5D%5D%7Climit=5%7Coffset=20 <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming+language::C]]|limit=5|offset=20</nowiki>]
|-
|-
| Search for models written a nonexistent programming language to see an error message
| Search for models written a nonexistent programming language to see an error message
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BProgramming+language::xxyyzz%5D%5D&format=jsonfm <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Programming+language::xxyyzz]]&format=jsonfm</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BProgramming+language::xxyyzz%5D%5D&format=jsonfm <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming+language::xxyyzz]]&format=jsonfm</nowiki>]
|-
|-
| Find terrestrial models
| Find terrestrial models
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BCategory:Terrestrial%5D%5D&format=jsonfm <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Category:Terrestrial]]&format=jsonfm</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BCategory:Terrestrial%5D%5D&format=jsonfm <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Category:Terrestrial]]&format=jsonfm</nowiki>]
|-
|-
| Locate a model by name
| Locate a model by name
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BModel:HydroTrend%5D%5D&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Model:HydroTrend]]&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BModel:HydroTrend%5D%5D&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Model:HydroTrend]]&format=json</nowiki>]
|-
|-
| List all models written in Fortran 77 or Fortran 90
| List all models written in Fortran 77 or Fortran 90
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BProgramming%20language::Fortran77%7C%7CFortran90%5D%5D%7Climit=10000&format=json <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Programming%20language::Fortran77||Fortran90]]|limit=10000&format=json</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BProgramming%20language::Fortran77%7C%7CFortran90%5D%5D%7Climit=10000&format=json <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming%20language::Fortran77||Fortran90]]|limit=10000&format=json</nowiki>]
|-
|-
| Find all models written by user Hutton, including (if available) the DOI and the source code repository for each model
| Find all models written by user Hutton, including (if available) the DOI and the source code repository for each model
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BLast+name::Hutton%5D%5D%7C?DOI+model%7C?Source+web+address&format=jsonfm <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Last+name::Hutton]]|?DOI+model|?Source+web+address&format=jsonfm</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BLast+name::Hutton%5D%5D%7C?DOI+model%7C?Source+web+address&format=jsonfm <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Hutton]]|?DOI+model|?Source+web+address&format=jsonfm</nowiki>]
|-
|-
| List all models (Category technique) '''depreciated'''
| List all models (Category technique) '''depreciated'''
| [https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=%5B%5BCategory:Terrestrial%7C%7CCoastal%7C%7CMarine%7C%7CHydrology%7C%7CCarbonates%5Fand%5FBiogenics%7C%7CClimate%5D%5D%7Climit=10000&format=jsonfm <nowiki>https://csdms.colorado.edu/mediawiki/api.php?action=ask&query=[[Category:Terrestrial||Coastal||Marine||Hydrology||Carbonates and Biogenics||Climate]]|limit=10000&format=jsonfm</nowiki>]
| [https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=%5B%5BCategory:Terrestrial%7C%7CCoastal%7C%7CMarine%7C%7CHydrology%7C%7CCarbonates%5Fand%5FBiogenics%7C%7CClimate%5D%5D%7Climit=10000&format=jsonfm <nowiki>https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Category:Terrestrial||Coastal||Marine||Hydrology||Carbonates and Biogenics||Climate]]|limit=10000&format=jsonfm</nowiki>]
|}
|}


Python examples of these queries (and others) can be found in the GitHub repository https://github.com/csdms/ask-api-examples.
Python examples of these queries (and others) can be found in the GitHub repository https://github.com/csdms/ask-api-examples.

Latest revision as of 16:50, 14 October 2021

Here are some examples of queries into the CSDMS model repository.

Description Query URL
List all models created by the user with the last name Tucker https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Tucker]]&format=json
List all models written in C https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming%20language::C]]&format=json
Really list all models written in C https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming%20language::C]]|limit=10000&format=json
List all models from user Tucker written in C https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Tucker]][[Programming+language::C]]&format=json
List the first three models written by user Hutton https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Hutton]]|limit=3&format=json
List five models written in C, starting at item 20 from the full list https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming+language::C]]|limit=5|offset=20
Search for models written a nonexistent programming language to see an error message https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming+language::xxyyzz]]&format=jsonfm
Find terrestrial models https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Category:Terrestrial]]&format=jsonfm
Locate a model by name https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Model:HydroTrend]]&format=json
List all models written in Fortran 77 or Fortran 90 https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Programming%20language::Fortran77||Fortran90]]|limit=10000&format=json
Find all models written by user Hutton, including (if available) the DOI and the source code repository for each model https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Last+name::Hutton]]|?DOI+model|?Source+web+address&format=jsonfm
List all models (Category technique) depreciated https://csdms.colorado.edu/csdms_wiki/api.php?action=ask&query=[[Category:Terrestrial||Coastal||Marine||Hydrology||Carbonates and Biogenics||Climate]]|limit=10000&format=jsonfm

Python examples of these queries (and others) can be found in the GitHub repository https://github.com/csdms/ask-api-examples.