Package: acdh-arche-assets
Arche AssetsSet of static assets used (mainly) for ARCHE data preprocessing or ARCHE information pages:URI normalization rules used within theACDH-CH.(stored inAcdhArcheAssets/uriNormRules.json)Description of input data formats accepted byARCHE.(stored inAcdhArcheAssets/formats.json)The repository provides also Python 3 and PHP bindings for accessing those assets.Installation & usagePythonInstall using pip3:pip3installacdh-arche-assetsUse withfromAcdhArcheAssets.uri_norm_rulesimportget_rules,get_normalized_uri,get_norm_idprint(f"{get_rules()}")wrong_id="http://sws.geonames.org/1232324343/linz.html"good_id=get_normalized_uri(wrong_id)print(good_id)# "https://sws.geonames.org/1232324343/"# extract ID from URLnorm_id=get_norm_id("http://sws.geonames.org/1232324343/linz.html")print(norm_id)# "1232324343"fromAcdhArcheAssets.file_formatsimportget_formats,get_by_mtype,get_by_extensionformats=get_formats()matching_mapping=get_by_mtype('image/png')matching_mapping=get_by_extension('png')PHPInstall using usingcomposer:composerrequireacdh-oeaw/arche-assetsUsage withrequire_once 'vendor/autoload.php';print_r(acdhOeaw\UriNormRules::getRules());print_r(acdhOeaw\UriNormRules::getRules(['viaf', 'gnd']));print_r(acdhOeaw\ArcheFileFormats::getAll();print_r(acdhOeaw\ArcheFileFormats::getByMime('application/json');print_r(acdhOeaw\ArcheFileFormats::getByExtension('application/json');Description of assetsURI normalization rulesEach rule consists of five properties:name: a rule namematch: a regular expression matching a given URI namespacereplace: a regular expression replace expression normalizing an URI in a given namespaceresolve: a regular expression replace expression transforming an URI in a given namespace to an URL fetching an RDF dataformat: a RDF serialization format to be requested while resolving the URL produced using theresolvefieldFormatsA curated and growing list of file extensions. For each file extension mappings to the respectiveARCHE Resource Type Category(stored inacdh:hasCategory) andMedia Type (MIME type)(stored inacdh:hasFormat) are given. The indicated Media Type should only be used as a fallback; it is best practice to rely on automated Media Type detection based on file signatures.Further information is provided as well.fileExtension: File extension to be mapped.name: Name(s) the format is knownarcheCategory: The corresponding URI of theARCHE Resource Type Category VocabularydataType: A broad category to group formats in; mainly intended for visualisation purposes.pronomID: ID(s) assigned byPRONOMmimeType: Official Media Type(s) (formerly known as MIME types) registered atIANA.informalMimeType: Other MIME types kown for the formatmagicNumber: A constant numerical or text value used to identify a file format, e.g.Wikipedia list of file signaturesianaTemplate: Link to template at IANAreference: Link(s) to format specifications referenced by IANA and otherslongTerm: Indicates if a format is suitable for long-term preservation.Possible values and their meaningyes - long-term formatno - not suitable, another format should be usedrestricted - can be used for long-term preservation in some cases (see comment)unsure - status remains to be evaluatedarcheDocs: Link to a place with more information for the format.comment: Any other noteworthy information not stated elsewhere.Developement (Python)install needed developement packagespip install requirements_dev.txtlinting, tests and testcoverageto run the test:toxcheck coverage and create report:coverage run setup.py testandcoverage htmlcheck lintingflake8