incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Strässer <oliver.straes...@getunik.com>
Subject Sparql & BNodes
Date Tue, 02 Mar 2010 13:25:48 GMT
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<mailto: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<http://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<http://www.getunik.com/>




*****************************************************************
P Bitte drucken Sie dieses E-Mail nur bei Bedarf aus. Die Umwelt dankt es Ihnen.
*****************************************************************


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message