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/30 18:44:55 UTC
[18/50] [abbrv] git commit: merge
merge
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/49ddd164
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/49ddd164
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/49ddd164
Branch: refs/heads/master
Commit: 49ddd1645d2e88a824812085c5cd339435fd7ab4
Parents: 5f777a1 0c21ac9
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Wed Sep 11 17:20:52 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Wed Sep 11 17:20:52 2013 +0200
----------------------------------------------------------------------
.../marmotta/kiwi/model/rdf/KiWiLiteral.java | 15 +--
.../kiwi/persistence/KiWiConnection.java | 15 ++-
.../marmotta/kiwi/sail/KiWiValueFactory.java | 14 ++-
.../marmotta/kiwi/test/RepositoryTest.java | 80 +++++++++++++
.../kiwi/test/junit/DatabaseRunnerTest1.java | 50 ++++++++-
.../kiwi/test/junit/DatabaseRunnerTest2.java | 49 +++++++-
.../kiwi/test/junit/KiWiDatabaseRunner.java | 24 +++-
.../kiwi/test/sesame/KiWiLocaleTest.java | 111 +++++++++++++++++++
.../ldpath/api/functions/NodeFunction.java | 2 +-
.../marmotta/ldpath/api/tests/NodeTest.java | 1 +
.../api/transformers/NodeTransformer.java | 5 +-
.../ldpath/backend/file/ParserTest.java | 6 +-
.../java/org/apache/marmotta/ldpath/LDPath.java | 12 +-
.../ldpath/model/fields/FieldMapping.java | 23 +++-
.../model/functions/ConcatenateFunction.java | 3 +-
.../ldpath/model/functions/CountFunction.java | 3 +-
.../ldpath/model/functions/FirstFunction.java | 5 +-
.../ldpath/model/functions/LastFunction.java | 5 +-
.../ldpath/model/functions/SortFunction.java | 3 +-
.../marmotta/ldpath/model/programs/Program.java | 53 ++++++---
.../ldpath/model/tests/LiteralTypeTest.java | 15 ++-
.../tests/functions/BinaryNumericTest.java | 1 +
.../marmotta/ldpath/util/Collections.java | 3 +
.../at/newmedialab/ldpath/parser/rdfpath.jj | 77 +++++++------
.../BinaryNumericTestFunctionsTest.java | 4 +-
.../ldpath/model/functions/FunctionsTest.java | 16 +--
.../marmotta/ldpath/parser/ParserTest.java | 10 +-
.../marmotta/ldpath/parser/ProgramTest.java | 61 ++++++++++
.../marmotta/ldpath/parser/SelectorsTest.java | 2 +-
.../marmotta/ldpath/parser/TestsTest.java | 2 +-
.../marmotta/ldpath/test/AbstractTestBase.java | 14 +--
.../ldpath-core/src/test/resources/logback.xml | 2 +
.../src/test/resources/parse/program.ldpath | 20 ++--
.../model/functions/date/DateFunctionsTest.java | 6 +-
.../model/functions/html/HtmlFunctionsTest.java | 8 +-
.../model/functions/math/MathFunctionTest.java | 30 ++---
.../tests/functions/text/StringTestTest.java | 4 +-
.../xml/RemoveXmlTagsFunctionTest.java | 4 +-
.../model/functions/xml/XPathFunctionTest.java | 4 +-
.../js/widgets/configurator/configurator.coffee | 15 ++-
.../config/ConfigurationWebService.java | 2 +-
.../src/main/resources/web/admin/about.html | 18 +--
.../src/main/resources/web/admin/about.html | 41 ++++++-
43 files changed, 654 insertions(+), 184 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/49ddd164/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiConnection.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/49ddd164/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
----------------------------------------------------------------------
diff --cc libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
index 8568b51,f18413f..f501985
--- 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
@@@ -674,44 -673,83 +674,124 @@@ 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. It is similar to #testMARMOTTA283, but simulates the issue in more detail.
+ * See https://issues.apache.org/jira/browse/MARMOTTA-283
+ */
+ @Test
+ public void testMARMOTTA283_2() throws RepositoryException, RDFParseException, IOException, MalformedQueryException, UpdateExecutionException {
+
+ //insert quadruples
+ String insert =
+ "WITH <http://resource.org/video>" +
+ "INSERT {" +
+ " <http://resource.org/video> <http://ontology.org#hasFragment> <http://resource.org/fragment1>." +
+ " <http://resource.org/annotation1> <http://ontology.org#hasTarget> <http://resource.org/fragment1>." +
+ " <http://resource.org/annotation1> <http://ontology.org#hasBody> <http://resource.org/subject1>." +
+ " <http://resource.org/fragment1> <http://ontology.org#shows> <http://resource.org/subject1>." +
+ "} WHERE {}";
+
+ RepositoryConnection connectionInsert = repository.getConnection();
+ try {
+ Update u = connectionInsert.prepareUpdate(QueryLanguage.SPARQL, insert);
+ u.execute();
+ connectionInsert.commit();
+ } finally {
+ connectionInsert.close();
+ }
+
+ //update quadruples
+ String update =
+ "WITH <http://resource.org/video>" +
+ "DELETE { " +
+ " ?annotation ?p ?v." +
+ " ?fragment ?r ?s." +
+ " <http://resource.org/video> <http://ontology.org#hasFragment> ?fragment." +
+ "} INSERT {" +
+ " <http://resource.org/video> <http://ontology.org#hasFragment> <http://resource.org/fragment1>." +
+ " <http://resource.org/annotation1> <http://ontology.org#hasTarget> <http://resource.org/fragment1>." +
+ " <http://resource.org/annotation1> <http://ontology.org#hasBody> <http://resource.org/subject1>." +
+ " <http://resource.org/fragment1> <http://ontology.org#shows> <http://resource.org/subject1>." +
+ "} WHERE {" +
+ " ?annotation <http://ontology.org#hasTarget> ?fragment." +
+ " ?annotation ?p ?v." +
+ " OPTIONAL {" +
+ " ?fragment ?r ?s" +
+ " }" +
+ " FILTER (?fragment = <http://resource.org/fragment1>)" +
+ "} ";
+
+ RepositoryConnection connectionUpdate = repository.getConnection();
+ try {
+ Update u = connectionUpdate.prepareUpdate(QueryLanguage.SPARQL, update);
+ u.execute();
+ connectionUpdate.commit();
+ } finally {
+ connectionUpdate.close();
+ }
+
+ //check quadruples
+ RepositoryConnection connectionVerify = repository.getConnection();
+ try {
+ URI video = repository.getValueFactory().createURI("http://resource.org/video");
+ URI hasFragment = repository.getValueFactory().createURI("http://ontology.org#hasFragment");
+ URI fragment = repository.getValueFactory().createURI("http://resource.org/fragment1");
+ URI annotation = repository.getValueFactory().createURI("http://resource.org/annotation1");
+ URI hasTarget = repository.getValueFactory().createURI("http://ontology.org#hasTarget");
+ URI hasBody = repository.getValueFactory().createURI("http://ontology.org#hasBody");
+ URI subject = repository.getValueFactory().createURI("http://resource.org/subject1");
+ URI shows = repository.getValueFactory().createURI("http://ontology.org#shows");
+
+ Assert.assertTrue(connectionVerify.hasStatement(video,hasFragment,fragment,true,video));
+ Assert.assertTrue(connectionVerify.hasStatement(annotation,hasTarget,fragment,true,video));
+ Assert.assertTrue(connectionVerify.hasStatement(annotation,hasBody,subject,true,video));
+ Assert.assertTrue(connectionVerify.hasStatement(fragment,shows,subject,true,video));
+
+ connectionVerify.commit();
+ } finally {
+ connectionVerify.close();
+ }
+ }
+
++ /**
+ * Test the concurrent connection problem reported in MARMOTTA-236 for facading:
+ * - get two parallel connections
+ * - add triple in connection 1; should be available in connection 1 and not in connection 2
+ * - add same triple in connection 2; should be available in both, connection 1 and connection 2 or
+ * fail-fast by throwing a ConcurrentModificationException
+ * @throws Exception
+ */
+ @Test
+ public void testMARMOTTA236() throws Exception {
+ RepositoryConnection con1 = repository.getConnection();
+ RepositoryConnection con2 = repository.getConnection();
+
+ try {
+ URI r1 = repository.getValueFactory().createURI("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
+ URI r2 = repository.getValueFactory().createURI("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
+ URI r3 = repository.getValueFactory().createURI("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8));
+
+ con1.begin();
+ con1.add(r1,r2,r3);
+
+ Assert.assertTrue(con1.hasStatement(r1,r2,r3,true));
+
+ con2.begin();
+ Assert.assertFalse(con2.hasStatement(r1,r2,r3,true));
+
+ con2.add(r1,r2,r3);
+
+ Assert.assertTrue(con2.hasStatement(r1,r2,r3,true));
+
+ con2.rollback();
+ con1.commit();
+ } catch (ConcurrentModificationException ex) {
+
+ } finally {
+ con1.close();
+ con2.close();
+ }
+
+
+ }
}