Jonathan Koppenhofer created MARMOTTA-208:
---------------------------------------------

             Summary: Meta Put Webservice Deleting Tuples Incorrectly
                 Key: MARMOTTA-208
                 URL: https://issues.apache.org/jira/browse/MARMOTTA-208
             Project: Marmotta
          Issue Type: Bug
          Components: Platform
    Affects Versions: 3.0-incubating
         Environment: Windows, JDK 6, H2 database
            Reporter: Jonathan Koppenhofer
            Assignee: Sebastian Schaffert


If you use the Meta Put webservice to update your metadata, tuples that did not 
change between the existing metadata and the new metadata are removed, leaving 
on the tuples that changed as active for the subject.

To Reproduce:
# Use the Meta webservice to put some RDF metadata... For example...
 {code:xml}
  <rdf:RDF
        xmlns:context="http://localhost:8080/LMF/context/";
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
        xmlns:local="http://localhost:8080/LMF/resource/";
        xmlns:dc="http://purl.org/dc/elements/1.1/";>

<rdf:Description rdf:about="http://localhost:8080/LMF/resource/test:4";>
        <dc:title 
rdf:datatype="http://www.w3.org/2001/XMLSchema#string";>TESTING me with Linked 
Data</dc:title>
    <dc:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string";>this 
is a test of me</dc:description>
</rdf:Description>

</rdf:RDF>
{code}
# This should create 2 new tuples for the particular subject.
# Now use the exact same RDF document, and do it again... You will notice that 
all tuples for the subject are removed.
# Now change either the dc.title or dc.decsription values, and put the meta 
again. You will now notice the tuple exists for the changed value, but still 
does not exist for the value that was not changed.

In looking at the MetaWebService.java in the putMeta method, I notice it 
remove() for all tuples, and then right after add() for the new tuples all 
within the same transaction. It would seem the remove and the add being in the 
same transaction is causing the issue if you are removing a tuple you are 
simultaneously trying to add.

I made the change to...

# Remove tuples
# commit
# begin a new transaction
# add
# commit

... and it seemed to give me the expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to