Chris,
I like this idea. Sheryl came up with the same thing independently (great
minds!) when we were talking offline.
Comments inline...
On Jan 18, 2012, at 1:26 PM, Mattmann, Chris A (388J) wrote:
> Hey Ricky,
>
> On Jan 18, 2012, at 10:27 AM, Nguyen, Ricky wrote:
>
>> Hi all,
>>
>> Suppose I wanted to store a list of episodes in metadata. An episode has 2
>> properties: start time and end time. I can think of 2 ways to do this:
>>
>> 1) use sub-metadata groups
>> <key>Episode/1/start</key>
>> <val>2011-01-15</val>
>> <key>Episode/1/end</key>
>> <val>2011-01-16</val>
>> <key>Episode/2/start</key>
>> <val>2011-01-17</val>
>> <key>Episode/2/end</key>
>> <val>2011-01-18</val>
>>
>> 2) declare length, and follow key patterns EpStartN and EpEndN
>> <key>NumEpisodes</key>
>> <val>2</val>
>> <key>EpStart1</key>
>> <val>2011-01-15</val>
>
> Here's another way that I think will help with what your intended use
> of the metadata is (to query for it in the PGE, for example).
>
> <keyval>
> <key>EpisodeStartDateTime</key>
> <val>2011-01-17</val>
> <val>2011-01-18</val>
> </keyval>
>
> <keyval>
> <key>EpisodeEndDateTime</key>
> <val>TBD</val>
> <val>TBD</val>
> </keyval>
>
> Then, you just make sure to encode a commensurate number of values
> together in each metadata field, then you can basically pick one of the
> fields to interrogate and do something like:
>
> Metadata met;
> List<String> startDateTimes = met.getAllMetadata("EpsidodeStartDateTime") !=
> null ?
> met.getAllMetadata("EpsidodeStartDateTime"):new Vector<String>();
> List <String> endDateTimes = met.getAllMetadata("EpsidodeEndDateTime") !=
> null ?
> met.getAllMetadata("EpsidodeEndDateTime"):new Vector<String>();
>
> for(int i=0; i < startDateTimes.size() ; i++){
> // i == the episodeNum?
> // if it isn't, then just store an associated EpisodeNum field with the
> same
> // size as the start/end date time
> String startDateTime = startDateTimes.get(i);
> String endDateTime = endDateTimes.get(i);
> }
>
> Does that help?
<key>NumEpisodes</key>
<val>2</val>
would help with this.
>
>>
>> So then the next question is, how do I write elements.xml (in FileMgr
>> policy) to accommodate the variable number of keys?
>
> No need it assumes that by default, since it's a NoSQL type store :)
+1. With your proposed metadata, the _keys_ are still be pre-defined in
elements.xml as NumEpisodes, EpisodeStartTime, EpisodeEndTime. But now the
_values_ are multi-valued lists which can grow as necessary.
A related question: is there a way to use dynamic metadata keys, or must all
keys be predefined in elements.xml ?
>
>>
>> And a follow up question is, how do I retrieve/use this information when
>> creating PGE config queries? (SQL(Format='$whatgoeshere') SELECT
>> whatgoeshere FROM …)
>
> You can query that way and you'll just get back all the values (delimited by
> ",") and concatenated together.
+1. Your proposed metadata is easily query-able.
>
> Cheers,
> Chris
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Chris Mattmann, Ph.D.
> Senior Computer Scientist
> NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
> Office: 171-266B, Mailstop: 171-246
> Email: [email protected]
> WWW: http://sunset.usc.edu/~mattmann/
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Adjunct Assistant Professor, Computer Science Department
> University of Southern California, Los Angeles, CA 90089 USA
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
---------------------------------------------------------------------
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain confidential
or legally privileged information. Any unauthorized review, use, disclosure
or distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of this original
message.
---------------------------------------------------------------------