Help:Querying the database
More actions
This page documents the Semantic MediaWiki query tools available on Landrace.Wiki: how to filter accessions, news items, growing regions and other content by their stored properties. For full-text search, use Special:Search. For programmatic access, see Landrace.Wiki:API.
Special:Ask
Special:Ask is the main query interface. It has two boxes.
Conditions is what to find. Built from category memberships and property assignments. A condition like [[Category:Accessions]] on its own returns every accession page. Adding [[Has country::India]] below it narrows to Indian accessions. Multiple conditions combine with AND.
Printouts is what to show in the result. One line per property, prefixed with ?. Adding ?Has growing region shows the growing region for each accession in the result table.
Worked example
To find every Indian accession above 1500 m, sorted by elevation, showing the descriptive name and growing region:
Conditions:
India >1500">" is not declared as a valid unit of measurement for this property.
Printouts:
?Has descriptive name ?Has growing region ?Has elevation
Other options:
sort=Has elevation order=desc limit=50
Filtering by value
The exact match [[Has classification::Landrace]] returns pages where the property equals the value. The match is exact and case-sensitive.
Other patterns:
<1000matches values less than 1000 (works on Quantity, Number, Date).>2000matches values greater than 2000.500-1500matches a range.!Hybridmatches anything not equal to "Hybrid".+matches any value (the property is set to anything).~*charas*matches text containing "charas". Text properties only. Asterisks are wildcards.
The + wildcard is more useful than it first looks. [[Has elevation::+]] returns every page that has any elevation set. Negating it ([[Has elevation::!+]]) finds pages with no elevation recorded, which is the fast way to spot documentation gaps.
Combining conditions
Stacking conditions on separate lines combines them with AND. To combine values within a single property using OR, separate them with ||:
returns accessions in any of the three. Cross-property OR is possible but more involved, using OR grouping. For most casual queries it isn't needed.
Choosing the format
The default output is broadtable. Other useful formats:
format=listrenders a bulleted list of result page names.format=csvexposes a downloadable CSV via the link in the result box.format=maprenders a Leaflet map of any results carryingHas coordinates.format=countreturns just the count.
A query like [[Category:Accessions]] [[Has coordinates::+]] with format=map renders every mappable accession on a single map.
Practical examples
Each of these can be pasted into Special:Ask directly.
All landraces collected before 2024:
Landrace <2024-01-01 ?Has collection date ?Has country
Cambodian eradication news from the last year:
Cambodia Eradication"Eradication" is not in the list (Policy, Enforcement, Fieldwork, Research, Community, Report, Trafficking) of allowed values for the "Has event category" property. >2025-04-01 sort=Has event date order=desc
Highland accessions with a known descriptive name:
>1500">" is not declared as a valid unit of measurement for this property.
+
?Has descriptive name
?Has elevation
?Has growing region
sort=Has elevation
order=desc
Every accession lacking a growing region (gap audit):
!+ ?Has country ?Has province
Inline queries for editors
Templates and pages can embed live queries using parser functions.
{{#ask:[[Category:Accessions]][[Has country::India]]|?Has descriptive name|format=ul}}
renders as a bulleted list of Indian accession pages. The same condition syntax that works in Special:Ask works here, with parameters separated by |.
For a single-value lookup, use {{#show:}}:
{{#show:ZOM-IND-WEB-0620250014|?Has elevation}}
returns just the elevation of the named page, with no surrounding decoration. Useful inside infoboxes and other templates.
Editor notes:
- Always specify a category in the conditions, even if the property would otherwise be unique. It speeds up the query and protects against value collisions across page types.
- Add
link=noneto a printout to return plain text, e.g. for feeding into a second query. - Nested
{{#show:}}to follow a property chain (e.g. accession → growing region → regional complex) works but is fragile. If you do it, document it.
Other query interfaces
Special:SearchByProperty is the simpler form. Pick a property, enter a value, see matching pages. It does not combine conditions and is best for casual lookups against a single property.
Special:Browse is a single-page property dump. Useful for inspecting what's stored on one specific page rather than querying across many.
Special:Properties is the catalogue of every defined property in the wiki, with usage counts. Clicking a property opens its [[Property:]] page, which lists declared type and shows the live distribution of values.
Common pitfalls
"... was not understood". If the result box reports that a printout property "was not understood", the [[Property:]] page for that property doesn't exist yet. Create it with [[Has type::Text]] (or whichever type is correct) and null-edit affected content pages to force re-indexing. Purging the query page alone does nothing.
Category names are exact. [[Category:Growing Area]] and [[Category:Growing Areas]] are not the same category. The wrong one returns zero results silently, with no warning.
Some properties are overloaded. Has conservation priority is set on both accession and growing region pages with incompatible value domains: Critical / High / Medium / Low for accessions, Stable / Vulnerable / Endangered / Critical / Extinct / Unknown for regions. Always filter by category first when querying this property, or you'll mix the two.
Coordinates are jittered. Every Has coordinates value on this wiki is jittered to approximately 500 m precision under the privacy policy. CSV exports return the jittered values, not the source coordinates.
Results are cached for an hour. If you've just edited a page and the query result hasn't updated, append &_ts=1 to the Special:Ask URL to force a fresh query.
See also
- Landrace.Wiki:API for programmatic access to the same data
- Special:Properties for the full property catalogue
- Special:Ask for the live query interface
- Semantic MediaWiki: Inline queries (upstream documentation)
- Semantic MediaWiki: Selecting pages (upstream documentation)