You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by neha gupta <ne...@gmail.com> on 2016/08/03 09:17:41 UTC

Querysoloution return same individual

Select *  + where {  ?Employee   rdf:type  emp:Employee }";This return
three individuals.

I use then it to assign to three radiobuttons but it assign one (same)
individual to all three radiobuttons. Where is the mistake in code.

while(result.hasNext()) {

 QuerySolution sol = result.nextSolution();

 RDFNode x=sol.getResource("?Employee");
 RDFNode x2=sol.getResource("?Employee");
RDFNode x3=sol.getResource("?Employee");
 rd1.setText(x.toString());
 rd2.setText(x2.toString());
rd3.setText(x3.toString());

Re: Querysoloution return same individual

Posted by Andy Seaborne <an...@apache.org>.
As Lorenz says.

Each loopiteration has one value of ?Employee

Set one radio button per loop.

	Andy

On 03/08/16 10:52, neha gupta wrote:
> I think loop will not be then appropriate for me because I want all three
> radio buttons to be populated at once. This all happens under button click
> event so if button is pressed, three individuals should be assigned to
> three radios.
>
> On Wed, Aug 3, 2016 at 2:46 AM, Lorenz Buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> If you loop over a set of individuals, why do you assign in each iteration
>> three times the same value to all radio buttons? In one iteration you have
>> only one individual, thus, you can assign this value only to one
>> radiobutton.
>>
>>
>>
>> On 03.08.2016 11:17, neha gupta wrote:
>>
>>> Select *  + where {  ?Employee   rdf:type  emp:Employee }";This return
>>> three individuals.
>>>
>>> I use then it to assign to three radiobuttons but it assign one (same)
>>> individual to all three radiobuttons. Where is the mistake in code.
>>>
>>> while(result.hasNext()) {
>>>
>>>   QuerySolution sol = result.nextSolution();
>>>
>>>   RDFNode x=sol.getResource("?Employee");
>>>   RDFNode x2=sol.getResource("?Employee");
>>> RDFNode x3=sol.getResource("?Employee");
>>>   rd1.setText(x.toString());
>>>   rd2.setText(x2.toString());
>>> rd3.setText(x3.toString());
>>>
>>>
>>
>


Re: Querysoloution return same individual

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
You have to loop first to get all individuals. You can put it into a 
list and then use the list to assign values for your radiobuttons.


On 03.08.2016 11:52, neha gupta wrote:
> I think loop will not be then appropriate for me because I want all three
> radio buttons to be populated at once. This all happens under button click
> event so if button is pressed, three individuals should be assigned to
> three radios.
>
> On Wed, Aug 3, 2016 at 2:46 AM, Lorenz Buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> If you loop over a set of individuals, why do you assign in each iteration
>> three times the same value to all radio buttons? In one iteration you have
>> only one individual, thus, you can assign this value only to one
>> radiobutton.
>>
>>
>>
>> On 03.08.2016 11:17, neha gupta wrote:
>>
>>> Select *  + where {  ?Employee   rdf:type  emp:Employee }";This return
>>> three individuals.
>>>
>>> I use then it to assign to three radiobuttons but it assign one (same)
>>> individual to all three radiobuttons. Where is the mistake in code.
>>>
>>> while(result.hasNext()) {
>>>
>>>    QuerySolution sol = result.nextSolution();
>>>
>>>    RDFNode x=sol.getResource("?Employee");
>>>    RDFNode x2=sol.getResource("?Employee");
>>> RDFNode x3=sol.getResource("?Employee");
>>>    rd1.setText(x.toString());
>>>    rd2.setText(x2.toString());
>>> rd3.setText(x3.toString());
>>>
>>>


Re: Querysoloution return same individual

Posted by neha gupta <ne...@gmail.com>.
I think loop will not be then appropriate for me because I want all three
radio buttons to be populated at once. This all happens under button click
event so if button is pressed, three individuals should be assigned to
three radios.

On Wed, Aug 3, 2016 at 2:46 AM, Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de> wrote:

> If you loop over a set of individuals, why do you assign in each iteration
> three times the same value to all radio buttons? In one iteration you have
> only one individual, thus, you can assign this value only to one
> radiobutton.
>
>
>
> On 03.08.2016 11:17, neha gupta wrote:
>
>> Select *  + where {  ?Employee   rdf:type  emp:Employee }";This return
>> three individuals.
>>
>> I use then it to assign to three radiobuttons but it assign one (same)
>> individual to all three radiobuttons. Where is the mistake in code.
>>
>> while(result.hasNext()) {
>>
>>   QuerySolution sol = result.nextSolution();
>>
>>   RDFNode x=sol.getResource("?Employee");
>>   RDFNode x2=sol.getResource("?Employee");
>> RDFNode x3=sol.getResource("?Employee");
>>   rd1.setText(x.toString());
>>   rd2.setText(x2.toString());
>> rd3.setText(x3.toString());
>>
>>
>

Re: Querysoloution return same individual

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
If you loop over a set of individuals, why do you assign in each 
iteration three times the same value to all radio buttons? In one 
iteration you have only one individual, thus, you can assign this value 
only to one radiobutton.


On 03.08.2016 11:17, neha gupta wrote:
> Select *  + where {  ?Employee   rdf:type  emp:Employee }";This return
> three individuals.
>
> I use then it to assign to three radiobuttons but it assign one (same)
> individual to all three radiobuttons. Where is the mistake in code.
>
> while(result.hasNext()) {
>
>   QuerySolution sol = result.nextSolution();
>
>   RDFNode x=sol.getResource("?Employee");
>   RDFNode x2=sol.getResource("?Employee");
> RDFNode x3=sol.getResource("?Employee");
>   rd1.setText(x.toString());
>   rd2.setText(x2.toString());
> rd3.setText(x3.toString());
>