Interface DublinCore

All Known Implementing Classes:
DublinCoreCatalog

@ParametersAreNonnullByDefault public interface DublinCore
This interface is mainly intended to encapsulate Dublin Core metadata, but it is also capable of maintaining proprietary metadata alongside the Dublin Core.

Dublin Core is an initiative to create a digital "library card catalog" for the Web. Dublin Core, in its simple form, is made up of 15 metadata (data that describes data) elements that offer expanded cataloging information and improved document indexing for search engine programs.

Two forms of Dublin Core exist: Simple Dublin Core and Qualified Dublin Core. Simple Dublin Core expresses properties as literal strings using just the 15 metadata elements from the Dublin Core Metadata Element Sets. Each element can have multiple values, but order is defined. Values may have an associated language.
Please see http://dublincore.org/documents/dces/ for further information.

Qualified Dublin Core increases the specificity of metadata by extending the set of properties (elements) and by adding information about encoding schemes. While enabling searches to be more specific, qualifiers are also more complex and can pose challenges to interoperability.
Please see http://dublincore.org/documents/dcmi-terms/ and http://dublincore.org/documents/dc-xml-guidelines/ Section 5 for further information.

Current limitations

  • This interface assumes that Dublin Core metadata is stored as XML. According to the Dublin Core specification this is not necessary.
  • Encoding schemes aren't fully supported yet.
  • Field Details

  • Method Details

    • get

      List<String> get(EName property, String language)
      Get all values of a property, either in a certain language or in all contained languages.
      Parameters:
      property - the property qname
      language - a language code, LANGUAGE_UNDEFINED or LANGUAGE_ANY
      Returns:
      a list of values which is empty if the property is not set
    • get

      List<DublinCoreValue> get(EName property)
      Get all values of a property no matter what language they have.
      Parameters:
      property - the property's expanded name
      Returns:
      a list of values
    • getValues

      Map<EName,List<DublinCoreValue>> getValues()
      Get all contained values grouped by property.
    • getValuesFlat

      List<DublinCoreValue> getValuesFlat()
      Get all values as a flat list.
    • getFirst

      @Nullable String getFirst(EName property, String language)
      Like get(EName, String) but returns only the first value of the list. This method is intended to be a convenience method for those properties that have only one value.

      Please note, that if you pass LANGUAGE_ANY, values with an undefined language are returned preferably.

      Parameters:
      property - the property's expanded name
      language - a language code, LANGUAGE_UNDEFINED or LANGUAGE_ANY
      Returns:
      the value or null
    • getFirst

      @Nullable String getFirst(EName property)
      Get the first value of a property, no matter what language it is in. Like a call of getFirst(EName, String) with language = LANGUAGE_ANY. Please not that values with an undefined language are returned preferably.
      Parameters:
      property - the property's expanded name
      Returns:
      the value or null
      See Also:
    • getFirstVal

      @Nullable DublinCoreValue getFirstVal(EName property)
      Get the first value of a property, no matter what language it is in. Like a call of getFirst(EName, String) with language = LANGUAGE_ANY. Please not that values with an undefined language are returned preferably.
      Parameters:
      property - the property's expanded name
      Returns:
      the value or null
      See Also:
    • getAsText

      @Nullable String getAsText(EName property, String language, String delimiter)
      Return all values separated by a delimiter.
      Parameters:
      property - the property's expanded name
      language - a language code, LANGUAGE_UNDEFINED or LANGUAGE_ANY
      delimiter - a delimiter
      Returns:
      the concatenated values or null (FIXME bad API. Should not return null)
    • getLanguages

      Set<String> getLanguages(EName property)
      Return all languages this property has values in.
      Parameters:
      property - the property's expanded name
      Returns:
      a set of languages which may be empty in case the property does not have any value. Note that the state of having no language defined (LANGUAGE_UNDEFINED) is treated like a language.
    • hasMultipleValues

      boolean hasMultipleValues(EName property, String language)
      Check, if a property has multiple values assigned.
      Parameters:
      property - the property's expanded name
      language - a language code, LANGUAGE_UNDEFINED or LANGUAGE_ANY
    • hasMultipleValues

      boolean hasMultipleValues(EName property)
      Check if a property has multiple values, ignoring any language information.
      Parameters:
      property - the property's expanded name
    • hasValue

      boolean hasValue(EName property, String language)
      Check if a property has at least one value assigned.
      Parameters:
      property - the property's expanded name
      language - a language code, LANGUAGE_UNDEFINED or LANGUAGE_ANY
    • hasValue

      boolean hasValue(EName property)
      Check if a property has at least on value without language information assigned. Like a call of hasValue(EName) with language = LANGUAGE_ANY
      Parameters:
      property - the property's expanded name
    • set

      void set(EName property, @Nullable String value, String language)
      Set a property to the given value, overwriting an existing value in the given language.

      Please note that it is not allowed to pass LANGUAGE_ANY as language.

      Parameters:
      property - the property's expanded name
      value - the value or null to remove all values of the given language for this property
      language - a language code or LANGUAGE_UNDEFINED
    • set

      void set(EName property, @Nullable String value)
      Set a value without language information to a property, overwriting an existing value. This is like calling set(EName, String, String) with language = LANGUAGE_UNDEFINED
      Parameters:
      property - the property's expanded name
      value - the value or null to remove all values of LANGUAGE_UNDEFINED for this property
    • set

      void set(EName property, @Nullable DublinCoreValue value)
      Set a property to a value, overwriting an existing value.
      Parameters:
      property - the property's expanded name
      value - the value or null to completely remove the property (all values in all languages)
    • set

      void set(EName property, List<DublinCoreValue> values)
      Set a property to a list of values, overwriting any existing.
      Parameters:
      property - the property's expanded name
      values - the values or an empty list
    • add

      void add(EName property, String value, String language)
      Add a value to a property.

      Please note that it is not allowed to pass LANGUAGE_ANY as language.

      Parameters:
      property - the property's expanded name
      value - the value
      language - a language code or LANGUAGE_UNDEFINED
    • add

      void add(EName property, String value)
      Add a value without language information to a property. This is like calling add(EName, String, String) with language = LANGUAGE_UNDEFINED
      Parameters:
      property - the property's expanded name
      value - the value
    • add

      void add(EName property, DublinCoreValue value)
      Add a value to a property.
      Parameters:
      property - the property's expanded name
      value - the value
    • remove

      void remove(EName property, String language)
      Remove values of a property.
      • LANGUAGE_ANY: remove the whole element
      • LANGUAGE_UNDEFINED: remove only values with no language information
      • language code: remove values of that language
      Parameters:
      property - the property's expanded name
      language - a language code, LANGUAGE_UNDEFINED or LANGUAGE_ANY
    • remove

      void remove(EName property)
      Remove a complete property.
      Parameters:
      property - the property's expanded name
    • clear

      void clear()
      Clear the Dublin Core
    • getProperties

      Set<EName> getProperties()
      Return all contained properties.
      Returns:
      a set of property names