You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/09/09 17:46:42 UTC

[1/2] git commit: try reproducting MARMOTTA-283

Updated Branches:
  refs/heads/develop 71d76587c -> d34df1dcc


try reproducting MARMOTTA-283


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/9117321a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/9117321a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/9117321a

Branch: refs/heads/develop
Commit: 9117321a5434daf8a2d738dbd6613f402d9288ad
Parents: 28a108f
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Mon Sep 9 17:46:18 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Mon Sep 9 17:46:18 2013 +0200

----------------------------------------------------------------------
 .../marmotta/kiwi/test/RepositoryTest.java      | 55 ++++++++++++++++++--
 1 file changed, 51 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/9117321a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
index f8817b7..fba985a 100644
--- a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
+++ b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
@@ -66,7 +66,7 @@ import com.google.common.collect.Iterables;
 
 /**
  * Test the Sesame repository functionality backed by the KiWi triple store. 
- * 
+ *
  * @author Sebastian Schaffert (sschaffert@apache.org)
  */
 @RunWith(KiWiDatabaseRunner.class)
@@ -76,7 +76,7 @@ public class RepositoryTest {
 
     private Repository repository;
 
-	private KiWiStore store;
+    private KiWiStore store;
 
     private final KiWiConfiguration kiwiConfiguration;
 
@@ -85,10 +85,10 @@ public class RepositoryTest {
 
     }
 
-	@Before
+    @Before
     public void initDatabase() throws RepositoryException {
         store = new KiWiStore(kiwiConfiguration);
-		repository = new SailRepository(store);
+        repository = new SailRepository(store);
         repository.initialize();
     }
 
@@ -622,4 +622,51 @@ public class RepositoryTest {
 
     }
 
+    /**
+     * This test is for a strange bug that happens when running SPARQL updates that delete and reinsert a triple in
+     * the same transaction. See https://issues.apache.org/jira/browse/MARMOTTA-283
+     */
+    @Test
+    public void testMARMOTTA283() throws RepositoryException, RDFParseException, IOException, MalformedQueryException, UpdateExecutionException {
+
+        InputStream rdfXML = this.getClass().getResourceAsStream("demo-data.foaf");
+        assumeThat("Could not load test-data: demo-data.foaf", rdfXML, notNullValue(InputStream.class));
+
+        RepositoryConnection connectionRDF = repository.getConnection();
+        try {
+            connectionRDF.add(rdfXML, "http://localhost/foaf/", RDFFormat.RDFXML);
+            connectionRDF.commit();
+        } finally {
+            connectionRDF.close();
+        }
+
+
+        String update = "DELETE { ?s ?p ?o } INSERT { <http://localhost:8080/LMF/resource/hans_meier> <http://xmlns.com/foaf/0.1/name> \"Hans Meier\" . <http://localhost:8080/LMF/resource/hans_meier> <http://xmlns.com/foaf/0.1/based_near> <http://dbpedia.org/resource/Traunstein> } WHERE { ?s ?p ?o . FILTER ( ?s = <http://localhost:8080/LMF/resource/hans_meier> ) }";
+
+        RepositoryConnection connectionUpdate = repository.getConnection();
+        try {
+            Update u = connectionUpdate.prepareUpdate(QueryLanguage.SPARQL, update);
+            u.execute();
+            connectionUpdate.commit();
+        } finally {
+            connectionUpdate.close();
+        }
+
+        // now there should be two triples
+        RepositoryConnection connectionVerify = repository.getConnection();
+        try {
+            URI hans_meier = repository.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
+            URI foaf_name  = repository.getValueFactory().createURI("http://xmlns.com/foaf/0.1/name");
+            URI foaf_based_near = repository.getValueFactory().createURI("http://xmlns.com/foaf/0.1/based_near");
+            URI traunstein = repository.getValueFactory().createURI("http://dbpedia.org/resource/Traunstein");
+
+            Assert.assertTrue(connectionVerify.hasStatement(hans_meier,foaf_name,null, true));
+            Assert.assertTrue(connectionVerify.hasStatement(hans_meier,foaf_based_near,traunstein, true));
+
+            connectionVerify.commit();
+        } finally {
+            connectionVerify.close();
+        }
+    }
+
 }


[2/2] git commit: Merge remote-tracking branch 'origin/develop' into develop

Posted by ss...@apache.org.
Merge remote-tracking branch 'origin/develop' into develop


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/d34df1dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/d34df1dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/d34df1dc

Branch: refs/heads/develop
Commit: d34df1dcc45572b55b6a025b644dfcf6b0091b28
Parents: 9117321 71d7658
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Mon Sep 9 17:46:30 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Mon Sep 9 17:46:30 2013 +0200

----------------------------------------------------------------------
 .../marmotta/platform/sparql/webservices/SparqlWebService.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------