W3C home > Mailing lists > Public > public-lod@w3.org > October 2010

SPARQL 1.1 query question

From: Michael Ransom <mransom@revelytix.com>
Date: Thu, 7 Oct 2010 12:02:21 -0400
Message-ID: <AANLkTi=0eWnjGLt+S7Cx8kF-_oYR=83M9gQuFkBmFSHe@mail.gmail.com>
To: public-lod@w3.org
Hello All,

I have a question about SPARQL 1.1 queries.




If have the following triples:

:LeagueA abc:hasMembers :Alice,
:Bob,
:Carol .
:LeagueB abc:hasMembers :Dante,
:Edward.




If I want the following table of results:

?league          ?membercount
LeagueA          3
LeagueB          2




Given the data and my desired results, will the following SPARQL 1.1
query work?

SELECT ?league (COUNT(?member) AS ?membercount)
WHERE {
SELECT ?league ?member
WHERE {
?league abc:hasMember ?member . } GROUP BY ?league
}




Whether or not this query works, is there a way I can write this query
without a subquery?




Thank you.
-- 
Michael Ransom
Ontologist
Revelytix, Inc.
Work: 410.584.0099
Cell: 410.591.6878
Personal Email: michael.evan.ransom@gmail.com
Work Email: mransom@revelytix.com
Skype: michael.evan.ransom
Received on Thursday, 7 October 2010 17:32:54 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 31 March 2013 14:24:29 UTC