Class: QgsAbstractMetadataBase¶
- class qgis.core.QgsAbstractMetadataBase¶
Bases:
sip.wrapper
Constructor for QgsAbstractMetadataBase.
QgsAbstractMetadataBase
cannot be instantiated directly, it must be subclassed.QgsAbstractMetadataBase(
QgsAbstractMetadataBase
)An abstract base class for metadata stores.
QgsAbstractMetadataBase
is the base class for handling storage and management of the metadata for various map related assets. This class is an internal QGIS format with a common metadata structure. It is subclassed by layer and project specific metadata classes, such asQgsLayerMetadata
and QgsProjectMetadata.The metadata store is designed to be compatible with the Dublin Core metadata specifications, and will be expanded to allow compatibility with ISO specifications in future releases. However, the QGIS internal schema does not represent a superset of all existing metadata schemas and accordingly conversion from specific metadata formats to
QgsAbstractMetadataBase
may result in a loss of information.This class is designed to follow the specifications detailed in the schema definition available at resources/qgis-base-metadata.xsd within the QGIS source code.
Metadata can be validated through the use of QgsAbstractMetadataBaseValidator subclasses. E.g. validating against the native QGIS metadata schema can be performed using QgsNativeMetadataValidator.
New in version 3.2:
Methods
Returns a free-form description of the resource.
Adds an individual
contact
to the existing contacts.Adds a single history
text
to the end of the existing history list.Adds a list of descriptive
keywords
for a specifiedvocabulary
.Adds an individual
link
to the existing links.Returns categories of the resource.
Clones the metadata object.
Returns a list of contact persons or entities associated with the resource.
Tests whether the common metadata fields in this object are equal to
other
.Returns a freeform description of the history or lineage of the resource.
A reference, URI, URL or some other mechanism to identify the resource.
Returns a list of keyword vocabularies contained in the metadata.
Returns the keywords map, which is a set of descriptive keywords associated with the resource.
Returns the human language associated with the resource.
Returns a list of online resources associated with the resource.
A reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of.
Sets state from DOM document.
Remove a vocabulary from the list.
Sets a free-form
abstract
(description) of the resource.Sets categories of the resource.
Sets the list of
contacts
or entities associated with the resource.Sets the freeform description of the
history
or lineage of the resource.Sets the reference, URI, URL or some other mechanism to identify the resource.
Sets the
keywords
map, which is a set of descriptive keywords associated with the resource.Sets the human
language
associated with the resource.Sets the list of online resources associated with the resource.
Sets a reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of.
Sets the human readable
title
(name) of the resource, typically displayed in search results.Sets the
type
(nature) of the resource.Returns the human readable name of the resource, typically displayed in search results.
Returns the nature of the resource.
Stores state in a DOM node.
- class Address(type: str = '', address: str = '', city: str = '', administrativeArea: str = '', postalCode: str = '', country: str = '')¶
Bases:
sip.wrapper
Constructor for Address.
QgsAbstractMetadataBase.Address(QgsAbstractMetadataBase.Address)
- address¶
- administrativeArea¶
- city¶
- country¶
- postalCode¶
- type¶
- class Contact(name: str = '')¶
Bases:
sip.wrapper
Constructor for Contact.
QgsAbstractMetadataBase.Contact(QgsAbstractMetadataBase.Contact)
- addresses¶
- email¶
- fax¶
- name¶
- organization¶
- position¶
- role¶
- voice¶
- class Link(name: str = '', type: str = '', url: str = '')¶
Bases:
sip.wrapper
Constructor for Link.
QgsAbstractMetadataBase.Link(QgsAbstractMetadataBase.Link)
- description¶
- format¶
- mimeType¶
- name¶
- size¶
- type¶
- url¶
- abstract(self) str ¶
Returns a free-form description of the resource.
See also
- Return type
str
- addContact(self, contact: QgsAbstractMetadataBase.Contact)¶
Adds an individual
contact
to the existing contacts.See also
See also
- Parameters
contact (QgsAbstractMetadataBase.Contact) –
- addHistoryItem(self, text: str)¶
Adds a single history
text
to the end of the existing history list.See also
See also
- Parameters
text (str) –
- addKeywords(self, vocabulary: str, keywords: Iterable[str])¶
Adds a list of descriptive
keywords
for a specifiedvocabulary
. Any existing keywords for the same vocabulary will be replaced. Other vocabularies will not be affected.The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary associated with keyword list.
See also
- Parameters
vocabulary (str) –
keywords (Iterable[str]) –
- addLink(self, link: QgsAbstractMetadataBase.Link)¶
Adds an individual
link
to the existing links.See also
See also
- Parameters
link (QgsAbstractMetadataBase.Link) –
- categories(self) List[str] ¶
Returns categories of the resource. Categories are stored using a special vocabulary ‘gmd:topicCategory’ in keywords.
See also
- Return type
List[str]
- clone(self) QgsAbstractMetadataBase ¶
Clones the metadata object.
New in version 3.2.
- Return type
- contacts(self) List[QgsAbstractMetadataBase.Contact] ¶
Returns a list of contact persons or entities associated with the resource.
See also
- Return type
- equals(self, other: QgsAbstractMetadataBase) bool ¶
Tests whether the common metadata fields in this object are equal to
other
.Subclasses should utilize this method from their equality operators to test equality of base class members.
New in version 3.2.
- Parameters
other (QgsAbstractMetadataBase) –
- Return type
bool
- history(self) List[str] ¶
Returns a freeform description of the history or lineage of the resource.
See also
- Return type
List[str]
- identifier(self) str ¶
A reference, URI, URL or some other mechanism to identify the resource.
See also
- Return type
str
- keywordVocabularies(self) List[str] ¶
Returns a list of keyword vocabularies contained in the metadata.
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary associated with keyword list.
See also
- Return type
List[str]
- keywords(self) Dict[str, List[str]] ¶
Returns the keywords map, which is a set of descriptive keywords associated with the resource.
The map key is the vocabulary string and map value is a list of keywords for that vocabulary.
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary associated with keyword list.
See also
See also
keywords(self, vocabulary: str) -> List[str] Returns a list of keywords for the specified
vocabulary
. If the vocabulary is not contained in the metadata, an empty list will be returned.The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary associated with keyword list.
See also
- Return type
Dict[str, List[str]]
- language(self) str ¶
Returns the human language associated with the resource. Usually the returned string will follow either the ISO 639.2 or ISO 3166 specifications, e.g. ‘ENG’ or ‘SPA’, however this is not a hard requirement and the caller must account for non compliant values.
See also
- Return type
str
- links(self) List[QgsAbstractMetadataBase.Link] ¶
Returns a list of online resources associated with the resource.
See also
- Return type
- parentIdentifier(self) str ¶
A reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. Returns an empty string if no parent identifier is set.
See also
- Return type
str
- readMetadataXml(self, metadataElement: QDomElement) bool ¶
Sets state from DOM document.
- Parameters
metadataElement (QDomElement) – The DOM element corresponding to ``resourceMetadata’’ tag
- Return type
bool
- Returns
True
if successful
Subclasses which override this method should take care to also call the base class method in order to read common metadata properties.
- removeKeywords(self, vocabulary: str) bool ¶
Remove a vocabulary from the list.
See also
See also
- Parameters
vocabulary (str) –
- Return type
bool
- setAbstract(self, abstract: str)¶
Sets a free-form
abstract
(description) of the resource.See also
- Parameters
abstract (str) –
- setCategories(self, categories: Iterable[str])¶
Sets categories of the resource. Categories are stored using a special vocabulary ‘gmd:topicCategory’ in keywords.
See also
- Parameters
categories (Iterable[str]) –
- setContacts(self, contacts: Iterable[QgsAbstractMetadataBase.Contact])¶
Sets the list of
contacts
or entities associated with the resource. Any existing contacts will be replaced.See also
See also
- Parameters
contacts (Iterable[QgsAbstractMetadataBase.Contact]) –
- setHistory(self, history: Iterable[str])¶
Sets the freeform description of the
history
or lineage of the resource. Any existing history items will be overwritten.See also
See also
- Parameters
history (Iterable[str]) –
- setIdentifier(self, identifier: str)¶
Sets the reference, URI, URL or some other mechanism to identify the resource.
See also
- Parameters
identifier (str) –
- setKeywords(self, keywords: Dict[str, Iterable[str]])¶
Sets the
keywords
map, which is a set of descriptive keywords associated with the resource.The map key is the vocabulary string and map value is a list of keywords for that vocabulary. Calling this replaces any existing keyword vocabularies.
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary associated with keyword list.
See also
See also
- Parameters
keywords (Dict[str) –
- setLanguage(self, language: str)¶
Sets the human
language
associated with the resource. While a formal vocabulary is not imposed, ideally values should be taken from the ISO 639.2 or ISO 3166 specifications, e.g. ‘ENG’ or ‘SPA’ (ISO 639.2) or ‘EN-AU’ (ISO 3166).See also
- Parameters
language (str) –
- setLinks(self, links: Iterable[QgsAbstractMetadataBase.Link])¶
Sets the list of online resources associated with the resource. Any existing links will be replaced.
See also
See also
- Parameters
links (Iterable[QgsAbstractMetadataBase.Link]) –
- setParentIdentifier(self, parentIdentifier: str)¶
Sets a reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. Set an empty string if no parent identifier is required.
See also
- Parameters
parentIdentifier (str) –
- setTitle(self, title: str)¶
Sets the human readable
title
(name) of the resource, typically displayed in search results.See also
- Parameters
title (str) –
- setType(self, type: str)¶
Sets the
type
(nature) of the resource. While a formal vocabulary is not imposed, it is advised to use the ISO 19115 MD_ScopeCode values. E.g. ‘dataset’ or ‘series’.See also
- Parameters
type (str) –
- title(self) str ¶
Returns the human readable name of the resource, typically displayed in search results.
See also
- Return type
str
- type(self) str ¶
Returns the nature of the resource. While a formal vocabulary is not imposed, it is advised to use the ISO 19115 MD_ScopeCode values. E.g. ‘dataset’ or ‘series’.
See also
- Return type
str
- writeMetadataXml(self, metadataElement: QDomElement, document: QDomDocument) bool ¶
Stores state in a DOM node.
- Parameters
metadataElement (QDomElement) – is a DOM element corresponding to ``resourceMetadata’’ tag
document (QDomDocument) – is a the DOM document being written
- Return type
bool
- Returns
True
if successful
Subclasses which override this method should take care to also call the base class method in order to write common metadata properties.