Searching/Querying
Searching
- Searches are by "keyword in heading"; left-anchored search results appear first, followed by keyword results.
- Asterisk (*) wildcards may be used to truncate a term on the right.
Because searches are left-anchored, the beginning (or left) part of the query must be explicitly specified instead of using a wildcard character. The asterisk (*) wildcard character may be used to truncate a search term.
For example, a search for "action*" will return:
- "Action in art"
- ActionScript
- etc.
However, a search for "*action" or "*action*" will fail to return results.
Known-label retrieval
If you have a known label or heading but are unsure of its URI, it is possible to arrive at the true URI by using the label functionality provided in the Authorities and Vocabularies service. For instance, if your label or heading is "Orchids", use this URI to obtain a HTTP 302 FOUND message with a redirection to the established URI:
The URI syntax for the label functionality is to use the token "label/", followed by a case-insensitive string for the search term.
-
http://id.loc.gov/authorities/label/{term}
Do not place a trailing slash on the known label or heading. Also, stemming, truncation, etc., is not functional, so wildcard characters such as the asterisk (*) or the percent sign (%) should not appear within the string unless they are part of the stored heading or label. The entire string must match a label or heading stored within the system.
If the label functionality does not properly match the string provided, a HTTP 404 Not Found message will be returned. If your label possesses a character outside the American Standard Code for Information Interchange (ASCII)
range of 128 characters, it is strongly advised to URL-encode
your string prior to sending the request. Browsers such as Safari and Firefox do this automatically, whereas Internet Explorer will not always do so. For example, the URL encoded representation for:
-
Bărăganul (Romania)
is:
-
B%C4%83r%C4%83ganul%20%28Romania%29
If multiple concepts with the same label are found within the database, the system will only returned the first concept it finds with that label. Hits are ordered alphabetically by the last token of the URI. For Library of Congress Subject Headings, this token is the Library of Congress Control Number, such as "sh85095334".
OpenSearch support
The Authorities and Vocabularies service supports OpenSearch
querying, responses, and autodiscovery. OpenSearch is typically supported within most recent browsers such as Firefox 2 and 3, Internet Explorer 7 and 8, etc. When the browser discovers the OpenSearch functionality for this service, the site can be queried directly from the browser's included search bar without having to actually visit our web site.
Querying
No tool for querying the backend RDF is provided in this release. If you need to perform custom queries for more detailed analysis of our data, please download the bulk metadata: RDF/XML or N-Triples. Once downloaded, it's possible to use the data in any number of SPARQL-aware
engines, such as Sesame
or Joseki
.
If you are querying against the RDF/XML serialization of the data, XSPARQL
is a technology that combines aspects of the XQuery
language and SPARQL into the same syntax. Similarly, XSLT+SPARQL
from Diego Berrueta allows SPARQL interaction via XSLT
.