Duplicate Metadata

I'm using the update_item() function in a plugin, but when it runs it seems to append too rather than overwrite the existing metadata. I've set
'overwriteElementTexts' => true
but it seems to have no impact. Is there some other way to force data overwrite that I'm missing?

Thanks,
Dean

That should do the trick. Could you post up or point to a bigger sample of the code? There might be something else going on.

Given the following metadata:

`$item_metadata = array(
'collection_id' => '1',
'item_type_id' => '1',
'tags' => '',
'public' => false,
'featured' => false,
'overwriteElementTexts' => true
);

$item_element_texts = array(
'Dublin Core'=>array(
'Title'=>array(array('text'=>$data['title'], 'html'=>true)),
'Description'=>array(array('text'=>$data['captio'], 'html'=>false)),
'Publisher'=>array(array('text'=>$data['reposi'], 'html'=>false)),
'Source'=>array(array('text'=>$data['reposi'], 'html'=>true))
)
);

$provider_url = 'http://dc.lib.unc.edu/cdm/compoundobject/collection/sohp/id/' . $data['dmrecord'];
$provider_name = $data['reposi'];
$provider = "<a href=\"$provider_url\">$provider_name</a>";
$item_element_texts['Dublin Core']['Publisher'] = array(
array('text'=>$provider, 'html'=>true)
);

$file_metadata = array(
'file_transfer_type' => 'Url',
'files' => trim($url->loc)
);`

It checks if the file already exists and updates if if does otherwise add the the record

if($exists && ($record_action == 'updated' || $record_action == '')) {
        $success = update_item($updated,     $item_metadata, $item_element_texts, $file_metadata);
    } else {
        $created = insert_item($item_metadata, $item_element_texts);
        $files_added = insert_files_for_item($created, 'Url', array(trim($url->loc)));

What it seems to do in practice is create, for example a second title field with the exact same values as the first one.

thanks,

Dean

hmm....that seems right. are the items getting to the correct collection and item type if those are updated?

They do, but I end up with something like this in the display:

Title: Cool item
Title: Cool item

I'm trying to implement the ResourceSync protocol, which comes at things from a file centric perspective. So, each file has its own entry in an XML file on other server. Files, say an mp3 and a transcript pdf of of the mp3 file can reference the same descriptive metadata. So it creates a record for the first file and uses the shared descriptive metadata file. Then the second file sees that a Item record has already been created and merely tries to update the Omeka Item info and add the 2nd file.

Here's what a small sample file might look like:
`
<?xml version="1.0" encoding="UTF-8"?>
2 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/ter ms/">
3 <rs:md capability="resourcelist" modified="2015-01-29T20:57:13+00:00"/>
4 <url>
5 <rs:ln href="http://dc.lib.unc.edu/unc/new_roots/baseline/16999.json" rel="describes"/>
6 <loc>http://dc.lib.unc.edu/utils/getfile/collection/sohp/id/16997/filename/17039.mp3</loc>
7 <lastmod>2012-12-11T21:39:12+00:00</lastmod>
8 <rs:md type="audio/mpeg" length="77893697" hash="45f18bdd71224c2be87e55391141af52"/>
9 </url>
10 <url>
11 <rs:ln href="http://dc.lib.unc.edu/unc/new_roots/baseline/16999.json" rel="describes"/>
12 <loc>http://dc.lib.unc.edu/utils/getfile/collection/sohp/id/16998/filename/17040.pdf</loc>
13 <lastmod>2012-12-11T21:39:12+00:00</lastmod>
14 <rs:md type="application/pdf" length="372462" hash="a6370cd3ca01b6eb733debf77ef13b17"/>
15 </url>
</urlset>

I hope that's in some way helpful.

Dean