From 7d4f8fd3619fac0a77a231272286c70ed0736b3c Mon Sep 17 00:00:00 2001 From: Matthew Blissett Date: Mon, 19 Feb 2024 17:59:38 +0100 Subject: [PATCH] WIP: Generate extension for audiovisual core. Initially reproduce the existing extension. --- build/generate_term_versions.py | 12 ++-- build/xml/audiovisual.tmpl | 12 ++++ build/xml/audiovisual_list.csv | 97 +++++++++++++++++++++++++++++++++ build/xml/build_extension.py | 6 +- 4 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 build/xml/audiovisual.tmpl create mode 100644 build/xml/audiovisual_list.csv diff --git a/build/generate_term_versions.py b/build/generate_term_versions.py index cd25d96..76aa63e 100644 --- a/build/generate_term_versions.py +++ b/build/generate_term_versions.py @@ -11,7 +11,7 @@ github_baseUri = 'https://raw.githubusercontent.com/tdwg/rs.tdwg.org/' + github_ # This is a Python list of the database names of the term version lists to be included in the document. #term_lists = ['iri'] -term_lists = ['terms', 'iri', 'dc-for-dwc', 'dcterms-for-dwc', 'curatorial', 'dwcore', 'dwctype', 'geospatial'] +term_lists = ['terms', 'iri', 'dc-for-dwc', 'dcterms-for-dwc', 'curatorial', 'dwcore', 'dwctype', 'geospatial', 'audubon'] column_mappings = [ {'norm': 'iri', 'accum': 'version'}, @@ -55,7 +55,7 @@ for term_list_index in range(len(term_lists)): accumulated_frame = versions_df.copy() else: # append subsequent term lists data to the DataFrame - accumulated_frame = accumulated_frame.append(versions_df.copy(), sort=True) + accumulated_frame = accumulated_frame._append(versions_df.copy(), sort=True) # Special procedure for obsolete terms # Retrieve versions metadata @@ -81,10 +81,10 @@ for row_index,row in versions_df.iterrows(): # Add the current term IRI from the join data row to the list term_iri_list.append(term_iri_row['term']) ''' -# Add the curren term IRI list to the DataFrame as the term_iri column +# Add the current term IRI list to the DataFrame as the term_iri column versions_df['term_iri'] = term_iri_list # Add the obsolete terms DataFrame to the accumulated DataFrame -accumulated_frame = accumulated_frame.append(versions_df.copy(), sort=True) +accumulated_frame = accumulated_frame._append(versions_df.copy(), sort=True) accumulated_frame.reset_index(drop=True, inplace=True) # reset the row indices to consecutive starting with zero accumulated_frame.fillna('', inplace=True) # replace all missing values with empty strings @@ -166,7 +166,7 @@ for qrg_index,qrg_row in qrg_df.iterrows(): for row_index,row in normative_doc_df.iterrows(): if (qrg_row['recommended_term_iri'] == row['term_iri']) and (row['status'] == 'recommended'): found = True - built_rows_df = built_rows_df.append(row) + built_rows_df = built_rows_df._append(row) remaining_rows_df.drop(row['iri'], axis=0, inplace=True) break if not found: @@ -178,7 +178,7 @@ sorted_output = remaining_rows_df.iloc[remaining_rows_df.iri.str.lower().argsort # Concatenate ordered terms and remaining versions #normative_doc_df = built_rows_df.append(remaining_rows_df) -normative_doc_df = built_rows_df.append(sorted_output) +normative_doc_df = built_rows_df._append(sorted_output) # Save the normative document DataFrame as a CSV normative_doc_df.to_csv('../vocabulary/term_versions.csv', index = False) diff --git a/build/xml/audiovisual.tmpl b/build/xml/audiovisual.tmpl new file mode 100644 index 0000000..7e5fc0d --- /dev/null +++ b/build/xml/audiovisual.tmpl @@ -0,0 +1,12 @@ + + + diff --git a/build/xml/audiovisual_list.csv b/build/xml/audiovisual_list.csv new file mode 100644 index 0000000..3e13028 --- /dev/null +++ b/build/xml/audiovisual_list.csv @@ -0,0 +1,97 @@ +group,iri,type,thesaurus,description,comments,examples,required +Management Vocabulary,http://purl.org/dc/terms/identifier,,,,,,true +Management Vocabulary,http://purl.org/dc/elements/1.1/type,,,,,, +Management Vocabulary,http://purl.org/dc/terms/type,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/subtypeLiteral,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/subtype,,,,,, +Management Vocabulary,http://purl.org/dc/terms/title,,,,,, +Management Vocabulary,http://purl.org/dc/terms/modified,,,,,, +Management Vocabulary,http://ns.adobe.com/xap/1.0/MetadataDate,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/metadataLanguageLiteral,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/metadataLanguage,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/providerManagedID,,,,,, +Management Vocabulary,http://ns.adobe.com/xap/1.0/Rating,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/commenterLiteral,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/commenter,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/comments,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/reviewerLiteral,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/reviewer,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/reviewerComments,,,,,, +Management Vocabulary,http://purl.org/dc/terms/available,,,,,, +Management Vocabulary,http://rs.tdwg.org/ac/terms/hasServiceAccessPoint,,,,,, +Attribution Vocabulary,http://purl.org/dc/elements/1.1/rights,,,,,, +Attribution Vocabulary,http://purl.org/dc/terms/rights,,,,,, +Attribution Vocabulary,http://ns.adobe.com/xap/1.0/rights/Owner,,,,,, +Attribution Vocabulary,http://ns.adobe.com/xap/1.0/rights/UsageTerms,,,,,, +Attribution Vocabulary,http://ns.adobe.com/xap/1.0/rights/WebStatement,,,,,, +Attribution Vocabulary,http://rs.tdwg.org/ac/terms/licenseLogoURL,,,,,, +Attribution Vocabulary,http://ns.adobe.com/photoshop/1.0/Credit,,,,,, +Attribution Vocabulary,http://rs.tdwg.org/ac/terms/attributionLogoURL,,,,,, +Attribution Vocabulary,http://rs.tdwg.org/ac/terms/attributionLinkURL,,,,,, +Attribution Vocabulary,http://rs.tdwg.org/ac/terms/fundingAttribution,,,,,, +Attribution Vocabulary,http://purl.org/dc/elements/1.1/source,,,,,, +Attribution Vocabulary,http://purl.org/dc/terms/source,,,,,, +Agents Vocabulary,http://purl.org/dc/elements/1.1/creator,,,,,, +Agents Vocabulary,http://purl.org/dc/terms/creator,,,,,, +Agents Vocabulary,http://rs.tdwg.org/ac/terms/providerLiteral,,,,,, +Agents Vocabulary,http://rs.tdwg.org/ac/terms/provider,,,,,, +Agents Vocabulary,http://rs.tdwg.org/ac/terms/metadataCreatorLiteral,,,,,, +Agents Vocabulary,http://rs.tdwg.org/ac/terms/metadataCreator,,,,,, +Agents Vocabulary,http://rs.tdwg.org/ac/terms/metadataProviderLiteral,,,,,, +Agents Vocabulary,http://rs.tdwg.org/ac/terms/metadataProvider,,,,,, +Content Coverage Vocabulary,http://purl.org/dc/terms/description,,,,,, +Content Coverage Vocabulary,http://rs.tdwg.org/ac/terms/caption,,,,,, +Content Coverage Vocabulary,http://purl.org/dc/elements/1.1/language,,,,,, +Content Coverage Vocabulary,http://purl.org/dc/terms/language,,,,,, +Content Coverage Vocabulary,http://rs.tdwg.org/ac/terms/physicalSetting,,,,,, +Content Coverage Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/CVterm,,,,,, +Content Coverage Vocabulary,http://rs.tdwg.org/ac/terms/subjectCategoryVocabulary,,,,,, +Content Coverage Vocabulary,http://rs.tdwg.org/ac/terms/tag,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/LocationShown,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/WorldRegion,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/CountryCode,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/CountryName,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/ProvinceState,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/City,,,,,, +Geography Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/Sublocation,,,,,, +Temporal Coverage Vocabulary,http://purl.org/dc/terms/temporal,,,,,, +Temporal Coverage Vocabulary,http://ns.adobe.com/xap/1.0/CreateDate,,,,,, +Temporal Coverage Vocabulary,http://rs.tdwg.org/ac/terms/timeOfDay,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/ac/terms/taxonCoverage,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/scientificName,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/identificationQualifier,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/vernacularName,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/nameAccordingTo,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/scientificNameID,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/ac/terms/otherScientificName,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/identifiedBy,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/dateIdentified,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/ac/terms/taxonCount,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/ac/terms/subjectPart,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/sex,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/lifeStage,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/ac/terms/subjectOrientation,,,,,, +Taxonomic Coverage Vocabulary,http://rs.tdwg.org/dwc/terms/preparations,,,,,, +Resource Creation Vocabulary,http://iptc.org/std/Iptc4xmpExt/2008-02-29/LocationCreated,,,,,, +Resource Creation Vocabulary,http://rs.tdwg.org/ac/terms/digitizationDate,,,,,, +Resource Creation Vocabulary,http://rs.tdwg.org/ac/terms/captureDevice,,,,,, +Resource Creation Vocabulary,http://rs.tdwg.org/ac/terms/resourceCreationTechnique,,,,,, +Related Resources Vocabulary,http://rs.tdwg.org/ac/terms/IDofContainingCollection,,,,,, +Related Resources Vocabulary,http://rs.tdwg.org/ac/terms/relatedResourceID,,,,,, +Related Resources Vocabulary,http://rs.tdwg.org/ac/terms/providerID,,,,,, +Related Resources Vocabulary,http://rs.tdwg.org/ac/terms/derivedFrom,,,,,, +Related Resources Vocabulary,http://rs.tdwg.org/ac/terms/associatedSpecimenReference,,,,,, +Related Resources Vocabulary,http://rs.tdwg.org/ac/terms/associatedObservationReference,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/accessURI,,,,,, +Service Access Point Vocabulary,http://purl.org/dc/elements/1.1/format,,,,,, +Service Access Point Vocabulary,http://purl.org/dc/terms/format,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/variantLiteral,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/variant,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/variantDescription,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/furtherInformationURL,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/licensingException,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/serviceExpectation,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/hashFunction,,,,,, +Service Access Point Vocabulary,http://rs.tdwg.org/ac/terms/hashValue,,,,,, +Service Access Point Vocabulary,http://ns.adobe.com/exif/1.0/PixelXDimension,,,,,, +Service Access Point Vocabulary,http://ns.adobe.com/exif/1.0/PixelYDimension,,,,,, diff --git a/build/xml/build_extension.py b/build/xml/build_extension.py index 163df9f..f79b383 100644 --- a/build/xml/build_extension.py +++ b/build/xml/build_extension.py @@ -35,7 +35,8 @@ NAMESPACES = { 'http://rs.tdwg.org/eco/terms/' : 'eco', 'http://purl.org/dc/elements/1.1/' : 'dc', 'http://purl.org/dc/terms/' : 'dcterms', - 'http://rs.tdwg.org/dwc/terms/attributes/' : 'tdwgutility'} + 'http://rs.tdwg.org/dwc/terms/attributes/' : 'tdwgutility', + 'http://rs.tdwg.org/ac/terms/' : 'ac'} class ProvidedTermsError(Exception): """inconsistency in the available terms Error""" @@ -418,6 +419,9 @@ class DwcDigester(object): elif namespace=='http://rs.tdwg.org/eco/terms/': # Example: https://tdwg.github.io/eco/terms/#eco:samplingPerformedBy dc_relation = f'https://eco.tdwg.org/terms/#eco:{name}' + elif namespace=='http://rs.tdwg.org/ac/terms/': + # Example: https://ac.tdwg.org/terms/#ac:hasServiceAccessPointPerformedBy + dc_relation = f'https://ac.tdwg.org/termlist/#ac:{name}' # Get the term definition (dc:description) from the description field of # the Extension term list file. Later we'll check if this is blank, and