Subgroup: Abstract
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 as QgsLayerMetadata 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
abstract
Returns a free-form description of the resource. addContact
Adds an individual contact
to the existing contacts.addHistoryItem
Adds a single history text
to the end of the existing history list.addKeywords
Adds a list of descriptive keywords
for a specifiedvocabulary
.addLink
Adds an individual link
to the existing links.categories
Returns categories of the resource. clone
Clones the metadata object. contacts
Returns a list of contact persons or entities associated with the resource. equals
Tests whether the common metadata fields in this object are equal to other
.history
Returns a freeform description of the history or lineage of the resource. identifier
A reference, URI, URL or some other mechanism to identify the resource. keywordVocabularies
Returns a list of keyword vocabularies contained in the metadata. keywords
Returns the keywords map, which is a set of descriptive keywords associated with the resource. language
Returns the human language associated with the resource. links
Returns a list of online resources associated with the resource. parentIdentifier
A reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. readMetadataXml
Sets state from DOM document. removeKeywords
Remove a vocabulary from the list. setAbstract
Sets a free-form abstract
(description) of the resource.setCategories
Sets categories of the resource. setContacts
Sets the list of contacts
or entities associated with the resource.setHistory
Sets the freeform description of the history
or lineage of the resource.setIdentifier
Sets the reference, URI, URL or some other mechanism to identify the resource. setKeywords
Sets the keywords
map, which is a set of descriptive keywords associated with the resource.setLanguage
Sets the human language
associated with the resource.setLinks
Sets the list of online resources associated with the resource. setParentIdentifier
Sets a reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. setTitle
Sets the human readable title
(name) of the resource, typically displayed in search results.setType
Sets the type
(nature) of the resource.title
Returns the human readable name of the resource, typically displayed in search results. type
Returns the nature of the resource. writeMetadataXml
Stores state in a DOM node. Signals
Attributes
-
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
-
addContact
(self, contact: QgsAbstractMetadataBase.Contact)¶ Adds an individual
contact
to the existing contacts.See also
See also
-
addHistoryItem
(self, text: str)¶ Adds a single history
text
to the end of the existing history list.See also
See also
-
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
-
addLink
(self, link: QgsAbstractMetadataBase.Link)¶ Adds an individual
link
to the existing links.See also
See also
-
categories
(self) → List[str]¶ Returns categories of the resource. Categories are stored using a special vocabulary ‘gmd:topicCategory’ in keywords.
See also
-
clone
(self) → QgsAbstractMetadataBase¶ Clones the metadata object.
New in version 3.2.
-
contacts
(self) → object¶ Returns a list of contact persons or entities associated with the resource.
See also
-
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.
-
history
(self) → List[str]¶ Returns a freeform description of the history or lineage of the resource.
See also
-
identifier
(self) → str¶ A reference, URI, URL or some other mechanism to identify the resource.
See also
-
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
-
keywords
(self) → object¶ 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
-
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
-
links
(self) → object¶ Returns a list of online resources associated with the resource.
See also
-
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
-
readMetadataXml
(self, metadataElement: QDomElement) → bool¶ Sets state from DOM document.
Parameters: metadataElement – The DOM element corresponding to ``resourceMetadata’’ tag 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
-
setAbstract
(self, abstract: str)¶ Sets a free-form
abstract
(description) of the resource.See also
-
setCategories
(self, categories: Iterable[str])¶ Sets categories of the resource. Categories are stored using a special vocabulary ‘gmd:topicCategory’ in keywords.
See also
-
setContacts
(self, contacts: object)¶ Sets the list of
contacts
or entities associated with the resource. Any existing contacts will be replaced.See also
See also
-
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
-
setIdentifier
(self, identifier: str)¶ Sets the reference, URI, URL or some other mechanism to identify the resource.
See also
-
setKeywords
(self, keywords: object)¶ 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
-
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
-
setLinks
(self, links: object)¶ Sets the list of online resources associated with the resource. Any existing links will be replaced.
See also
See also
-
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
-
setTitle
(self, title: str)¶ Sets the human readable
title
(name) of the resource, typically displayed in search results.See also
-
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
-
title
(self) → str¶ Returns the human readable name of the resource, typically displayed in search results.
See also
-
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
-
writeMetadataXml
(self, metadataElement: QDomElement, document: QDomDocument) → bool¶ Stores state in a DOM node.
Parameters: - metadataElement – is a DOM element corresponding to ``resourceMetadata’’ tag
- document – is a the DOM document being written
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.
-
class