incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reto Bachmann-Gmuer <reto.bachm...@trialox.org>
Subject Re: [Users] Sparql & BNodes
Date Tue, 02 Mar 2010 14:17:10 GMT
Hi Oli

No this is not possible. The scope of a bnode in a sparql result set
is the result set, it contains no pointer to the respective node in
the graph. So you should request all properties of the node with the
original query, maybe an optional clause would help?

If you need to have a permanent reference to a node, that node must be
a UriRef.

Cheers,
reto

On Tue, Mar 2, 2010 at 2:25 PM, Oliver Strässer
<oliver.straesser@getunik.com> wrote:
> I have a Sparql Query, that counts BNodes:
>
>
>
>
>
>         SimpleSelectQuery selectQuery = new SimpleSelectQuery();
>
>
>
>         Variable vMAStatistics = new Variable("vMAStatistics");
>
>         Variable vDefaultEvent = new Variable("vDefaultEvent");
>
>         Variable vEvent        = new Variable("vEvent");
>
>
>
>         Set<TriplePattern> patterns = new HashSet<TriplePattern>();
>
>         patterns.add(new SimpleTriplePattern(uri,
> MACCSTATS.mobileAppStatistic, vMAStatistics));
>
>         patterns.add(new SimpleTriplePattern(vMAStatistics,
> MACCSTATS.defaultEvent, vDefaultEvent));
>
>         patterns.add(new SimpleTriplePattern(vDefaultEvent, MACCSTATS.event,
> vEvent));
>
>
>
>         BasicGraphPattern bgp = new SimpleBasicGraphPattern(patterns);
>
>         SimpleGroupGraphPattern queryPattern = new
> SimpleGroupGraphPattern();
>
>         queryPattern.addGraphPattern(bgp);
>
>
>
>         selectQuery.setQueryPattern(queryPattern);
>
>         // wich fields we want to get
>
>         selectQuery.addSelection(vEvent);
>
>
>
>         // Execute Query
>
>        ResultSet resultSet = tcManager.executeSparqlQuery(selectQuery,
> graph);
>
>
>
>         while (resultSet.hasNext()) {
>
>             t = resultSet.next();
>
>
>
>             GraphNode gnEvent = new GraphNode(t.get("vEvent"), graph);
>
>             Iterator<Resource> iterPhone =
> gnEvent.getObjects(MACCSTATS.phone);
>
>
>
>             while (iterPhone.hasNext()){
>
>             }
>
>         }
>
>
>
>
>
>
>
> Is it possible that i can select or get the BNode "vEvent ", so that i can
> get the objects or can't i access the predicates  because it's an BNode
> (what i think)?
>
> I tried different Casts, but it wouldn't work.
>
>
>
> cheers
>
> Oli
>
>
>
>
>
>
>
> --getunik ag-------------------------------------------
>   oliver straesser              oliver.straesser@getunik.com
>
>   hardturmstrasse 101    fon: +41 (0)44 388 55 88
>   ch-8005 zuerich              fax: +41 (0)44 388 55 89
>
>    --aktuelles getunik projekt-------------------------
>
>    Agieren Sie lokal! Geo Marketing für Ihre E-Mail Kampagne:
> www.geomarketing.com
>
>
>
>  --best of swiss web awards 2009------------------
>
>    Gold & Silber für Connect2Earth / Bronze für WWF UK
>
>
>
> we make the web a better place - www.getunik.com
>
>
>
>
>
>
>
>
>
> *****************************************************************
>
> P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es
> Ihnen.
>
> *****************************************************************
>
>
>
> _______________________________________________
> Users mailing list
> Users@lists.trialox.org
> http://lists.trialox.org/mailman/listinfo/users
>
>

Mime
View raw message