Michel; The red box indicates syntax errors, which are shown in the status bar at the bottom of Composer. The first syntax error is to encapsulate the AS statement with parentheses: SELECT (SUM(?cost) AS ?totalCost)
The second is to use the variable name ?arg1 - i.e. the "?" is missing. When a function is created, it exists in your ontology as a URI. Therefore you need to use a qname or full URI to name the function, i.e.: :sumFunction() or <http://myStuff.org/funct#sumFunction>() Give that a try. -- Scott On Mar 17, 8:11 am, Michel Bohms <[email protected]> wrote: > 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 <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
