Jody,

I have just added a new property function called tops:for that will  
help with such iterations. The syntax would be (in an  
sml:IterateOverSelect)

sml:selectQuery = SELECT ?index WHERE { ?index tops:for (1 10) }

to have the body of the loop repeated with ?index = [1..10] as input.  
The body could then have your sml:ApplyConstruct module which can  
access the ?index variable.

This will be published with beta 2 in February.

Holger


On Jan 1, 2009, at 7:33 PM, Jody wrote:

>
> The script I was making was to create test data for an ontology.  I
> was trying to create a user specified number of instances of type a
> certain class.  Scott, I was using the EnterLiteral module to get the
> number of instances.  This is similar to an example you all had put
> out for creating a TBC/Eclipse plugin.
>
> The loop I was looking for would allow me to run the Construct module
> a given number of times.  for(int i=0; i<x;i++)  It seems possible
> with the given modules but it's proving difficult to increment the
> count variable (i) once it is bound.
>
> On Dec 30 2008, 3:06 pm, Holger Knublauch <[email protected]>
> wrote:
>> Yes I believe we will need a bit more details to understand your use
>> case. You could potentially use sml:PerformUpdate to replace (DELETE/
>> INSERT) a triple that keeps track of the status. However that's  
>> pretty
>> difficult. The next TBC version (scheduled for tomorrow) will have a
>> module sml:IterateWhile that might be useful. But if you can confirm
>> your use case we may add another type of loop similar to a for-loop  
>> in
>> programming languages.
>>
>> Holger
>>
>> On Dec 30, 2008, at 11:58 AM, Scott Henninger wrote:
>>
>>
>>
>>> Jody;  The "already bound" error occurs because your BindBySelect
>>> module is trying to create the variable ?count, which was already
>>> created in EnterLiteral (or whatever you used to get the ?count  
>>> value
>>> from the user).
>>
>>> It's not clear how your script works, but you can perform your  
>>> change
>>> to ?count in the ApplyConstruct module.
>>
>>> -- Scott
>>
>>> On Dec 30, 12:25 pm, Jody <[email protected]> wrote:
>>>> How can I specify, in an elegant manner, that I want to iterate
>>>> over a
>>>> sub-script x times.
>>
>>>> Currently I am not using the iterateOverSelect because I haven't
>>>> wrapped my head around what variable I would bind.  Instead I'm
>>>> trying
>>>> to use a BranchByAsk.
>>
>>>> Here is the general flow:
>>>> Get the iteration number {?count} from the user
>>>> :next :BranchByAsk
>>>>      :askQuery ASK{ FILTER( ?count >= 0 ) }
>>>>      :else (Do nothing :mergeModule)
>>>>      :if :ApplyConstruct (this creates individuals of a certain  
>>>> type
>>>> referencing the ?count in buildURI())
>>>>          :next :BindBySelect (decrease the ?count variable using  
>>>> LET)
>>>>                  :next :BranchByAsk (complete loop and test again)
>>
>>>> I keep getting variable already bound errors in the :BindBySelect
>>>> module.  I've also tried replacing this with an :ApplyConstruct.
>>
>>>> Anybody have this figured out?
>>
>>>> Happy Holidays!
>>
>>>> - Jody
> >


--~--~---------~--~----~------------~-------~--~----~
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