[ome-devel] Best way to store key/value pairs using StructuredAnnotations

Josh Moore josh at glencoesoftware.com
Tue Sep 21 08:25:09 BST 2010


Hi Curtis,

On Sep 20, 2010, at 11:24 PM, Curtis Rueden wrote:

> Hi everyone,
> 
> With Bio-Formats, we store all the "original metadata" as key/value pairs of
> strings, regardless of whether each pair can be standardized into OME-XML
> proper. We used to use semantic types to do this, but wanted to switch to
> using structured annotations instead. Hence, the way we are doing it now
> looks like this:
> 
>     <ListAnnotation ID="Annotation:0" Namespace="
> http://www.openmicroscopy.org/Schemas/SA/2010-06">
>        <AnnotationRef ID="Annotation:1"/>
>        <AnnotationRef ID="Annotation:2"/>
>     </ListAnnotation>
>     <CommentAnnotation ID="Annotation:1" Namespace="
> http://www.openmicroscopy.org/Schemas/SA/2010-06">
>        <Value>File Date</Value>
>     </CommentAnnotation>
>     <CommentAnnotation ID="Annotation:2" Namespace="
> http://www.openmicroscopy.org/Schemas/SA/2010-06">
>        <Value>4675473831286180171</Value>
>     </CommentAnnotation>


The "namespace" field is not for pointing at the SA namespace but rather to define what "Type" the annotation has. So, I think what you are actually going for here would be:

<TimestampAnnotation ID="..." Namespace="openmicroscopy.org/ExtraMetadata/FileData">
  <Value>...</Value>
</TimestampAnnotation>

> Where each key/value pair is stored as a ListAnnotation with two elements.
> Unfortunately, this notation is exceedingly verbose. Is there a better way
> we could structure things so that we don't need so much XML for each pair?
> Maybe using XMLAnnotations? For comparison, the old notation looked like
> this:
> 
>        <OriginalMetadata ID="OriginalMetadata:29" Name="Scale Factor for
> X" Value="1.0"/>
> 
> (with a small amount of boilerplate at the end defining the
> "OriginalMetadata" semantic type)

And you could also use an XML Annotation like this:

<XMLAnnotation ID="..." Namespace="openmicroscopy.org/ExtraMetadata">
 <ExtraMetadata xmlns="..." targetNamespace="..." ...>
    ...
 </ExtraMetadata>
</XMLAnnotation>

The question really becomes what's most usable for others after the fact.

> Thanks,
> Curtis

Cheers,
~Josh

P.S. I use "ExtraMetadata" simply as a clear example here. It could have as easily been "Foo".


More information about the ome-devel mailing list