Hi,

Last weekend I spent some time thinking about our Metadata class and
more generally the handling of metadata in Tika. To summarize my
thoughts, here's a list of things I think are important for metadata
handling in Tika.

0) Metadata in Tika is always about the document being parsed.

1) Metadata should consist of a modifiable set of keys mapped to values.

2) Metadata keys should be designed to avoid collisions or misspellings.

3) It should be possible to store non-String metadata, like Locale
settings, Date instances, thumbnail images, etc.

4) We should document and enforce a standard set of metadata keys,
based on Dublin Core and other standards where possible.

5) It should be easy to extend the set of metadata keys to include
custom metadata.

6) All metadata keys (both standard and custom) should be clearly
documented with the expected value type and recommended usage.

7) No two distinct metadata keys should be used for the same metadata semantics.

8) The Metadata class should have convenience methods for accessing
the most commonly used metadata.

The current Metadata class fails somewhat with 2 (there's even a
SpellCheckedMetadata class) and doesn't support 3 or 8. The constants
in o.a.tika.metadata interfaces go some way towards 4 and 6, but not
as far as they could. And we don't do that well on 7.

So in general I think there's much that we could improve on. To
resolve most of the issues I'd like to modify metadata handling as
follows:

a) Allow both metadata keys and values to be arbitrary Objects.

b) Instead of String constants as metadata keys, use constant object
instances like DublinCore.TITLE = new DublinCore("title"). These
objects should have good hashCode(), equals(), and toString()
implementations.

c) Use Date instances for date metadata, URI instances for URIs, etc.
All value objects should preferably have good toString()
implementations.

d) Use the Dublin Core "identifier" property instead of the current
RESOURCE_NAME_KEY, and the "format" property instead of CONTENT_TYPE.

e) Add utility methods like set/getIdentifier(), set/getFormat(),
set/getTitle(), etc. to the Metadata class for accessing the key
Dublin Core metadata.

WDYT?

BR,

Jukka Zitting

Reply via email to