QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
An abstract base class for metadata stores. More...
#include <qgsabstractmetadatabase.h>
Classes | |
struct | Address |
Metadata address structure. More... | |
struct | Contact |
Metadata contact structure. More... | |
struct | Link |
Metadata link structure. More... | |
Public Types | |
typedef QList< QgsAbstractMetadataBase::Contact > | ContactList |
A list of contacts. More... | |
typedef QMap< QString, QStringList > | KeywordMap |
Map of vocabulary string to keyword list. More... | |
typedef QList< QgsAbstractMetadataBase::Link > | LinkList |
A list of links. More... | |
Public Member Functions | |
virtual | ~QgsAbstractMetadataBase ()=default |
QString | abstract () const |
Returns a free-form description of the resource. More... | |
void | addContact (const QgsAbstractMetadataBase::Contact &contact) |
Adds an individual contact to the existing contacts. More... | |
void | addHistoryItem (const QString &text) |
Adds a single history text to the end of the existing history list. More... | |
void | addKeywords (const QString &vocabulary, const QStringList &keywords) |
Adds a list of descriptive keywords for a specified vocabulary. More... | |
void | addLink (const QgsAbstractMetadataBase::Link &link) |
Adds an individual link to the existing links. More... | |
QStringList | categories () const |
Returns categories of the resource. More... | |
virtual QgsAbstractMetadataBase * | clone () const =0 |
Clones the metadata object. More... | |
virtual void | combine (const QgsAbstractMetadataBase *other) |
Combines the metadata from this object with the metadata from an other object. More... | |
QgsAbstractMetadataBase::ContactList | contacts () const |
Returns a list of contact persons or entities associated with the resource. More... | |
QStringList | history () const |
Returns a freeform description of the history or lineage of the resource. More... | |
QString | identifier () const |
A reference, URI, URL or some other mechanism to identify the resource. More... | |
QgsAbstractMetadataBase::KeywordMap | keywords () const |
Returns the keywords map, which is a set of descriptive keywords associated with the resource. More... | |
QStringList | keywords (const QString &vocabulary) const |
Returns a list of keywords for the specified vocabulary. More... | |
QStringList | keywordVocabularies () const |
Returns a list of keyword vocabularies contained in the metadata. More... | |
QString | language () const |
Returns the human language associated with the resource. More... | |
QgsAbstractMetadataBase::LinkList | links () const |
Returns a list of online resources associated with the resource. More... | |
QString | parentIdentifier () const |
A reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. More... | |
virtual bool | readMetadataXml (const QDomElement &metadataElement) |
Sets state from DOM document. More... | |
bool | removeKeywords (const QString &vocabulary) |
Remove a vocabulary from the list. More... | |
void | setAbstract (const QString &abstract) |
Sets a free-form abstract (description) of the resource. More... | |
void | setCategories (const QStringList &categories) |
Sets categories of the resource. More... | |
void | setContacts (const QgsAbstractMetadataBase::ContactList &contacts) |
Sets the list of contacts or entities associated with the resource. More... | |
void | setHistory (const QStringList &history) |
Sets the freeform description of the history or lineage of the resource. More... | |
void | setIdentifier (const QString &identifier) |
Sets the reference, URI, URL or some other mechanism to identify the resource. More... | |
void | setKeywords (const QgsAbstractMetadataBase::KeywordMap &keywords) |
Sets the keywords map, which is a set of descriptive keywords associated with the resource. More... | |
void | setLanguage (const QString &language) |
Sets the human language associated with the resource. More... | |
void | setLinks (const QgsAbstractMetadataBase::LinkList &links) |
Sets the list of online resources associated with the resource. More... | |
void | setParentIdentifier (const QString &parentIdentifier) |
Sets a reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. More... | |
void | setTitle (const QString &title) |
Sets the human readable title (name) of the resource, typically displayed in search results. More... | |
void | setType (const QString &type) |
Sets the type (nature) of the resource. More... | |
QString | title () const |
Returns the human readable name of the resource, typically displayed in search results. More... | |
QString | type () const |
Returns the nature of the resource. More... | |
virtual bool | writeMetadataXml (QDomElement &metadataElement, QDomDocument &document) const |
Stores state in a DOM node. More... | |
Protected Member Functions | |
QgsAbstractMetadataBase ()=default | |
Constructor for QgsAbstractMetadataBase. More... | |
bool | equals (const QgsAbstractMetadataBase &other) const |
Tests whether the common metadata fields in this object are equal to other. More... | |
Protected Attributes | |
QString | mAbstract |
QgsAbstractMetadataBase::ContactList | mContacts |
QStringList | mHistory |
QString | mIdentifier |
QgsAbstractMetadataBase::KeywordMap | mKeywords |
Keywords map. More... | |
QString | mLanguage |
QgsAbstractMetadataBase::LinkList | mLinks |
QString | mParentIdentifier |
QString | mTitle |
QString | mType |
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.
Definition at line 56 of file qgsabstractmetadatabase.h.
typedef QMap< QString, QStringList > QgsAbstractMetadataBase::KeywordMap |
Map of vocabulary string to keyword list.
Definition at line 78 of file qgsabstractmetadatabase.h.
|
virtualdefault |
|
protecteddefault |
Constructor for QgsAbstractMetadataBase.
QgsAbstractMetadataBase cannot be instantiated directly, it must be subclassed.
QString QgsAbstractMetadataBase::abstract | ( | ) | const |
Returns a free-form description of the resource.
Definition at line 61 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::addContact | ( | const QgsAbstractMetadataBase::Contact & | contact | ) |
Adds an individual contact to the existing contacts.
Definition at line 143 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::addHistoryItem | ( | const QString & | text | ) |
Adds a single history text to the end of the existing history list.
Definition at line 81 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::addKeywords | ( | const QString & | vocabulary, |
const QStringList & | keywords | ||
) |
Adds a list of descriptive keywords for a specified vocabulary.
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.
Definition at line 96 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::addLink | ( | const QgsAbstractMetadataBase::Link & | link | ) |
Adds an individual link to the existing links.
Definition at line 158 of file qgsabstractmetadatabase.cpp.
QStringList QgsAbstractMetadataBase::categories | ( | ) | const |
Returns categories of the resource.
Categories are stored using a special vocabulary 'gmd:topicCategory' in keywords.
Definition at line 116 of file qgsabstractmetadatabase.cpp.
|
pure virtual |
|
virtual |
Combines the metadata from this object with the metadata from an other object.
Any existing values in this object will be overwritten by non-empty values from other.
Reimplemented in QgsProjectMetadata, and QgsLayerMetadata.
Definition at line 435 of file qgsabstractmetadatabase.cpp.
QList< QgsAbstractMetadataBase::Contact > QgsAbstractMetadataBase::contacts | ( | ) | const |
Returns a list of contact persons or entities associated with the resource.
Definition at line 133 of file qgsabstractmetadatabase.cpp.
|
protected |
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.
Definition at line 471 of file qgsabstractmetadatabase.cpp.
QStringList QgsAbstractMetadataBase::history | ( | ) | const |
Returns a freeform description of the history or lineage of the resource.
Definition at line 71 of file qgsabstractmetadatabase.cpp.
QString QgsAbstractMetadataBase::identifier | ( | ) | const |
A reference, URI, URL or some other mechanism to identify the resource.
Definition at line 21 of file qgsabstractmetadatabase.cpp.
QMap< QString, QStringList > QgsAbstractMetadataBase::keywords | ( | ) | const |
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.
Definition at line 86 of file qgsabstractmetadatabase.cpp.
QStringList QgsAbstractMetadataBase::keywords | ( | const QString & | vocabulary | ) | const |
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.
Definition at line 111 of file qgsabstractmetadatabase.cpp.
QStringList QgsAbstractMetadataBase::keywordVocabularies | ( | ) | const |
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.
Definition at line 106 of file qgsabstractmetadatabase.cpp.
QString QgsAbstractMetadataBase::language | ( | ) | const |
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.
Definition at line 163 of file qgsabstractmetadatabase.cpp.
QList< QgsAbstractMetadataBase::Link > QgsAbstractMetadataBase::links | ( | ) | const |
Returns a list of online resources associated with the resource.
Definition at line 148 of file qgsabstractmetadatabase.cpp.
QString QgsAbstractMetadataBase::parentIdentifier | ( | ) | const |
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.
Definition at line 31 of file qgsabstractmetadatabase.cpp.
|
virtual |
Sets state from DOM document.
metadataElement | The DOM element corresponding to `‘resourceMetadata’' tag |
true
if successfulSubclasses which override this method should take care to also call the base class method in order to read common metadata properties.
Reimplemented in QgsProjectMetadata, and QgsLayerMetadata.
Definition at line 173 of file qgsabstractmetadatabase.cpp.
bool QgsAbstractMetadataBase::removeKeywords | ( | const QString & | vocabulary | ) |
Remove a vocabulary from the list.
Definition at line 101 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setAbstract | ( | const QString & | abstract | ) |
Sets a free-form abstract (description) of the resource.
Definition at line 66 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setCategories | ( | const QStringList & | categories | ) |
Sets categories of the resource.
Categories are stored using a special vocabulary 'gmd:topicCategory' in keywords.
Definition at line 128 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setContacts | ( | const QgsAbstractMetadataBase::ContactList & | contacts | ) |
Sets the list of contacts or entities associated with the resource.
Any existing contacts will be replaced.
Definition at line 138 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setHistory | ( | const QStringList & | history | ) |
Sets the freeform description of the history or lineage of the resource.
Any existing history items will be overwritten.
Definition at line 76 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setIdentifier | ( | const QString & | identifier | ) |
Sets the reference, URI, URL or some other mechanism to identify the resource.
Definition at line 26 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setKeywords | ( | const QgsAbstractMetadataBase::KeywordMap & | keywords | ) |
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.
Definition at line 91 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setLanguage | ( | const QString & | language | ) |
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).
Definition at line 168 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setLinks | ( | const QgsAbstractMetadataBase::LinkList & | links | ) |
Sets the list of online resources associated with the resource.
Any existing links will be replaced.
Definition at line 153 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setParentIdentifier | ( | const QString & | parentIdentifier | ) |
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.
Definition at line 36 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setTitle | ( | const QString & | title | ) |
Sets the human readable title (name) of the resource, typically displayed in search results.
Definition at line 56 of file qgsabstractmetadatabase.cpp.
void QgsAbstractMetadataBase::setType | ( | const QString & | type | ) |
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'.
Definition at line 46 of file qgsabstractmetadatabase.cpp.
QString QgsAbstractMetadataBase::title | ( | ) | const |
Returns the human readable name of the resource, typically displayed in search results.
Definition at line 51 of file qgsabstractmetadatabase.cpp.
QString QgsAbstractMetadataBase::type | ( | ) | const |
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'.
Definition at line 41 of file qgsabstractmetadatabase.cpp.
|
virtual |
Stores state in a DOM node.
metadataElement | is a DOM element corresponding to `‘resourceMetadata’' tag |
document | is a the DOM document being written |
true
if successfulSubclasses which override this method should take care to also call the base class method in order to write common metadata properties.
Reimplemented in QgsProjectMetadata, and QgsLayerMetadata.
Definition at line 287 of file qgsabstractmetadatabase.cpp.
|
protected |
Definition at line 558 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 568 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 559 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 553 of file qgsabstractmetadatabase.h.
|
protected |
Keywords map.
Key is the vocabulary, value is a list of keywords for that vocabulary.
Definition at line 566 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 555 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 570 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 554 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 557 of file qgsabstractmetadatabase.h.
|
protected |
Definition at line 556 of file qgsabstractmetadatabase.h.