STW Web Services (beta)

Version 0.30

As the publisher of the STW Thesaurus for Economics, the German National Library of Economics (ZBW) provides experimental thesaurus web services for use by humans and by machines. In the first instance these services are designed to support query expansion in the context of information retrieval applications.

General Concepts

The services follow the REST design principles.

All services uniformly support the HTTP GET method.

Service Descriptions for Basic Services

/concepts - Search for Thesaurus Concepts

Returns all concepts (by default of subtype zbwext:Descriptor only), where the search term matches prefLabel or altLabel.

Example: http://zbw.eu/beta/stw-ws/concepts?query=audit

Parameters: query, lang, concept_type (NYI)

/narrower - Narrower Concepts for a Concept

Returns the narrower concepts of the given concept (by default descriptors only), supplemented with the preferred label in English (default) or German.

Example: http://zbw.eu/beta/stw-ws/narrower?concept=http://zbw.eu/stw/descriptor/12882-1

Parameters: concept, lang, concept_type (NYI)

/labels - All Labels for a Concept

Returns prefLabel and altLabels of a given concept.

Example: http://zbw.eu/beta/stw-ws/labels?concept=http://zbw.eu/stw/descriptor/19160-4

Parameters: concept, lang

Service Descriptions for Convenience Services

These services combine basic services to offer convenient access to often used functions. (Sometimes less flexible, because fixed defaults may be used.)

/synonyms - Alternative Terms for a Search Term (From Matching Labels)

Returns the alternative search terms, by
1. searching the given term within the preferred and alternate labels of all descriptors,
2. returning all preferred and alternate labels of these descriptors
(not restricted to a certain language).

(Combination of /concepts and /labels.)

Example: http://zbw.eu/beta/stw-ws/synonyms?query=environmental+audit

Parameters: query

/suggest - Suggestions for Descriptors (starting with a given string)

Returns for a query string every matching term (alt or prefered labels, right truncated), the prefered label in the selected language and the URI, ordered by term. Result is currently limited to 10 entries and sparql-json output format. (For an example for use in a Javascript application see the autosuggest incremental search service on the STW web site.)

Example:
http://zbw.eu/beta/stw-ws/suggest?query=acc
http://zbw.eu/beta/stw-ws/suggest?dataset=jel&query=acc

Parameters: query, dataset, lang, limit (NYI), callback

/combined1 - Combined Info for Retrieval Applications

Returns for a query string
1. concepts with matching labels (matching is done via a lucene 'or' query against every single label). Results are returned in order of descending scores. Number of results is limited to number of words or less.
2. narrower concepts of the matched concepts
3. related concepts of the matches concepts
4. pref_labels for all concepts
5. alt_labels for all concepts
Can be restricted to only one relationship
Result is currently limited to sparql-json output format. ?score doesn't work yet.

Example: http://zbw.eu/beta/stw-ws/combined1?query=free+trade+zone

Parameters: query, relationship callback

Common Parameters

dataset

stw (default)
STW Thesaurus for Economics
thesoz
Thesaurus for the social sciences by GESIS - Leibniz Institute for the Social Sciences
jel
Journal of Economic Literature (JEL) Classification System by American Economic Association (not yet publicly available)

lang

en (default)
de

output

Equivalent to "Content-Type" HTTP Request Parameter (NYI). When definded, "output=" takes precedence.

html (default)
returns a human readable HTML page (by xml + xslt stylesheet)
Content-Type: application/xml; charset=UTF-8
sparql-xml
returns SPARQL results in XML, according to the W3C Recommendation SPARQL Query Results XML Format
Content-Type: Content-Type: application/sparql-results+xml
sparql-json
returns SPARQL results in JSON, according to the W3C Note Serializing SPARQL Query Results in JSON
Content-Type: application/sparql-results+json; charset=utf-8

format

deprecated - please use output

concept

URI of the Concept

query

Search String, URI-escaped if necessary. Presently, exact (though case-insensitive) matches are performed.

concept_type

descriptor (default)
Only concepts from the descriptors part of the STW (zbwext:Descriptor)
thsys
Only concepts from the systematic part of the STW (zbwext:Thsys)
all
All STW sub-types of skos:Concept

relationship

broader / narrower / related
Include descriptors with skos:broader, skos:narrower, skos:related relationships to matching descriptors

limit

maximal number of results

callback (experimental)

Name of a (Javascript) callback routine to wrap the result (only for JSON output format).
Currently works only with "/suggest" and "/combined1".

Error Handling

Error handling is still quite rudimental. In case of a client side error, HTTP response code 400 ("Bad Request") and a short message are returned.

Implementation

The beta version is implemented using Joseki SPARQL server (from the Jena toolkit) and a simple PHP wrapper. A SPARQL Endpoint (http://zbw.eu/beta/sparql) is available also. It is powerd by sparqlite and based on Jena and LARQ. This one is used for the /combined1 service.

Comments, queries and suggestions are greatly appreciated.

Changes

0.30
added relationship parameter (for /combined1)
0.29
/suggest extended to TheSoz vocabulary
0.28
added dataset parameter; /suggest extended to JEL vocabulary; new output parameter (format deprecated now)
0.27
experimental /combined1 service added; link to SPARQL Endpoint
0.26
experimental callback parameter
0.25
links to zbwext vocab; typos
0.24
basic /suggest service added
0.23
first public version