Yes, Composer does support some extensions to SPARQL for aggregates.
Some examples follow:

#count of all ?c matches
SELECT (count (?c) as ?n)
WHERE
{  ?p a :Person .
   ?p :hasChild ?c .
}

#count of ?c grouped by ?p
SELECT ?p (count (?c) as ?n)
WHERE
{  ?p a :Person .
   ?p :hasChild ?c .
} GROUP BY ?p

#sum of ?age divided by count of all matches
SELECT  (sum(?age)/count(*) as ?x)
WHERE
{ ?person a :Person .
  ?person :deathYear ?dyear .
  ?person :birthYear ?byear .
  LET (?age := ?dyear - ?byear)
}

You can run these against the kennedys.owl model in TBC's examples to
view the results.
-- Scott

On May 26, 12:52 pm, Jim <[email protected]> wrote:
> I looked for this in the archives and in help, and didn't find it...
>
> Is it possible with SparqlMotion to accumulate totals--if I have a
> hasAmount XXX  property, can I use the iteration capabilities (or
> other means) to get a ?total loaded with the sum of all of the XXX
> values?  (If so, is there already an example of this--my tests so far
> have not worked...).  It seems do-able, but my attempt is getting
> convoluted.
>
> Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TopBraid Composer Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/topbraid-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to