Ivan,

That works wonderfully, thank you!  I could've sworn I tried count(*) (which
works, too) but I was probably changing too many variables at once trying to
troubleshoot this.  Your second query definitely was one of the ones I tried
and makes the most sense to me.


Thanks again,

Matt

--
Matt Mullins
Computer Science Department, Western Washington University

On Thu, Aug 6, 2009 at 9:06 PM, Ivan Mikhailov <[email protected]>wrote:

> Hello Matt,
>
> Aggregating by grouped expression is formally senseless and should
> signal an error, The problem is that the error is not signaled, the
> error diagnostics should be improved. The compiler go crazy and result
> from one grouping is used for all groups.
>
> This works:
>
> SELECT
>     ?label ?uri count(1) as ?count
>  FROM
>     <http://dbpedia.org/pagelinks#>
>  WHERE {
>     ?uri skos:subject <http://dbpedia.org/resource/Category:Pasta> .
>     ?uri rdfs:label ?label .
>     ?link dbpedia2:wikilink ?uri .
>     FILTER (langMatches(lang(?label), "en"))
>  }
>  GROUP BY ?label ?uri
>  ORDER BY ?count
>
> Best Regards,
> Ivan.
>
> P.S. The real bug is that correct query
>
> SELECT
>     ?label ?uri count(?link) as ?count
> FROM
>     <http://dbpedia.org/pagelinks#>
> WHERE {
>     ?uri skos:subject <http://dbpedia.org/resource/Category:Pasta> .
>     ?uri rdfs:label ?label .
>     ?link dbpedia2:wikilink ?uri .
>     FILTER (langMatches(lang(?label), "en"))
> }
> GROUP BY ?label ?uri
> ORDER BY ?count
>
> does not work :|
>
>
>
> On Thu, 2009-08-06 at 15:40 -0400, Kingsley Idehen wrote:
> > Matt Mullins wrote:
> > > Hello,
> > >
> > > I'm having a little trouble forming a query that will tally how many
> > > pagelinks there are per page.  The following query works to grab the
> > > links themselves:
> > >
> > > SELECT
> > >     ?label ?uri ?link
> > > FROM
> > >     <http://dbpedia.org/pagelinks#>
> > > WHERE {
> > >     ?uri skos:subject <http://dbpedia.org/resource/Category:Pasta> .
> > >     ?uri rdfs:label ?label .
> > >     ?link dbpedia2:wikilink ?uri .
> > >     FILTER (langMatches(lang(?label), "en"))
> > > }
> > >
> > > And this one works to grab what seem to be accurate counts:
> > >
> > > SELECT
> > >     ?label ?uri count(?uri) as ?count
> > > FROM
> > >     <http://dbpedia.org/pagelinks#>
> > > WHERE {
> > >     ?uri skos:subject <http://dbpedia.org/resource/Category:Pasta> .
> > >     ?uri rdfs:label ?label .
> > >     ?link dbpedia2:wikilink ?uri .
> > >     FILTER (langMatches(lang(?label), "en"))
> > > }
> > > GROUP BY ?label ?uri
> > >
> > > But when I try to order these results by count, all counts are the
> > > same (6 in this case):
> > >
> > > SELECT
> > >     ?label ?uri count(?uri) as ?count
> > > FROM
> > >     <http://dbpedia.org/pagelinks#>
> > > WHERE {
> > >     ?uri skos:subject <http://dbpedia.org/resource/Category:Pasta> .
> > >     ?uri rdfs:label ?label .
> > >     ?link dbpedia2:wikilink ?uri .
> > >     FILTER (langMatches(lang(?label), "en"))
> > > }
> > > GROUP BY ?label ?uri
> > > ORDER BY ?count
> > >
> > > Any ideas?  It's still a little boggling to me how aggregates are
> > > supposed to work...  I'm probably just butchering the documentation
> > > [1] and interpreting it incorrectly.
> > >
> > >
> > > Matt
> > >
> > > [1] http://docs.openlinksw.com/virtuoso/rdfsparqlaggregate.html
> >
> > Matt,
> >
> > Its a darn bug :-(
> >
> >
> > Kingsley
> >
> > >
> > >
> > > --
> > > Matt Mullins
> > > Computer Science Department, Western Washington University
> > >
> ------------------------------------------------------------------------
> > >
> > >
> ------------------------------------------------------------------------------
> > > Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> > > trial. Simplify your report design, integration and deployment - and
> focus on
> > > what you do best, core application coding. Discover what's new with
> > > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > Dbpedia-discussion mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
> > >
> >
> >
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to