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 10ED610DCC for ; Mon, 15 Jul 2013 13:45:11 +0000 (UTC) Received: (qmail 87232 invoked by uid 500); 15 Jul 2013 13:45:11 -0000 Delivered-To: apmail-clerezza-dev-archive@clerezza.apache.org Received: (qmail 86807 invoked by uid 500); 15 Jul 2013 13:45:07 -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 86797 invoked by uid 99); 15 Jul 2013 13:45:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jul 2013 13:45:06 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [213.238.45.90] (HELO r2-d2.netlabs.org) (213.238.45.90) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jul 2013 13:45:01 +0000 Received: (qmail 26469 invoked by uid 89); 15 Jul 2013 13:44:19 -0000 Received: from unknown (HELO mail-la0-f50.google.com) (farewellutopia@netlabs.org@209.85.215.50) by 0 with ESMTPA; 15 Jul 2013 13:44:19 -0000 Received: by mail-la0-f50.google.com with SMTP id ep20so4963045lab.23 for ; Mon, 15 Jul 2013 06:44:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding :x-gm-message-state; bh=rTME2QgelYUiINwpMi4a9siBRFc/HyULQ65XrVLzD4k=; b=R3KwTZRts+e9Ntg9dLx6W/w7eKpNTg+dOgfOcRuGBcWCN/TtlsglYUcZSCInxvAMCw fyAPdxniPJ/NxwrR4bNl2/9Qn9/034pMOMoqRKu1bVm279MCmLwhRveQ7QF0C6fATvy8 G+dI292r03zNxB17h4DuHY1EmtPlXRlRVxvigfr4vR1VHIN0WXa04Vn50vlA38A1uzV/ 8y8eQdlABhwdcVvRHbZ+J8F+sb7CedeYZQfmUu/cG8pYatKw6I9cC+bhHNrnm/lpwEcC 3qhtT4qOhGcS5oMicrv7apKRtwndzxfL95cCkP+YKMCl3x7SDL2NeozEkZrPEYtS/Dut M2zw== MIME-Version: 1.0 X-Received: by 10.152.88.78 with SMTP id be14mr25091731lab.19.1373895859331; Mon, 15 Jul 2013 06:44:19 -0700 (PDT) Received: by 10.152.125.144 with HTTP; Mon, 15 Jul 2013 06:44:19 -0700 (PDT) X-Originating-IP: [31.24.10.206] In-Reply-To: References: <51DFF7D8.5020008@xup.nl> <51E0029C.3060204@xup.nl> <51E01D73.1030905@xup.nl> <51E02B4D.6030407@xup.nl> <51E06B8C.5020001@xup.nl> <51E27639.1000504@xup.nl> Date: Mon, 15 Jul 2013 15:44:19 +0200 Message-ID: Subject: Re: ERROR: Quad: object cannot be null From: =?ISO-8859-1?Q?Reto_Bachmann=2DGm=FCr?= To: dev@clerezza.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQllwxBzYbSEFNAI0dp4b0FIekpPudCM1oYhb2ZgAHlkQuNUL8SvdycwLUWK9o54LCBbbgL1 X-Virus-Checked: Checked by ClamAV on apache.org It seems the following class is used to create a DatasetGraph dynamically: http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/cor= e/DynamicDatasets.html Reto On Mon, Jul 15, 2013 at 3:16 PM, Reto Bachmann-Gm=FCr wro= te: > Hi > > I'm just realizing that adding a FOM clause doesn't work for the update q= ueries. > > So i'm wondering how to best specify the default-graph URI o a per > query basis? We should find out how fuseki support the > default-graph-uri. > > Cheers, > Reto > > > > On Sun, Jul 14, 2013 at 7:12 PM, Reto Bachmann-Gm=FCr = wrote: >> Hi Minto >> >> I'm sorry for having introduced this problem. I just noticed that >> BaseTdbTcProvider completely ignored the specified default graph. Not >> sure what I thought exacly setting it to null. I guess it was the >> incomplete ste of setting it to the actually wanted default graph. >> >> The problem is that by the jena design we would need to prevent >> concurrent queries with different default graphs. So I think it might >> be better to add a FROM-clause to the query if the query doesn't >> already has one. This would require again some parsing. The preparser >> seems to be the place to do this. WDYT, can we do a solution that >> actually provided support for the specified default graph or should we >> first just provide a release that ignores it without NPE? >> >> >> Cheers, >> Reto >> >> On Sun, Jul 14, 2013 at 11:58 AM, Minto van der Sluis wro= te: >>> Hi Reto, >>> >>> If I am correct the NPE I discovered will always happens for fastlaned >>> queries on Jena TDB based TcProviders due to the following line present >>> in BaseTdbTcProvider.java: >>> >>> getDataset().setDefaultModel(null); >>> >>> The NPE can be clearly seen in DatasetImpl if model is null: >>> >>> @Override >>> public void setDefaultModel(Model model) >>> { >>> // Assumes single writer. >>> removeFromCache(dsg.getDefaultGraph()) ; >>> addToCache(model) ; >>> dsg.setDefaultGraph(model.getGraph()) ; >>> } >>> >>> Did you have anything special in mind when you added the null model? >>> >>> Regards, >>> >>> Minto >>> >>> Op 12-7-2013 23:50, Reto Bachmann-Gm=FCr schreef: >>>> Thanks Minto. I would rather not withdraw the release candidate but >>>> have a new release very soon (max a couple of weeks). >>>> >>>> Reto >>>> >>>> On Fri, Jul 12, 2013 at 10:48 PM, Minto van der Sluis w= rote: >>>>> Fixed this with commit r1502677 (CLEREZZA-802) >>>>> >>>>> Please have a close look. Might need to be part of the pending releas= e >>>>> as well. >>>>> >>>>> Regards, >>>>> >>>>> Minto >>>>> >>>>> Op 12-7-2013 18:14, Minto van der Sluis schreef: >>>>>> This time I end up with an NPE, see stack below. >>>>>> >>>>>> My changes resulted in the following >>>>>> >>>>>> public Object executeSparqlQuery(String query, TripleCollection >>>>>> defaultGraph, boolean forceFastlane) throws ParseException { >>>>>> TcProvider singleTargetTcProvider =3D null; >>>>>> if (forceFastlane) { >>>>>> singleTargetTcProvider =3D getSingleTargetTcProvider(); >>>>>> } else { >>>>>> final UriRef defaultGraphName =3D new >>>>>> UriRef("urn:x-temp:/kjsfadfhfasdffds"); >>>>>> SparqlPreParser sparqlPreParser =3D new SparqlPreParser(= this); >>>>>> final Set referencedGraphs =3D >>>>>> sparqlPreParser.getReferredGraphs(query, defaultGraphName); >>>>>> if ((referencedGraphs !=3D null) && >>>>>> (!referencedGraphs.contains(defaultGraphName))) { >>>>>> singleTargetTcProvider =3D >>>>>> getSingleTargetTcProvider(referencedGraphs); >>>>>> } >>>>>> } >>>>>> >>>>>> if ((singleTargetTcProvider !=3D null) && (singleTargetTcPro= vider >>>>>> instanceof QueryableTcProvider)) { >>>>>> return >>>>>> ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(que= ry, >>>>>> null); >>>>>> } >>>>>> final QueryEngine queryEngine =3D this.queryEngine; >>>>>> if (queryEngine !=3D null) { >>>>>> return queryEngine.execute(this, defaultGraph, query); >>>>>> } else { >>>>>> throw new NoQueryEngineException(); >>>>>> } >>>>>> } >>>>>> >>>>>> private TcProvider getSingleTargetTcProvider() { >>>>>> return providerList.first(); >>>>>> } >>>>>> >>>>>> I guess the following like in BaseTdbTcProvider.executeSparqlQuery()= is >>>>>> the culprit: >>>>>> >>>>>> getDataset().setDefaultModel(null); >>>>>> >>>>>> Stacktrace: >>>>>> >>>>>> java.lang.NullPointerException >>>>>> at >>>>>> com.hp.hpl.jena.sparql.core.DatasetImpl.addToCache(DatasetImpl.java:= 259) >>>>>> at >>>>>> com.hp.hpl.jena.sparql.core.DatasetImpl.setDefaultModel(DatasetImpl.= java:214) >>>>>> at >>>>>> org.apache.clerezza.rdf.jena.tdb.storage.BaseTdbTcProvider.executeSp= arqlQuery(BaseTdbTcProvider.java:39) >>>>>> at >>>>>> org.apache.clerezza.rdf.jena.tdb.storage.ScalableSingleTdbDatasetTcP= rovider.executeSparqlQuery(ScalableSingleTdbDatasetTcProvider.java:81) >>>>>> at >>>>>> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcM= anager.java:310) >>>>>> at >>>>>> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcM= anager.java:282) >>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >>>>>> Method)[:1.7.0_17] >>>>>> at >>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl= .java:57)[:1.7.0_17] >>>>>> at >>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce= ssorImpl.java:43)[:1.7.0_17] >>>>>> at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_17] >>>>>> at >>>>>> org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:= 54)[12:org.apache.aries.proxy.impl:1.0.0] >>>>>> at >>>>>> org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:11= 9)[12:org.apache.aries.proxy.impl:1.0.0] >>>>>> at >>>>>> org.apache.clerezza.rdf.core.access.$TcManager10360330.executeSparql= Query(Unknown >>>>>> Source)[181:org.apache.clerezza.rdf.core:0.13.0.SNAPSHOT] >>>>>> at >>>>>> nl.overheid.stelsel.digimelding.astore.storage.clerezza.ClerezzaStor= ageProvider.query(ClerezzaStorageProvider.java:250)[209:astore-storage-cler= ezza:0.7.0.SNAPSHOT] >>>>>> >>>>> >>>>> -- >>>>> ir. ing. Minto van der Sluis >>>>> Software innovator / renovator >>>>> Xup BV >>>>> >>>>> Mobiel: +31 (0) 626 014541 >>>>> >>>> >>> >>> >>> -- >>> ir. ing. Minto van der Sluis >>> Software innovator / renovator >>> Xup BV >>> >>> Mobiel: +31 (0) 626 014541 >>>