GEMET's Web services

GEMET's data is exposed through the Web for remote applications using XML (RDF/SKOS), HTTP and XML/RPC. The XML output is available at http://www.eionet.europa.eu/gemet/rdf.

API for XML/RPC and HTTP

The following set of functions can be called by a Web application or Web page using either HTTP, where the parameters are specified in the query string or via XML/RPC. A combination of such function calls ensure the full retrieval of GEMET's content.

searchForConcepts

Description: for each term in the list terms list, this function searches the GEMET content looking for matches. The level indicates the type of term expansion to try when looking for a match

Signature:

	searchForConcepts(termList, lang, level)
Parameters
termList - list of strings representing concepts or parts of concepts
level - integer in the range 0 – 5 inclusive:
	0 – no wildcarding of any type match 'clothes')
	1 – suffix regex ('accident' becomes 'accident.+$')
	2 – prefix regex ('accident' becomes '^.+accident')
	3 – prefix/suffix combined ('accident' becomes '^.+accident.+$')
	4 – auto search: each of the previous four expansions is tried in ascending order until a match is found.
lang - string that indicates the language code

Result A two element struct of (results, statusCode). results is an array of 0 or more concepts.
{ 'results':ARRAY, 'statusCode':X }

Example call in Python:

	termList = ['accident', 'economic', 'water']
	lang = 'en'
	results = searchForConcepts(termList, lang, 0)

fetchConcepts

Description: for each name/scope pair in 'nameScopeList', returns the matching concept with attributes matching those specified in 'attributes'. By default, 'name' and 'scope' are always returned, in addition to whatever else attributes specifies.

Signature:

	fetchConcepts(nameScopeList, attributes, lang)
Parameters
nameScopeList - list of pairs (concept_name, concept_scope)
attributes - list of strings specifying concept specific attributes
lang - string that indicates the language code

Note: the special keyword 'ALL' is still passed as a single-element array.
Result A two element struct of (results, statusCode). results is an array of 0 or more concepts.
	{'results':ARRAY, 'statusCode':X}

Example call in Python:

    attributes = ['bt', 'nt', 'rt', 'use', ] or ['ALL'] or ['all']
    nameScopeList = [ {'name':'accident source','scope':'accident'},
        {'name':'armament conversion', 'scope':'international safety'} ]
    lang = 'en'
    results = fetchConcepts(nameScopeList, attributes, lang)

fetchHier

Description: for the specified name/scope, this function returns an array of concepts in the direction specified and to the level specified or to the end of the hierarchy.

Signature:

	fetchHier(nameScope, level, direction, lang)
Parameters
nameScope - pair (concept_name, concept_scope)
level - integer specifying the depth to go in the hierarchy (default value 1)
		A level of 0 is a request to return all concepts to the end of the hierarchy.
direction - string indicating the direction in the hierarchy (up or down); possible value: 'parents', 'children'
lang - string that indicates the language code
Result A two element struct of (results, statusCode). results is an array of 0 or more concepts.

Example call in Python:

    nameScope = {'name':'air safety','scope':'safety measure'}
    level=2
    direction='parents'
    lang = 'en'
    fetchHier(nameScope, level, direction, lang)

fetchSiblings

Description: returns all the children of all the parents of the terms specified in the 'nameScopeList' parameter.

Signature:

	fetchSiblings(nameScopeList, attributes, lang)
Parameters
nameScopeList - list of pairs (concept_name, concept_scope)
attributes - list of strings specifying concept specific attributes
lang - string that indicates the language code
Result The standard two element array of (results, successIndicator) where 'results' is an array of concepts.

Example call in Python:

    attributes = ['bt', 'nt', 'rt', 'use', ] or ['ALL'] or ['all']
    nameScopeList = [ {'name':'accident source','scope':'accident'},
        {'name':'armament conversion', 'scope':'international safety'} ]
    lang = 'en'
    results = fetchSiblings(nameScopeList, attributes, lang)

fetchConceptsById

Description: return the matching concepts with attributes matching those specified in 'attributes'.

Signature:

	fetchConceptsById(ids, attributes, lang)
Parameters
ids - list of concept IDs
attributes - list of strings specifying concept specific attributes
lang - string that indicates the language code
Result A two element struct of (results, statusCode) where 'results' is the list of GEMET's concepts in the specified language.

fetchTopConcepts

Description: return all top concepts.

Signature:

	fetchTopConcepts(lang)
Parameters
lang - string that indicates the language code
Result A two element struct of (results, statusCode) where 'results' is the list of GEMET's top concepts in the specified language.

fetchThemes

Description: retrieves the list of themes from the GEMET's database.

Signature:

	fetchThemes(lang)
Parameters
lang - string that indicates the language code
Result A two element struct of (results, statusCode) where 'results' is the list of GEMET's themes in the specified language.

fetchGroups

Description: retrieves the list of groups from the GEMET's database.

Signature:

	fetchGroups(lang)
Parameters
lang - string that indicates the language code
Result A two element struct of (results, statusCode) where 'results' is the list of GEMET's groups in the specified language.
2004 GEMET Thesaurus version 1.0