acdh_arche_pyutils package

Submodules

acdh_arche_pyutils.client module

class acdh_arche_pyutils.client.ArcheApiClient(arche_endpoint, out_dir='.')[source]

Bases: object

Main Class to interact with ARCHE-API

get_resource(res_uri)[source]

fetches the given resource and its ancestors/parents :param res_uri: an ARCHE URI :type res_uri: str

Returns

A rdflib.Graph object

Return type

rdflib.Graph

top_col_ids()[source]

returns of list of tuples (hasIdentifier, hasTitle) of all TopCollection

write_resource_to_file(res_uri, format='ttl')[source]

writes a resource (and its parents/children) to file on disk :param res_uri: An ARCHE-URI :type res_uri: str :param format: The serialisation format, defaults to ‘ttl’ -> turtle use ‘xml’ for RDF/XML :type format: str

Returns

The location of the file

Return type

str

acdh_arche_pyutils.utils module

Some utility functions module.

acdh_arche_pyutils.utils.camel_to_snake(s)[source]

converts CamelCase string to camel_case taken from https://stackoverflow.com/a/44969381

Parameters

s (str:) – some string

Returns

a camel_case string

Return type

str:

acdh_arche_pyutils.utils.create_query_sting(param_dict)[source]

turns a dict into a query string :param param_dict: a dictionary :type param_dict: dict

Returns

a clean query string

Return type

str

acdh_arche_pyutils.utils.id_from_uri(uri)[source]

extracts the id from an ARCHE-URL like https://whatever.com/123 -> 123 :param uri: some ARCHE-URL :type uri: str

Returns

the actual ID, e.g. 123

Return type

str:

Module contents

Top-level package for acdh-arche-pyutils.