Thesaurus term web services
Several web services provide information from the USGS Thesaurus and related controlled vocabularies in JSONP format. These services enable web pages to obtain detailed information about thesaurus terms for use in dynamic web interfaces. An example web page making use of these services is at https://apps.usgs.gov/thesaurus/tab-term.html
Services available
Named Instances
Thesaurus info
Provides a list of thesauri available through these services, with detailed information about each thesaurus.
Service URL | https://apps.usgs.gov/thesaurus/thesaurus.php | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||||||||||||||||||||||||||||
Output |
An object containing information about the thesaurus, if thcode was specified, otherwise an array of such objects, one per thesaurus.
|
Example
(line breaks and extra spaces added here for clarity)
https://apps.usgs.gov/thesaurus/thesaurus.php?thcode=2
Term search
Supports the jQuery autocomplete function, returning an array of objects describing thesaurus terms that begin with, end with, or contain the given text. The match is not case sensitive.
Service URL | https://apps.usgs.gov/thesaurus/term-search.php | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||||||
Output |
An array of objects, each containing the following members:
|
Special cases
- If no term is given, the service returns an empty array: https://apps.usgs.gov/thesaurus/term-search.php
- If a percent sign is specified as the term, the service returns all of the terms in the given thesaurus alphabetically: https://apps.usgs.gov/thesaurus/term-search.php?thcode=2&term=%
Example
(line breaks and extra spaces added here for clarity)
https://apps.usgs.gov/thesaurus/term-search.php?term=con
Term details
Provides detailed information about a given thesaurus term, which may be specified by its unique identifier or by the text of its descriptor. If a text is given as input and the text matches a USE-WITH term, the result will be an array describing the two descriptors to which the USE-WITH term applies.
Service URL | https://apps.usgs.gov/thesaurus/term.php | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||||||||||
Output |
A single object or an array of two objects containing the following members:
|
Special cases
- If no parameters are given, the service returns an array of objects describing the thesauri that are available in the current database instance: https://apps.usgs.gov/thesaurus/term.php
- If a valid thesaurus code is given but neither a term code nor a descriptor is given, the root node of the thesaurus will be returned: https://apps.usgs.gov/thesaurus/term.php?thcode=2
- If a text given as input matches a USE-WITH term, an array of descriptors will be returned, each as described for a single term, above. https://apps.usgs.gov/thesaurus/term.php?thcode=2&text=oil%20spills
- If a pair of terms is given as input with " AND " between them, the two terms are matched separately and an array of descriptors will be returned, each as described for a single term, above. https://apps.usgs.gov/thesaurus/term.php?thcode=2&text=industrial%20pollution%20AND%20petroleum
Example
https://apps.usgs.gov/thesaurus/term.php?code=769
Term Like
Search a thesaurus to find terms that begin with, end with, or contain a text that you supply. Returns JSON or JSONP.
Service URL | https://apps.usgs.gov/thesaurus/term-like.php | ||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Output |
A single object containing the following members:
|
Example
https://apps.usgs.gov/thesaurus/term-like.php?thcode=2&text=oil
Named instances
Provides information about specific named things (for example events, geographic features, products) that would not be included in the thesaurus because they are not a type of thing. Each named thing is associated with one or more descriptors from any of the thesauri that we use, and a qualifying term is used to categorize the relationship.
Service URL | https://apps.usgs.gov/thesaurus/inst.php | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||
Output |
A single object containing the following members:
|
Special cases
- If no parameters are given, the service returns an array of named things for which we have related terms. https://apps.usgs.gov/thesaurus/inst.php
Example
https://apps.usgs.gov/thesaurus/inst.php?name=Mount%20St.%20Helens
Search pattern
Provides a text search pattern for a given thesaurus term.
Service URL | https://apps.usgs.gov/thesaurus/search-pattern.php | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||
Output |
An object containing information about the descriptor and texts that may be used as the pattern for searching.
|
Example
(line breaks and extra spaces added here for clarity)
https://apps.usgs.gov/thesaurus/search-pattern.php?thcode=2&code=769