viapy Code Documentation¶
API¶
-
class
viapy.api.
SRUItem
(items=None, sequence_type=<type 'tuple'>)[source]¶ Single item returned by a SRU search, for use with
ViafAPI.search()
andSRUResult
.-
label
¶ first main heading for this item
-
nametype
¶ type of name (personal, corporate, title, etc)
-
uri
¶ VIAF URI for this result
-
viaf_id
¶ VIAF numeric identifier
-
-
class
viapy.api.
SRUResult
(data)[source]¶ SRU search result object, for use with
ViafAPI.search()
.-
total_results
¶ number of records matching the query
-
-
class
viapy.api.
ViafAPI
[source]¶ Wrapper for VIAF API.
https://platform.worldcat.org/api-explorer/apis/VIAF
-
api_base
= 'https://www.viaf.org/viaf'¶ base url for VIAF API methods
-
search
(query)[source]¶ Query VIAF seach interface. Returns a list of
SRUItem
:param query: CQL query in viaf syntax (e.g.,cql.any all "term"
)
-
suggest
(term)[source]¶ Query autosuggest API. Returns a list of results, or an empty list if no suggestions are found or if something went wrong
-
uri_base
= 'http://viaf.org/viaf'¶ base url for VIAF URIs
-
-
class
viapy.api.
ViafEntity
(viaf_id)[source]¶ Object for working with a single VIAF entity.
Parameters: viaf_id – viaf identifier (either integer or uri) -
birthdate
¶ schema birthdate as
rdflib.Literal
-
birthyear
¶ birth year
-
deathdate
¶ schema deathdate as
rdflib.Literal
-
deathyear
¶ death year
-
rdf
¶ VIAF data for this entity as
rdflib.Graph
-
uriref
¶ VIAF URI reference as instance of
rdflib.URIRef
-
Views¶
-
class
viapy.views.
ViafLookup
(**kwargs)[source]¶ View to provide VIAF suggestions for autocomplete lookup. Based on
dal.autocompleteSelect2ListView
. Expects search term as query string parameter q. Returns viaf URI as identifier and display form as text.