Yes, this convention has been introduced to make some functions more convenient, reducing the number of arguments. For example, this approach allows you to define a cardinality function that only needs the property as argument - the subject would be ?this.
Keep in mind though that calling such functions only makes sense within "object-oriented" SPIN queries such as spin:rule and spin:constraint, because they are context sensitive. Holger On Mar 18, 2009, at 12:49 AM, Bohms, H.M. (Michel) wrote: > > > Hi Scott, > I deleted the argument stuff (call and definition) and indeed: same > behaviour. > I understand "?this" but I had not thought that its binding would > have been known within the local scope of the defined function. So > now I see its global for both the calling query and the executing > function. > > Ch/Michel > > > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected] > ] On Behalf Of Scott Henninger > Sent: 17 March 2009 18:30 > To: TopBraid Composer Users > Subject: [tbc-users] Re: own functions in spin:rules > > > Yes. The way ?this works is that it is applied to all instances of > the class. You defined your sumFunction to be used with SPIN so > that a query defined for a class is applied to all instances of the > class. > > Another way to see how ?this works is to copy/paste your sumFunction > construct query into the SPARQL Tab. Run the query then choose > instances of the class. With each choice the constructed triple > will change so that ?this is bound to the chosen resource. This is > a good way to edit/debug your SPIN rules. > > I.e. ?this applies to a "chosen resource" and SPIN defines the > "chosen resource" to be all instance of the class the spin:rule is > defined on. > > -- Scott > > On Mar 17, 11:35 am, "Bohms, H.M. (Michel)" <[email protected]> > wrote: >> Great, it works now. >> >> Wrt your argument issue: is that because the function works already >> implicitly on "?this" ? >> >> Thanks for getting it to work! Michel >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Scott >> Henninger >> Sent: 17 March 2009 17:26 >> To: TopBraid Composer Users >> Subject: [tbc-users] Re: own functions in spin:rules >> >> In terms of the sumFunction not working, there are a number of >> things going on in the file you sent. The most important is the >> type of the spin function (sumFunction) is defined as owl:Class. >> It needs to be spin:Function. >> >> The argument defined in sumFunction is not necessary, as it is not >> used in the query, but will not hurt anything. >> >> -- Scott >> >>> But when executing: no error, but when I try to look at an >>> individual for its derived value (totalCost of say House1): >>> Operation Failed, Reason: Could not execute query; attempt >>> to get a CONSTRUCT model from a slect query. >> >> This e-mail and its contents are subject to the DISCLAIMER >> athttp://www.tno.nl/disclaimer/email.html > > This e-mail and its contents are subject to the DISCLAIMER at > http://www.tno.nl/disclaimer/email.html > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
