You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Tim Allison (JIRA)" <ji...@apache.org> on 2015/05/27 13:43:17 UTC

[jira] [Commented] (TIKA-1640) Make ExternalParser support aliases for key names in extracted metadata

    [ https://issues.apache.org/jira/browse/TIKA-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560816#comment-14560816 ] 

Tim Allison commented on TIKA-1640:
-----------------------------------

Might be useful to add properties, too?

{code:xml}
<aliases>
  <metadata key="foo" aliasInterface="org.apache.tika.metadata.TikaCoreProperties" aliasProperty="MODIFIED"/>
</aliases>
{code}

Don't know if this adds too much complexity, but it would be nice to  encourage the move away from strings as metadata keys.

If we assume interfaces, something like this could offer a start to this solution.
 
{code}
        try {
            Class tcp = Class.forName("org.apache.tika.metadata.TikaCoreProperties");
            Field field = tcp.getField("COMMENTS");
            Object objProp = field.get(null);
            if (objProp instanceof Property) {
                Property prop = (Property) objProp;
                System.out.println("SUCCESS: " + prop.getName());
            }

        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

{code}



> Make ExternalParser support aliases for key names in extracted metadata
> -----------------------------------------------------------------------
>
>                 Key: TIKA-1640
>                 URL: https://issues.apache.org/jira/browse/TIKA-1640
>             Project: Tika
>          Issue Type: Improvement
>          Components: parser
>            Reporter: Chris A. Mattmann
>            Assignee: Tim Allison
>             Fix For: 1.9
>
>
> Over in TIKA-1639, we were discussing the work outside of Tika that [~rgauss] did (per [~gagravarr]) on the EXIFTool parsing. I added support in TIKA-1639 for this, but one thing Ray's code-based work did that my config oriented work didn't is allow for renaming extracted metadata key names to better support having consistent metadata across parsers.
> Here's one way to do it:
> ExternalParser could have a config section like so:
> {code:xml}
> <aliases>
>   <metadata key="foo" alias="bar"/>
>   <metadata key="foo2" alias="bar2"/>
> </aliases>
> {code}
> Then this could be used to rename metadata keys.
> I'll implement that in this issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)