Closed simont closed 8 years ago
Looks like my logic to check for existing meta attributes was flipped:
// Add creates a new meta AVU triple, returns pointer to the created Meta struct
func (mc *MetaCollection) Add(m Meta) (*Meta, error) {
if er := mc.init(); er != nil {
return nil, er
}
_, er := mc.Get(m.Attribute)
if m.Attribute != "" && m.Value != "" && er != nil {
This has been fixed, thanks for the bug report!
Need to separate errors for preexisting attributes and empty Attribute, Value fields
I'm having some issues with creating new metadata using either dataObject.AddMeta() or mc.Add(). It seems that regardless of how I fill out the Attribute/Value/Units I get an error suggesting that I don't have the Attribute and Value (they are there), or that the attribute already exists (it doesn't, at least not in iRODS)
Snippet of relevant code, the attribute comes from the triple (which is a
[]string
) and in this particular example I am deliberately specifying the value and units so I know that they exist (ignoring the values of triple[1] and triple[2] for debugging purposes).the relevant log messages when I pass in a three element array containing the AVU, essentially trying to add a new A:V:U of
Organism:test:data
(though triple itself is["Organism","Mouse, ""]
)triple[0] = 'Organism' and the value and units are provided as strings so are specified, if I look in iRODS using imeta there is no 'Organism' metadata AVU triple that already exists for this object.
Any suggestions for what I might be missing? I haven't tried to see if this creation of new metadata objects work in a more isolated example, i.e. to see if there is something odd/unique about my code or environment as a whole that is the issue.
On the flips side, editing metadata triples that are already in iRODS (added via imeta) using the following approach is working fine, its just the creation of new metadata triples that appears to be causing the issue.