Return-Path: X-Original-To: apmail-clerezza-dev-archive@www.apache.org Delivered-To: apmail-clerezza-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8CD5710387 for ; Tue, 3 Dec 2013 15:14:16 +0000 (UTC) Received: (qmail 31114 invoked by uid 500); 3 Dec 2013 15:14:15 -0000 Delivered-To: apmail-clerezza-dev-archive@clerezza.apache.org Received: (qmail 31034 invoked by uid 500); 3 Dec 2013 15:14:13 -0000 Mailing-List: contact dev-help@clerezza.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@clerezza.apache.org Delivered-To: mailing list dev@clerezza.apache.org Received: (qmail 31014 invoked by uid 99); 3 Dec 2013 15:14:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 15:14:12 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [213.238.45.90] (HELO r2-d2.netlabs.org) (213.238.45.90) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 15:14:04 +0000 Received: (qmail 5321 invoked by uid 89); 3 Dec 2013 15:13:38 -0000 Received: from unknown (HELO mail-la0-f45.google.com) (farewellutopia@netlabs.org@209.85.215.45) by 0 with ESMTPA; 3 Dec 2013 15:13:38 -0000 Received: by mail-la0-f45.google.com with SMTP id eh20so9089356lab.4 for ; Tue, 03 Dec 2013 07:13:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Nc4P59by0fBdN8rW+6VLcVLv7+65sEX0KfgUKiLaJIc=; b=DmhEHNjJh4k5t83NR+0W6UEdeSdZyMo2CAFP4XDHEaYBz0QQ0k6O8JkRw7YayWadc1 opr/QkrxMwJFyJbdUQ74b6zgMDPJ8pDehpWreyBZG/SGLBcBU50K3uwP35bUA4nmzXnA hyAPy3yalA3HPSeWIhHZIQ14aPx6Ebj7LpCSEUppSWoRUkMi2kTUQEF5WgfjhdNQzblE r/cZN0OSW8bBR5uHYqm2FD76UJz72HoRu5z+qz0zfg7eas4UYtPgb8lHU2KzRS7rRCj7 l2lBg8rdAsLB8WLP1y1Q9IV0jhsMReYXSUR1FQsbmN7sDksnHcjytG2IRd1RrO9OIr4j zlqQ== X-Gm-Message-State: ALoCoQmWlslpJE8oZngVrwQ6T/Qc9ITdmiDe5dWfJ4LG6e1uHS4uA/T4IH1ofXhzoCN/+kD+aTNf MIME-Version: 1.0 X-Received: by 10.112.156.162 with SMTP id wf2mr201751lbb.30.1386083618244; Tue, 03 Dec 2013 07:13:38 -0800 (PST) Received: by 10.152.28.166 with HTTP; Tue, 3 Dec 2013 07:13:38 -0800 (PST) X-Originating-IP: [31.24.10.92] In-Reply-To: References: <5271077E.5090506@xup.nl> Date: Tue, 3 Dec 2013 16:13:38 +0100 Message-ID: Subject: Re: Problem with SingleTdbDatasetProvider From: =?ISO-8859-1?Q?Reto_Bachmann=2DGm=FCr?= To: dev@clerezza.apache.org Content-Type: multipart/alternative; boundary=001a11c33f7eb1dcb804eca2bd80 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c33f7eb1dcb804eca2bd80 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable So here's some code to reproduced the ConcurrentModificationException directly with jena (using transactions): String directory =3D "target/Dataset1"; Dataset dataset =3D TDBFactory.createDataset(directory); { dataset.begin(ReadWrite.WRITE); Model foo1 =3D ModelFactory.createDefaultModel(); foo1.add(RDFS.Class, RDF.type, RDFS.Class); foo1.add(RDFS.Class, RDF.type, RDFS.Resource); dataset.addNamedModel(URNXFOO1, foo1); dataset.commit(); dataset.end(); } { dataset.begin(ReadWrite.WRITE); Model foo2 =3D ModelFactory.createDefaultModel(); dataset.addNamedModel(URNXFOO2, foo2); dataset.commit(); dataset.end(); } { dataset.begin(ReadWrite.WRITE); Model foo1 =3D dataset.getNamedModel(URNXFOO1); Model foo2 =3D dataset.getNamedModel(URNXFOO2); StmtIterator iter =3D foo1.listStatements(); while (iter.hasNext()) { foo2.add(iter.nextStatement()); } dataset.commit(); dataset.end(); } On Wed, Oct 30, 2013 at 2:42 PM, Reto Bachmann-Gm=FCr wro= te: > Hi Minto > > Interesting problem you have there. >> > > Thanks ;) > >> >> Best is to fix the dreaded ConcurrentModificationException. Occasionally >> I run into it it als well. But most probably it is not that trivial to >> solve. >> > > On hand we had some concurrency issues that caused the exception. I fixed > (some of) them recently, the tests are now passing. > > On the other hand the exception is coming from Jena (as well as as from > java collections) if the dataset (respectively the collection) is modifie= d > while iterating over it. Inthe case of addAll the modification of the > underlying dataset is necessary, so this is not about some > timing/concurrency. > > Cheers, > Reto > > > > >> >> The only work around that I see is copy the MGraph to a different >> provider and do the normal addAll(). This other provider does not >> necessarily need to be in memory. Basically it is 2x addAll(). One to a >> different provider and one back. >> >> My knowledge is too limited to comment on forwarding it to Jena. >> >> Hope this is of some help to you. >> >> Regards, >> >> Minto >> >> Reto Bachmann-Gm=FCr schreef op 30-10-2013 12:46: >> > Hi >> > >> > I'm having a problem using addAll two add one Mgraph from >> > SingeTdbDatasetProvider to another such MGraph. >> > >> > The problem is that the iterator over that added graph will return a >> > ConcurrentModificationException as soon as a triple has been added to >> the >> > target graph. >> > >> > I don't know how to solve this. Copying the graph to be added to memor= y >> > doesn't seem to be a compealing solution. Maybe the add-all could be >> > forwarded to Jena but this would solve the problem only in some cases, >> not >> > if there is any wrapper on the added graph or if union-graphs are used= . >> > >> > Cheers, >> > Reto >> > >> >> >> -- >> ir. ing. Minto van der Sluis >> Software innovator / renovator >> Xup BV >> >> Mobiel: +31 (0) 626 014541 >> >> > --001a11c33f7eb1dcb804eca2bd80--