File indexing completed on 2024-04-21 04:01:01

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef SYNDICATION_RDF_DUBLINCORE_H
0009 #define SYNDICATION_RDF_DUBLINCORE_H
0010 
0011 #include <syndication/rdf/resourcewrapper.h>
0012 
0013 #include <QStringList>
0014 
0015 #include <ctime>
0016 
0017 class QString;
0018 
0019 namespace Syndication
0020 {
0021 namespace RDF
0022 {
0023 class Resource;
0024 //@cond PRIVATE
0025 typedef QSharedPointer<Resource> ResourcePtr;
0026 //@endcond
0027 
0028 /**
0029  * A resource wrapper providing convenient
0030  * access to Dublin Core metadata.
0031  *
0032  * For more information on Dublin Core, see
0033  * http://dublincore.org/
0034  */
0035 class DublinCore : public ResourceWrapper
0036 {
0037 public:
0038     /**
0039      * creates a dublin core convenience wrapper for a resource
0040      *
0041      * @param resource the resource to wrap
0042      */
0043     explicit DublinCore(ResourcePtr resource);
0044 
0045     /**
0046      * virtual destructor
0047      */
0048     ~DublinCore() override;
0049 
0050     /**
0051      * A name given to the resource.
0052      * Typically, a Title will be a name by which the resource is
0053      * formally known.
0054      */
0055     QString title() const;
0056 
0057     /**
0058      * "An entity primarily responsible for making the content of
0059      * the resource.
0060      * Examples of a Creator include a person, an organisation,
0061      * or a service.
0062      * Typically, the name of a Creator should be used to
0063      * indicate the entity."
0064      */
0065     QString creator() const;
0066 
0067     /**
0068      * like creator(), but returns all dc:creator properties,
0069      * not only one.
0070      */
0071     QStringList creators() const;
0072 
0073     /**
0074      * "A date associated with an event in the life cycle of the resource.
0075      * Typically, Date will be associated with the creation or
0076      * availability of the resource.  Recommended best practice
0077      * for encoding the date value is defined in a profile of
0078      * ISO 8601 [W3CDTF] and follows the YYYY-MM-DD format."
0079      */
0080     time_t date() const;
0081 
0082     /**
0083      * "An account of the content of the resource.
0084      * Description may include but is not limited to: an abstract,
0085      * table of contents, reference to a graphical representation
0086      * of content or a free-text account of the content."
0087      */
0088     QString description() const;
0089 
0090     /**
0091      * "The topic of the content of the resource.
0092      * Typically, a Subject will be expressed as keywords,
0093      * key phrases or classification codes that describe a topic
0094      * of the resource.
0095      * Recommended best practice is to select a value from a
0096      * controlled vocabulary or formal classification scheme."
0097      */
0098     QString subject() const;
0099 
0100     /**
0101      * like subject(), but returns all dc:subject properties,
0102      * not only one.
0103      */
0104     QStringList subjects() const;
0105 
0106     /**
0107      * "An entity responsible for making contributions to the content of the
0108      * resource.
0109      * Examples of a Contributor include a person, an organisation, or a
0110      * service. Typically, the name of a Contributor should be used to
0111      * indicate the entity."
0112      * */
0113     QString contributor() const;
0114 
0115     /**
0116      * like contributor(), but returns all dc:contributor properties,
0117      * not only one.
0118      */
0119     QStringList contributors() const;
0120 
0121     /**
0122      * "Information about rights held in and over the resource.
0123      * Typically, a Rights element will contain a rights
0124      * management statement for the resource, or reference
0125      * a service providing such information. Rights information
0126      * often encompasses Intellectual Property Rights (IPR),
0127      * Copyright, and various Property Rights.
0128      * If the Rights element is absent, no assumptions can be made
0129      * about the status of these and other rights with respect to
0130      * the resource."
0131      */
0132     QString rights() const;
0133 
0134     /**
0135      * "A language of the intellectual content of the resource.
0136      * Recommended best practice for the values of the Language
0137      * element is defined by RFC 1766 [RFC1766] which includes
0138      * a two-letter Language Code (taken from the ISO 639
0139      * standard [ISO639]), followed optionally, by a two-letter
0140      * Country Code (taken from the ISO 3166 standard [ISO3166]).
0141      * For example, 'en' for English, 'fr' for French, or
0142      * 'en-uk' for English used in the United Kingdom."
0143      */
0144     QString language() const;
0145 
0146     /**
0147      * "The extent or scope of the content of the resource.
0148      * Coverage will typically include spatial location (a place name
0149      * or geographic coordinates), temporal period (a period label,
0150      * date, or date range) or jurisdiction (such as a named
0151      * administrative entity).
0152      * Recommended best practice is to select a value from a
0153      * controlled vocabulary (for example, the Thesaurus of Geographic
0154      * Names [TGN]) and that, where appropriate, named places or time
0155      * periods be used in preference to numeric identifiers such as
0156      * sets of coordinates or date ranges."
0157      */
0158     QString coverage() const;
0159 
0160     /**
0161      * "The physical or digital manifestation of the resource.
0162      * Typically, Format may include the media-type or dimensions of
0163      * the resource. Format may be used to determine the software,
0164      * hardware or other equipment needed to display or operate the
0165      * resource. Examples of dimensions include size and duration.
0166      * Recommended best practice is to select a value from a
0167      * controlled vocabulary (for example, the list of Internet Media
0168      * Types [MIME] defining computer media formats).
0169      */
0170     QString format() const;
0171 
0172     /**
0173      * "An unambiguous reference to the resource within a given context.
0174      * Recommended best practice is to identify the resource by means
0175      * if a string or number conforming to a formal identification
0176      * system.
0177      * Example formal identification systems include the Uniform
0178      * Resource Identifier (URI) (including the Uniform Resource
0179      * Locator (URL)), the Digital Object Identifier (DOI) and the
0180      * International Standard Book Number (ISBN).
0181      */
0182     QString identifier() const;
0183 
0184     /**
0185      * "An entity responsible for making the resource available.
0186      * Examples of a Publisher include a person, an organisation, or a
0187      * service. Typically, the name of a Publisher should be used to
0188      * indicate the entity."
0189      */
0190     QString publisher() const;
0191 
0192     /**
0193      * "A reference to a related resource.
0194      * Recommended best practice is to reference the resource by means
0195      * of a string or number conforming to a formal identification
0196      * system."
0197      */
0198     QString relation() const;
0199 
0200     /**
0201      * A Reference to a resource from which the present resource
0202      * is derived.
0203      * The present resource may be derived from the Source resource
0204      * in whole or in part.  Recommended best practice is to reference
0205      * the resource by means of a string or number conforming to a
0206      * formal identification system.
0207      */
0208     QString source() const;
0209 
0210     /**
0211      * "The nature or genre of the content of the resource.
0212      * Type includes terms describing general categories, functions,
0213      * genres, or aggregation levels for content. Recommended best
0214      * practice is to select a value from a controlled vocabulary
0215      * (for example, the working draft list of Dublin Core Types
0216      * [DCT1]). To describe the physical or digital manifestation
0217      * of the resource, use the FORMAT element."
0218      */
0219     QString type() const;
0220 
0221     /**
0222      * returns a debug string describing the available DC metadata
0223      * for debugging purposes
0224      *
0225      * @return debug string
0226      */
0227     QString debugInfo() const;
0228 };
0229 
0230 } // namespace RDF
0231 } // namespace Syndication
0232 
0233 #endif // SYNDICATION_RDF_DUBLINCORE_H