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 EDFC9CFDB for ; Sun, 14 Jul 2013 17:13:15 +0000 (UTC) Received: (qmail 25147 invoked by uid 500); 14 Jul 2013 17:13:15 -0000 Delivered-To: apmail-clerezza-dev-archive@clerezza.apache.org Received: (qmail 25088 invoked by uid 500); 14 Jul 2013 17:13:15 -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 25080 invoked by uid 99); 14 Jul 2013 17:13:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jul 2013 17:13:14 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= X-Spam-Check-By: apache.org Received-SPF: error (nike.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; Sun, 14 Jul 2013 17:13:07 +0000 Received: (qmail 23297 invoked by uid 89); 14 Jul 2013 17:12:25 -0000 Received: from unknown (HELO mail-la0-f46.google.com) (farewellutopia@netlabs.org@209.85.215.46) by 0 with ESMTPA; 14 Jul 2013 17:12:25 -0000 Received: by mail-la0-f46.google.com with SMTP id eg20so8930789lab.19 for ; Sun, 14 Jul 2013 10:12:24 -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=WAbvUG9ph8i9z6ALY+Psb3dHNDXhx8yeGMofU6edry4=; b=fAKNbyAHVnytL373Sx6zMmR6lrppGOfcpj2/l/Q50QdsXA1JACxJrng8rWrT8BIgIk cKeA2VFk6m8o4+/CkSjn6j0rBZJZwjUSXKttBt4XJ2891/bLEmMB2XYIg6wrc3jfGqQc dCAdCQ3QL40vhFnLKCKT0IUHx9EmoodHdfbbFkM62iflFL/eyVyiwxlLis726hpOg3dT PhpsC1hUJnF24Iroys7oAZIRmOhjeQQrXf/Y1HR1B/0Jl/HDZGuBFMS7Rja+juFzNHTO zHaI08QtRENBfUiWV8BB4xTf3eaEsJNAy4U1ilU/9YwwwwUULO/znLbxZDworBkYCKu6 aeUQ== MIME-Version: 1.0 X-Received: by 10.112.88.169 with SMTP id bh9mr22793107lbb.12.1373821944294; Sun, 14 Jul 2013 10:12:24 -0700 (PDT) Received: by 10.152.125.144 with HTTP; Sun, 14 Jul 2013 10:12:24 -0700 (PDT) X-Originating-IP: [31.24.10.206] In-Reply-To: <51E27639.1000504@xup.nl> 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: Sun, 14 Jul 2013 19:12:24 +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: ALoCoQkPpT/cCdPTYmKpCwEY2cte4b0QK+PYydEDFvIsLVlRQEJ8nUMwrJlrYJKUr+MLNOT2uPra X-Virus-Checked: Checked by ClamAV on apache.org 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 wrote: > 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 wro= te: >>> Fixed this with commit r1502677 (CLEREZZA-802) >>> >>> Please have a close look. Might need to be part of the pending release >>> 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(th= is); >>>> final Set referencedGraphs =3D >>>> sparqlPreParser.getReferredGraphs(query, defaultGraphName); >>>> if ((referencedGraphs !=3D null) && >>>> (!referencedGraphs.contains(defaultGraphName))) { >>>> singleTargetTcProvider =3D >>>> getSingleTargetTcProvider(referencedGraphs); >>>> } >>>> } >>>> >>>> if ((singleTargetTcProvider !=3D null) && (singleTargetTcProvi= der >>>> instanceof QueryableTcProvider)) { >>>> return >>>> ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query= , >>>> 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() i= s >>>> the culprit: >>>> >>>> getDataset().setDefaultModel(null); >>>> >>>> Stacktrace: >>>> >>>> java.lang.NullPointerException >>>> at >>>> com.hp.hpl.jena.sparql.core.DatasetImpl.addToCache(DatasetImpl.java:25= 9) >>>> at >>>> com.hp.hpl.jena.sparql.core.DatasetImpl.setDefaultModel(DatasetImpl.ja= va:214) >>>> at >>>> org.apache.clerezza.rdf.jena.tdb.storage.BaseTdbTcProvider.executeSpar= qlQuery(BaseTdbTcProvider.java:39) >>>> at >>>> org.apache.clerezza.rdf.jena.tdb.storage.ScalableSingleTdbDatasetTcPro= vider.executeSparqlQuery(ScalableSingleTdbDatasetTcProvider.java:81) >>>> at >>>> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcMan= ager.java:310) >>>> at >>>> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcMan= ager.java:282) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >>>> Method)[:1.7.0_17] >>>> at >>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j= ava:57)[:1.7.0_17] >>>> at >>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess= orImpl.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:119)= [12:org.apache.aries.proxy.impl:1.0.0] >>>> at >>>> org.apache.clerezza.rdf.core.access.$TcManager10360330.executeSparqlQu= ery(Unknown >>>> Source)[181:org.apache.clerezza.rdf.core:0.13.0.SNAPSHOT] >>>> at >>>> nl.overheid.stelsel.digimelding.astore.storage.clerezza.ClerezzaStorag= eProvider.query(ClerezzaStorageProvider.java:250)[209:astore-storage-clerez= za: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 >