SPARQL 1.1 query question

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