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)[source]

Bases: object

Routes as methods of Isogeo API used to manipulate keywords.

create(keyword: isogeo_pysdk.models.keyword.Keyword) → isogeo_pysdk.models.keyword.Keyword[source]

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.

Parameters:keyword (Keyword) – Keyword model object to create
delete(keyword: isogeo_pysdk.models.keyword.Keyword)[source]

Delete a keyword from Isogeo database.

Parameters:keyword (Keyword) – Keyword model object to create
get(keyword_id: str, include: tuple = ('_abilities', 'count', 'thesaurus')) → isogeo_pysdk.models.keyword.Keyword[source]

Get details about a specific keyword.

Parameters:
  • keyword_id (str) – keyword UUID
  • include (tuple) – additionnal subresource to include in the response
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
>>> random_keyword = sample(li_keywords_uuid, 1)[0]
>>> # get its details
>>> keyword = isogeo.keyword.get(random_keyword)
metadata(metadata_id: str = None, include: tuple = ('_abilities', 'count', 'thesaurus')) → list[source]

List a metadata’s keywords with complete information.

Parameters:
  • metadata_id (str) – metadata UUID
  • include (tuple) –

    subresources that should be returned. Available values:

    • ’_abilities’
    • ’count’
    • ’thesaurus’
Return type:

list

tagging(metadata: isogeo_pysdk.models.metadata.Metadata, keyword: isogeo_pysdk.models.keyword.Keyword, check_exists: bool = 0) → dict[source]

Associate a keyword to a metadata.

Parameters:
  • metadata (Metadata) – metadata (resource) to edit
  • keyword (Keyword) – object to associate
  • check_exists (bool) – check if a metadata with the same service base URL and format alerady exists. Defaults to True.
Example:
# retrieve a metadata
md = isogeo.metadata.get(METADATA_UUID)
# retrieve a keyword
keyword = isogeo.keyword.get(KEYWORD_UUID)
thesaurus(thesaurus_id: str = '1616597fbc4348c8b11ef9d59cf594c8', query: str = '', offset: int = 0, order_by: str = 'text', order_dir: str = 'desc', page_size: int = 20, specific_md: list = [], specific_tag: list = [], include: tuple = ('_abilities', 'count'), caching: bool = 1) → isogeo_pysdk.models.keyword_search.KeywordSearch[source]

Search for keywords within a specific thesaurus or a specific group.

Parameters:
  • 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: 20.
  • 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’
untagging(metadata: isogeo_pysdk.models.metadata.Metadata, keyword: isogeo_pysdk.models.keyword.Keyword) → dict[source]

Dissociate a keyword from a metadata.

Parameters:
  • metadata (Metadata) – metadata (resource) to edit
  • keyword (Keyword) – object to associate
workgroup(workgroup_id: str = None, thesaurus_id: str = None, query: str = '', offset: int = 0, order_by: str = 'text', order_dir: str = 'desc', page_size: int = 20, specific_md: list = [], specific_tag: list = [], include: tuple = ('_abilities', 'count', 'thesaurus'), caching: bool = 1) → isogeo_pysdk.models.keyword_search.KeywordSearch[source]

Search for keywords within a specific group’s used thesauri.

Parameters:
  • 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: 20.
  • 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’