gws.base.metadata.core

Metadata objects: creation, merging and conversion.

Source code: gws.base.metadata.core

Module Contents

class gws.base.metadata.core.Config(*args, **kwargs)

Bases: gws.Config

Metadata of an object, used in the client and in OWS services.

abstract: str | None

Abstract of the object, a brief description.

accessConstraints: str | None

Access constraints, written to AccessConstraints in service capabilities.

accessConstraintsType: str | None

Access constraint type for the object.

attribution: str | None

Attribution text, shown in the client and as the WMS Attribution title.

attributionUrl: str | None

URL of the attribution, written to the WMS Attribution online resource.

authorityIdentifier: str | None

Layer identifier issued by the authority, written to the WMS Identifier element.

authorityName: str | None

Name of the authority that issues layer identifiers.

authorityUrl: str | None

URL of the authority that issues layer identifiers.

catalogCitationUid: str | None

Identifier of the resource, written to the CI_Citation identifier in CSW records.

catalogUid: str | None

Identifier of the metadata record.

contactAddress: str | None

Street address of the contact.

contactAddressType: str | None

Type of contact address, such as ‘postal’ or ‘email’.

contactArea: str | None

Administrative area, state or province of the contact address.

contactCity: str | None

Contact city.

contactCountry: str | None

Contact country.

contactEmail: str | None

Contact email address.

contactFax: str | None

Contact fax number.

contactOrganization: str | None

Contact organization or institution.

contactPerson: str | None

Contact person name.

contactPhone: str | None

Contact phone number.

contactPosition: str | None

Contact position or job title.

contactProviderName: str | None

Name of the service provider, written to ServiceProvider/ProviderName.

contactProviderSite: str | None

Website of the service provider, written to ServiceProvider/ProviderSite.

contactRole: gws.base.metadata.iso.CI_RoleCode | None

Role of the contact.

contactUrl: str | None

Website of the contact, written to the contact OnlineResource.

contactZip: str | None

Contact postal code.

crs: gws.CrsName | None

Reference system of the data, written to MD_ReferenceSystem in CSW records.

dateCreated: gws.DateStr | None

Creation date of the object.

dateUpdated: gws.DateStr | None

Last update date of the object.

fees: str | None

Fees for using the object, written to Fees in service capabilities.

image: str | None

Image URL or path associated with the object.

inspireDegreeOfConformity: gws.base.metadata.inspire.IM_DegreeOfConformity | None

Degree of conformity with the INSPIRE implementing rules.

inspireMandatoryKeyword: gws.base.metadata.inspire.IM_MandatoryKeyword | None

INSPIRE service type, added to the keywords as the ISO serviceType keyword.

inspireResourceType: gws.base.metadata.inspire.IM_ResourceType | None

INSPIRE resource type.

inspireSpatialDataServiceType: gws.base.metadata.inspire.IM_SpatialDataServiceType | None

INSPIRE spatial data service type.

inspireSpatialScope: gws.base.metadata.inspire.IM_SpatialScope | None

INSPIRE spatial scope.

inspireSpatialScopeName: str | None

Display name of the INSPIRE spatial scope.

inspireTheme: gws.base.metadata.inspire.IM_Theme | None

INSPIRE data theme, added to the keywords as a GEMET INSPIRE theme.

isoMaintenanceFrequencyCode: gws.base.metadata.iso.MD_MaintenanceFrequencyCode | None

How often the data is updated.

isoQualityConformanceExplanation: str | None

Explanation of the conformance result.

isoQualityConformanceQualityPass: bool | None

The data passes the conformance test.

isoQualityConformanceSpecificationDate: str | None

Publication date of the specification the conformance is tested against.

isoQualityConformanceSpecificationTitle: str | None

Title of the specification the conformance is tested against.

isoQualityLineageSource: str | None

Description of the source data.

isoQualityLineageSourceScale: int | None

Scale denominator of the source data.

isoQualityLineageStatement: str | None

Statement on the lineage of the data.

isoRestrictionCode: gws.base.metadata.iso.MD_RestrictionCode | None

Restrictions on access or use of the data.

isoScope: gws.base.metadata.iso.MD_ScopeCode | None

Scope of the metadata.

isoScopeName: str | None

Name of the scope, written to hierarchyLevelName in CSW records.

isoServiceFunction: gws.base.metadata.iso.SV_ServiceFunction | None

ISO service function.

isoSpatialRepresentationType: gws.base.metadata.iso.MD_SpatialRepresentationTypeCode | None

How the data is represented spatially.

isoSpatialResolution: int | None

Spatial resolution as a scale denominator.

isoTopicCategories: list[gws.base.metadata.iso.MD_TopicCategoryCode] | None

ISO 19115 topic categories, added to the keywords.

keywords: list[str] | None

river’.

Type:

Keywords, optionally prefixed with a vocabulary, e.g. ‘gemet

language: str | None

Language of the object as an ISO 639-1 code.

license: str | None

License text, written to the legal constraints in CSW records.

licenseUrl: gws.Url | None

License URL.

Links to metadata documents.

name: str | None

Object name.

parentIdentifier: str | None

Identifier of the parent metadata record.

serviceMetadataURL: str | None

URL of the service metadata document.

temporalBegin: gws.DateStr | None

Start of the temporal extent of the data.

temporalEnd: gws.DateStr | None

End of the temporal extent of the data.

title: str | None

Title of the object.

wgsExtent: gws.Extent | None

Geographic extent in WGS84, written to EX_Extent in CSW records.

gws.base.metadata.core.from_args(*args, **kwargs) → gws.Metadata

Create a metadata object by merging several sources.

Parameters:
  • *args – Dicts or data objects (configs, props, metadata objects), merged in order; None values are skipped.

  • **kwargs – Values merged last.

Returns:

A new metadata object.

gws.base.metadata.core.from_config(c: gws.Config) → gws.Metadata

Create a metadata object from a metadata configuration.

Parameters:

c – Metadata configuration.

Returns:

A new metadata object.

gws.base.metadata.core.from_dict(d: dict) → gws.Metadata

Create a metadata object from a dictionary.

Parameters:

d – Metadata values by key.

Returns:

A new metadata object.

gws.base.metadata.core.from_props(p: gws.Props) → gws.Metadata

Create a metadata object from metadata props.

Parameters:

p – Metadata props.

Returns:

A new metadata object.

gws.base.metadata.core.keyword_groups(md: gws.Metadata) → list[KeywordGroup]

Group the keywords of a metadata object by code space and type name.

Keywords without a vocabulary prefix go to a group with an empty code space and type name; keywords with a prefix (vocabulary:keyword) are currently not included. The INSPIRE theme, the ISO topic categories and the INSPIRE mandatory keyword get groups of their own.

Parameters:

md – Metadata object.

Returns:

Keyword groups.

class gws.base.metadata.core.KeywordGroup(*args, **kwargs)

Bases: gws.Data

Keywords from one vocabulary, as written to OWS keyword lists.

codeSpace: str

Code space for the keyword group, e.g. ‘iso’, ‘gemet’, ‘inspire’, ‘gcmd’.

keywords: list[str]

List of keywords in the group.

typeName: str

Type name for the keyword group, e.g. ‘isoTopicCategories’, ‘keywords’.

class gws.base.metadata.core.LinkConfig(*args, **kwargs)

Bases: gws.Config

Link to a metadata document or another resource related to the object.

about: str | None

Aspect of the object the link describes.

description: str | None

Description of the linked resource.

format: str | None

Format of the linked resource.

formatVersion: str | None

Version of the format of the linked resource.

function: str | None

Function of the link.

mimeType: gws.MimeType | None

MIME type of the linked resource.

scheme: str | None

Link scheme or protocol.

title: str | None

Link title.

type: str | None
url: str | None

Link URL.

gws.base.metadata.core.new() → gws.Metadata

Create an empty metadata object.

The list values keywords, isoTopicCategories and metaLinks are empty lists, all other values are unset.

Returns:

A new metadata object.

gws.base.metadata.core.normalize(md: gws.Metadata) → gws.Metadata

Return a normalized copy of a metadata object.

Dates are parsed to datetime objects, keyword lists are deduplicated and sorted, and the derived language codes and INSPIRE theme names are filled in.

Parameters:

md – Metadata object.

Returns:

A new metadata object.

class gws.base.metadata.core.Props(*args, **kwargs)

Bases: gws.Props

Represents metadata properties.

abstract: str
attribution: str
dateCreated: str
dateUpdated: str
keywords: list[str]
language: str
title: str
gws.base.metadata.core.props(md: gws.Metadata) → gws.Props

Convert a metadata object to client props.

Parameters:

md – Metadata object.

Returns:

Props with the abstract, attribution, dates as ISO date strings, sorted keywords, language and title. Missing values are empty strings.

gws.base.metadata.core.update(md: gws.Metadata, *args, **kwargs) → gws.Metadata

Merge values into a metadata object in place.

keywords and isoTopicCategories are added to the existing values, other keys replace them. None values do not override existing ones.

Parameters:
  • md – Metadata object to update.

  • *args – Dicts or data objects, merged in order.

  • **kwargs – Values merged last.

Returns:

The updated metadata object.