- From: Bob DuCharme <bob@snee.com>
- Date: Fri, 08 Oct 2010 10:24:02 -0400
- To: Michael Ransom <mransom@revelytix.com>
- CC: public-lod@w3.org
You can try this yourself with ARQ. Your query uses the property
abc:hasMember, which makes sense in the context of each triple, but your
data uses the the property abc:hasMembers, so the query won't find them.
Once those were corrected in the data and the prefixes were declared,
the following query did what you wanted:
PREFIX abc: <http://www.example.com/ns/abc#>
SELECT ?league (COUNT (?member) AS ?membercount)
WHERE {
?league abc:hasMember ?member .
} GROUP BY ?league
Bob
On 10/7/2010 12:02 PM, Michael Ransom wrote:
> 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.
Received on Friday, 8 October 2010 14:44:34 UTC