I have a query like this: (assume prefixes are defined)
"SELECT DISTINCT ?opportunity ?status " +
"WHERE { ?u w:role \"Sales Rep\" . ?u w:participatedIn
?opportunity . ?opportunity w:customer \"IBM\" . " +
" ?opportunity w:status ?status ." +
"}";
That returns expected values:
[{opportunity=http://www.oracle.com/osn/osn.owl#Opportunity41,
status=Open^^http://www.w3.org/2001/XMLSchema#string},
{opportunity=http://www.oracle.com/osn/osn.owl#Opportunity40,
status=Open^^http://www.w3.org/2001/XMLSchema#string},
{opportunity=http://www.oracle.com/osn/osn.owl#Opportunity30,
status=Lost^^http://www.w3.org/2001/XMLSchema#string},
{opportunity=http://www.oracle.com/osn/osn.owl#Opportunity48,
status=Open^^http://www.w3.org/2001/XMLSchema#string},
{opportunity=http://www.oracle.com/osn/osn.owl#Opportunity6,
status=Lost^^http://www.w3.org/2001/XMLSchema#string},
{opportunity=http://www.oracle.com/osn/osn.owl#Opportunity18,
status=Lost^^http://www.w3.org/2001/XMLSchema#string}]
What I'd like to do is to count the number of 'Lost' and 'Open' values for this
query, so I have this:
"SELECT ?status (count (?status) as ?scount) " +
"WHERE { ?u w:role \"Sales Rep\" . ?u w:participatedIn
?opportunity . ?opportunity w:customer \"IBM\" . " +
" ?opportunity w:status ?status ." +
"} GROUP BY ?status";
But the counts are wrong:
[{status=Lost^^http://www.w3.org/2001/XMLSchema#string,
scount=5^^http://www.w3.org/2001/XMLSchema#integer},
{status=Open^^http://www.w3.org/2001/XMLSchema#string,
scount=7^^http://www.w3.org/2001/XMLSchema#integer}]
-----
How can I fix the above query to return the correct counts?
Thanks -
-- Cindy