Sample Queries

Revision as of 15:52, 13 February 2020 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

These queries illustrate the power of the Semantic MediaWiki query language ("semantic search") and the Semantic MediaWiki query interfaces to extract data stored by the Flora of North America Semantic MediaWiki.

Click here to access the Semantic search query interface directly.

Queries by Subject

Taxonomy

Properties Used Query Syntax Query Interface Query Results Query the API
All Taxa in the Online FNA Taxon rank (see allowed values) [[Taxon rank::+]] Try it! R script

Python script

All Species in the Online FNA Taxon rank (see allowed values) [[Taxon rank::species]] Try it! R script

Python script

List of Lower Taxa Taxon parent [[Taxon parent::Carex]] Try it! In the genus Carex,... further results R script

Python script

List of Sections Taxon family (see allowed values)

Taxon rank (see allowed values)

[[Taxon family::Asteraceae]][[Taxon rank::section]] Try it! Sections in the family Asteraceae,... further results R script

Python script

Distribution

Properties Used Query Syntax Query Interface Query Results Query the API
Taxa occurring in Non-Abbreviated State or Province (i.e., Alaska, Idaho, Iowa, Maine, Nunavut, Ohio, Yukon) Distribution (see allowed values and Distribution Abbreviations) [[Distribution::Nunavut]] Try it! Taxa occurring in Nunavut,... further results R script

Python script

Taxa occurring in Abbreviated State or Province Distribution (see allowed values and Distribution Abbreviations) [[Distribution::Ont.]] Try it! Taxa occurring in Ontario,... further results R script

Python script

Publication Details

Properties Used Query Syntax Query Interface Query Results Query the API
Taxa by Authority Authority [[Authority::Linnaeus]] Try it! Taxa described by Linnaeus,... further results R script

Python script

Taxa by Publication Title Publication title [[Publication title::Proc. Amer. Acad. Arts]] Try it! R script

Python script

Taxa by Publication Year Publication year [[Publication year::1990]] Try it! R script

Python script

You can use comparators with the Publication year property. For example,

Taxa by Publication Year with Comparator Publication year [[Publication year::>>1990]] Try it! Taxa published after 1990,... further results R script

Python script

Special Status

Due to limitations in data capture, special status data are only available in V3, V6, V9, V12, V17, V28.

Properties Used Query Syntax Query Interface Query Results Query the API
Taxa by Special Status Special status (see allowed values) [[Special status::Introduced]] Try it! Introduced species,... further results R script

Python script

Illustrations

Properties Used Query Syntax Query Interface Query Results Query the API
All Illustrated Taxa in the Online FNA Illustrator (see allowed values)

Illustration

[[Illustrator::+]][[Illustration::Present]] Try it! R script

Python script

List of Illustrations by Person Illustrator (see allowed values)

Illustration

[[Illustrator::Annaliese Miller]][[Illustration::Present]] Try it! Illustrations by Annaliese Miller,... further results R script

Python script

Volumes

Properties Used Query Syntax Query Interface Query Results Query the API
Treatments By Volume Volume (see allowed values) [[Volume::Volume 17]] Try it! Treatments published in volume 17,... further results R script

Python script

Contributors

Properties Used Query Syntax Query Interface Query Results Query the API
Treatments by Author Author [[Author::Bruce A. Ford]] Try it! Treatments authored by Bruce A. Ford,... further results R script

Python script

Morphology

A property browser is in development to facilitate the exploration of the morphological properties. Here are a few sample queries to illustrate the power of parsed morphological data derived from FNA treatments.

Properties Used Query Syntax Query Interface Query Results Query the API
Taxa by corolla coloration Corolla coloration (explore available values) [[Corolla coloration::yellow]] Try it! Taxa with yellow corolla coloration, R script

Python script

Taxa by leaf arrangement Leaf arrangement (explore available values) [[Leaf arrangement::alternate]] Try it! Taxa with alternate leaf arrangement, R script

Python script

Taxa by blade shape Blade shape (explore available values) [[Blade shape::elliptic]] Try it! Taxa with elliptic blade shape, R script

Python script

Advanced Queries

Composite Queries

You can combine any query elements from the above subjects to create a custom search.

For example,

Taxa with authority Linnaeus that occur in Nunavut [[Authority::Linnaeus]][[Distribution::Nunavut]]
Introduced species published in volume 3 [[Special status::Introduced]][[Volume::Volume 3]]
Taxa published before 1754 in the family Cyperaceae [[Publication year::<<1754]][[Taxon family::Cyperaceae]]

Comparators

You can use comparators with the Publication year property. (e.g., >, <, ).

Return More Information

You can return as many additional properties as you wish:

Query interface Query the API
Add property names to the Additional data to display box Add properties using the |? syntax:

[[Authority::Linnaeus]][[Distribution::Nunavut]]|?Taxon family|?Taxon rank|?Author

Write Your Own Queries

Click here to access the Semantic search query interface directly.

Note that:

  • The limit on the number of results returned can be changed
  • You can only export what is displayed on the page (JSON, CSV, RSS, RDF)
    • Page through the results to download each batch

Why use the API convenience scripts?

  1. For big queries, it may be cumbersome to download each batch of 500 results separately and then merge the results.
  2. If you are performing your analyses in R or Python, you may wish to embed the data extraction here, so that it can be easily re-run.

Access the convenience scripts here: https://github.com/jocelynpender/fna-query

Query Resources

Semantic MediaWiki Query Syntax

https://www.semantic-mediawiki.org/wiki/Help:Semantic_search

https://www.semantic-mediawiki.org/wiki/Help:Search_operators

Merging Multiple CSV Files

R script for merging multiple CSV files.

Working with APIs

Convenience scripts

https://github.com/jocelynpender/fna-query

Python

https://mwclient.readthedocs.io/en/latest/index.html

R

https://cran.r-project.org/web/packages/WikipediR/WikipediR.pdf