API Documentation

Providers module

This module contains classes that implement skosprovider.providers.VocabularyProvider against the LOD version of the Getty Vocabularies (AAT and TGN).

class skosprovider_getty.providers.AATProvider(metadata)[source]

The Art & Architecture Thesaurus Provider A provider that can work with the GETTY AAT rdf files of http://vocab.getty.edu/aat

class skosprovider_getty.providers.GettyProvider(metadata, **kwargs)[source]

A provider that can work with the GETTY rdf files of http://vocab.getty.edu/

expand(id)[source]
Expand a concept or collection to all it’s narrower concepts.
If the id passed belongs to a skosprovider.skos.Concept, the id of the concept itself should be include in the return value.
Parameters:id (str) – A concept or collection id.
Returns:A lst of id’s. Returns false if the input id does not exists
find(query)[source]

Find concepts that match a certain query.

Currently query is expected to be a dict, so that complex queries can be passed. You can use this dict to search for concepts or collections with a certain label, with a certain type and for concepts that belong to a certain collection.

# Find anything that has a label of church.
provider.find({'label': 'church'}

# Find all concepts that are a part of collection 5.
provider.find({'type': 'concept', 'collection': {'id': 5})

# Find all concepts, collections or children of these
# that belong to collection 5.
provider.find({'collection': {'id': 5, 'depth': 'all'})
Parameters:query

A dict that can be used to express a query. The following keys are permitted:

  • label: Search for something with this label value. An empty label is equal to searching for all concepts.
  • type: Limit the search to certain SKOS elements. If not present all is assumed:
    • concept: Only return skosprovider.skos.Concept instances.
    • collection: Only return skosprovider.skos.Collection instances.
    • all: Return both skosprovider.skos.Concept and skosprovider.skos.Collection instances.
  • collection: Search only for concepts belonging to a certain collection. This argument should be a dict with two keys:
    • id: The id of a collection. Required.
    • depth: Can be members or all. Optional. If not present, members is assumed, meaning only concepts or collections that are a direct member of the collection should be considered. When set to all, this method should return concepts and collections that are a member of the collection or are a narrower concept of a member of the collection.
Returns:A lst of concepts and collections. Each of these is a dict with the following keys:
  • id: id within the conceptscheme
  • uri: uri of the concept or collection
  • type: concept or collection
  • label: A label to represent the concept or collection. It is determined by looking at the **kwargs parameter, the default language of the provider and finally falls back to en.
get_all()[source]

Not supported: This provider does not support this. The amount of results is too large

get_by_id(id, change_notes=False)[source]

Get a skosprovider.skos.Concept or skosprovider.skos.Collection by id

Parameters:id ((str)) – integer id of the skosprovider.skos.Concept or skosprovider.skos.Concept
Returns:corresponding skosprovider.skos.Concept or skosprovider.skos.Concept. Returns None if non-existing id
get_by_uri(uri, change_notes=False)[source]

Get a skosprovider.skos.Concept or skosprovider.skos.Collection by uri

Parameters:uri ((str)) – string uri of the skosprovider.skos.Concept or skosprovider.skos.Concept
Returns:corresponding skosprovider.skos.Concept or skosprovider.skos.Concept. Returns None if non-existing id
get_children_display(id)[source]

Return a list of concepts or collections that should be displayed under this concept or collection.

Parameters:id (str) – A concept or collection id.
Returns:A lst of concepts and collections.
get_top_concepts()[source]

Returns all concepts that form the top-level of a display hierarchy.

Returns:A lst of concepts.
get_top_display()[source]

Returns all concepts or collections that form the top-level of a display hierarchy.

Returns:A lst of concepts and collections.
class skosprovider_getty.providers.TGNProvider(metadata)[source]

The Getty Thesaurus of Geographic Names A provider that can work with the GETTY TGN rdf files of http://vocab.getty.edu/tgn

Utility module

This module contains utility functions for skosprovider_getty.

skosprovider_getty.utils.uri_to_graph(uri)[source]
Parameters:uri (string) – URI where the RDF data can be found.
Return type:rdflib.Graph
Raises skosprovider.exceptions.ProviderUnavailableException:
 if the getty.edu services are down