Thanks very much. Could a spin function be used instead of the subselect in
the first example?
Arthur
On Dec 14, 2009, at 5:21 PM, Scott Henninger wrote:
> Arthur; There are a couple of ways to do this. The first is through
> SELECT aggregates. Since aggregates are post-result set processing,
> you have to use a sub-select. For example, the following will create
> property that counts the number of children in the example
> kennedysSPIN model.
>
> CONSTRUCT { ?this :numberOfChildren ?n . }
> WHERE {
> { SELECT ?this (COUNT(?child) AS ?n)
> WHERE {
> ?this kennedys:child ?child .
> } GROUP BY ?this
> } .
> }
>
> Another approach is to use smf:countMatches, but is only applicable if
> a single triple pattern is specified (the aggregate will work with
> more complex queries):
>
> CONSTRUCT
> { ?this :numberOfChildren ?n .
> }
> WHERE
> { ?this kennedys:child ?child .
> LET (?n := smf:countMatches(?this, kennedys:child, ?x)) .
> }
>
> -- Scott
>
>
> On Dec 14, 3:35 pm, Arthur Keen <[email protected]> wrote:
>> I am looking for an example of how to do aggregation using SPIN. I need to
>> aggregate metrics in a part-whole hierarchy and would like to use SPIN rules
>> to do it. I have the aggregations working with SELECT, but have not found
>> any examples that use CONSTRUCT, so that I can encode the aggregations as
>> SPIN rules.
>>
>> Thanks
>> Arthur
>
> --
>
> 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.
>
>
--
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.