isogeo_pysdk.api.routes_keyword module
Isogeo API v1 - API Routes for Keywords entities
See: http://help.isogeo.com/api/complete/index.html
- class isogeo_pysdk.api.routes_keyword.ApiKeyword(api_client=None)
Bases :
objectRoutes as methods of Isogeo API used to manipulate keywords.
- associate_workgroup(workgroup, keyword, check_exists=1)
Associate a keyword to a workgroup.
- Paramètres:
- Example:
- Type renvoyé:
# retrieve a workgroup wg = isogeo.workgroup.get(WORKGROUP_UUID) # retrieve a keyword kw = isogeo.keyword.get(KEYWORD_UUID) # associate a keyword to a workgroup isogeo.keyword.associate_workgroup(workgroup = wg, keyword = kw)
- create(keyword, thesaurus_id='1616597fbc4348c8b11ef9d59cf594c8', check_exists=0)
Add a new keyword to the Isogeo thesaurus.
If a keyword with the same text already exists, the Isogeo API returns a 409 HTTP code. Then this method will try to get the closest matching keyword and return it.
- delete(keyword, thesaurus_id='1616597fbc4348c8b11ef9d59cf594c8')
Delete a keyword from Isogeo database.
- dissociate_workgroup(workgroup, keyword, check_exists=1)
Dissociate a keyword from a workgroup.
- Paramètres:
- Example:
- Type renvoyé:
# retrieve a workgroup wg = isogeo.workgroup.get(WORKGROUP_UUID) # retrieve a keyword kw = isogeo.keyword.get(KEYWORD_UUID) # dissociate a keyword to a workgroup isogeo.keyword.dissociate_workgroup(workgroup = wg, keyword = kw)
- get(keyword_id, include=('_abilities', 'count', 'thesaurus'), lang=None)
Get details about a specific keyword.
- Paramètres:
- Example:
>>> # get a metadata with its tags (or keywords) >>> md = isogeo.metadata.get(METADATA_UUID, include=("tags",)) >>> # list Isogeo keywords >>> li_keywords_uuids = [ tag[8:] for tag in self.metadata_source.tags if tag.startswith("keyword:isogeo:") ] >>> # pick a random one :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~isogeo\_pysdk.models.keyword.Keyword\`` >>> random_keyword = sample(li_keywords_uuid, 1)[0] >>> # get its details >>> keyword = isogeo.keyword.get(random_keyword)
- get_from_text(text, thesaurus_id='1616597fbc4348c8b11ef9d59cf594c8', include=('_abilities', 'count', 'thesaurus'), lang=None)
Get details about a specific keyword.
- Paramètres:
- Example:
>>> # get a metadata with its tags (or keywords) >>> md = isogeo.metadata.get(METADATA_UUID, include=("tags",)) >>> # list Isogeo keywords >>> li_keywords_uuids = [ tag[8:] for tag in self.metadata_source.tags if tag.startswith("keyword:isogeo:") ] >>> # pick a random one :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`list\`` >>> random_keyword = sample(li_keywords_uuid, 1)[0] >>> # get its details >>> keyword = isogeo.keyword.get(random_keyword)
- metadata(metadata_id=None, include=('_abilities', 'count', 'thesaurus'), lang=None)
List a metadata’s keywords with complete information.
- async search_keyword_asynchronous(total_results, max_workers=10, **kwargs)
Meta async method used to request big searches (> 100 results), using asyncio. It’s a private method launched by the main search method.
- Paramètres:
- Type renvoyé:
- tagging(metadata, keyword, check_exists=0)
Associate a keyword to a metadata.
- Paramètres:
- Example:
- Type renvoyé:
# retrieve a metadata md = isogeo.metadata.get(METADATA_UUID) # retrieve a keyword kw = isogeo.keyword.get(KEYWORD_UUID) # associate a keyword to a metadata isogeo.keyword.tagging(metadata = md, keyword = kw)
- thesaurus(thesaurus_id='1616597fbc4348c8b11ef9d59cf594c8', query='', offset=0, order_by='text', order_dir='desc', page_size=100, specific_md=[], specific_tag=[], include=('_abilities', 'count'), whole_results=True, lang=None)
Search for keywords within a specific thesaurus.
- Paramètres:
thesaurus_id (str) – thesaurus UUID
query (str) – search terms, equivalent of q parameter in API.
offset (int) – offset to start page size from a specific results index
order_by (str) –
sorting results. Available values:
”count.isogeo”: count of associated resources within Isogeo
’text”: alphabetical order [DEFAULT if relevance is null]
order_dir (str) –
sorting direction. Available values:
”desc”: descending [DEFAULT]
”asc”: ascending
page_size (int) – limits the number of results. Default: 100.
specific_md (list) – list of metadata UUIDs to filter on
specific_tag (list) – list of tags UUIDs to filter on
include (tuple) –
subresources that should be returned. Available values:
”_abilities”
”count”
”thesaurus”
whole_results (bool) – option to return all results or only the page size. False by DEFAULT.
- Type renvoyé:
- untagging(metadata, keyword)
Dissociate a keyword from a metadata.
- workgroup(workgroup_id=None, thesaurus_id=None, query='', offset=0, order_by='text', order_dir='desc', page_size=100, specific_md=[], specific_tag=[], include=('_abilities', 'count', 'thesaurus'), whole_results=True, lang=None)
Search for keywords within a specific group’s used thesauri.
- Paramètres:
thesaurus_id (str) – thesaurus UUID to filter on
query (str) – search terms, equivalent of q parameter in API.
offset (int) – offset to start page size from a specific results index
order_by (str) –
sorting results. Available values:
”count.group”: count of associated resources within the specified group
’count.isogeo”: count of associated resources within Isogeo
’text”: alphabetical order [DEFAULT]
order_dir (str) –
sorting direction. Available values:
”desc”: descending [DEFAULT]
”asc”: ascending
page_size (int) – limits the number of results. Default: 100.
specific_md (list) – list of metadata UUIDs to filter on
specific_tag (list) – list of tags UUIDs to filter on
include (tuple) –
subresources that should be returned. Available values:
”_abilities”
”count”
”thesaurus”
whole_results (bool) – option to return all results or only the page size. False by DEFAULT.
- Type renvoyé: