Replying myself after reading the manual :)


I now first defined a subclass of sp:Functions called sumFunction.
Then I defined a spin:constraint for it: Argument sp:arg1 : House

Finally I defined a body for it (delete at House...):

SELECT SUM(?cost) AS ?totalCost
WHERE {
    arg1 :hasPart_transitive ?Part .
    ?Part :cost ?cost .
    OPTIONAL {
        ?Part :hasPart_directly ?anotherPart .
    } .
    FILTER (!bound(?anotherPart)) .
}

still 2 problems:

1. the box for the body stays red
2. at House: the box for the spin:rule:

CONSTRUCT {?this :totalCost ?totalCost } WHERE { LET (?totalCost :=
sumFunction (?this)).
}
is still red (despite the function is now known...).

Feel I am getting closer....thx for getting it to work!

Michel






On 17 mrt, 13:28, Michel Bohms <michel.bo...@gmail.com> wrote:
> Hi Holger,
>
> In earlier mails we discussed the determination of totalCost (of some
> 'whole') via a helper function.
>
> When I do as spin:rule:
>
> CONSTRUCT {?this :totalCost ?totalCost } WHERE { LET (?totalCost :=
> sumFunction (?this)).
>
> }
>
> it seems the box stays red although I defined:
>
> a spin:body
>
> SELECT SUM(?cost) AS ?totalCost
> WHERE {
>     ?this :hasPart_transitive ?Part .
>     ?Part :cost ?cost .
>     OPTIONAL {
>         ?part :hasPart_directly ?anotherPart .
>     } .
>     FILTER (!bound(?anotherPart)) .
>
> }
>
> clearly I am missing the "sumFuction" definition itself but how do I
> do that ? (assuming SUM is now implemented in the latest beta).
>
> (to refresh your memory: the idea was to calculate the cost of the
> whole by counting all the leaf part's cost via querying over the all
> transitive parts and then filter out the atomic leafs)
>
> thx a lot, Michel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TopBraid Composer Users" group.
To post to this group, send email to topbraid-composer-users@googlegroups.com
To unsubscribe from this group, send email to 
topbraid-composer-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/topbraid-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to