API Documentation

Providers module

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

Note

At initialisation, the Getty providers will search which gvp-classes of the gvp-ontology are a subclass of skos-classes.
This can cause a time delay of several seconds at startup.
class skosprovider_getty.providers.AATProvider(metadata, **kwargs)[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, **kwargs)[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:
  • 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(**kwargs)[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, **kwargs)[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(**kwargs)[source]

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

Returns:A lst of concepts.
get_top_display(**kwargs)[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, **kwargs)[source]

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

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

Union List of Artist Names

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

Utility module

This module contains utility functions for skosprovider_getty.

skosprovider_getty.utils.conceptscheme_from_uri(conceptscheme_uri, **kwargs)[source]

Read a SKOS Conceptscheme from a URI

Parameters:conceptscheme_uri (string) – URI of the conceptscheme.
Return type:skosprovider.skos.ConceptScheme
skosprovider_getty.utils.uri_to_graph(uri, **kwargs)[source]
Parameters:uri (string) – URI where the RDF data can be found.
Return type:rdflib.Graph or False if the URI does not exist
Raises:skosprovider.exceptions.ProviderUnavailableException – if the getty.edu services are down