That doesn't make sense to use REGEX: He provides both options in a
combobox, thus, he knows the entities and it's a simple task of building
the correct SPARQL query with Java basics like string concatenation...
> Hello
> Try with regex like this:
> select ?student where {?student my:hasClass ?class FILTER (regex(str(?class),
> " + string + "))
> Best regards
>
>> From: [email protected]
>> Date: Thu, 11 Aug 2016 07:39:16 -0700
>> Subject: Re: query not working
>> To: [email protected]
>>
>> URI? I have used the prefixes in my query.
>>
>> User have to select taught or research in combo box and I need to filter my
>> query based on user selection.
>>
>> When I dont use user selection and direct use like this:
>>
>> select ?student where {?student my:hasClass my:taught}
>> it works but I need to use the string value here entered by user.
>>
>> Thanks for understanding.
>>
>> On Thu, Aug 11, 2016 at 7:30 AM, Jean-Marc Vanel <[email protected]>
>> wrote:
>>
>>> "taught" and "research" are just strings , you need the real URI's between
>>> <> .
>>>
>>>
>>>
>>> 2016-08-11 16:19 GMT+02:00 neha gupta <[email protected]>:
>>>
>>>> I have query
>>>>
>>>> select ?student where {?student my:hasClass ?class FILTER (?class
>>>> =''"+string+"}
>>>>
>>>> hasClass has two individuals: taught and research. I will take this from
>>>> user as:
>>>> String string=box1.getSelectedItem().toString(); (user will enter either
>>>> taught or research).
>>>>
>>>
>>>
>>> --
>>> Jean-Marc Vanel
>>> Déductions SARL - Consulting, services, training,
>>> Rule-based programming, Semantic Web
>>> http://deductions-software.com/
>>> +33 (0)6 89 16 29 52
>>> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
>>>
>
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center