You can do the substitution quite easily using the querybuilder package.
It will let you build a query like

?emp rdf:type ?empType

and then bind ?empType to your java variable value.

Claude

On Tue, Nov 1, 2016 at 5:21 PM, Andy Seaborne <a...@apache.org> wrote:

> Try and see what happens.
>
> It won't work but you can the see the results SPARQL syntax error.
>
>         Andy
>
>
> On 01/11/16 16:54, tina sani wrote:
>
>> Will simply putting a variable inside a query work?
>>
>> {?emp rdf:type "+employee+"}";
>>
>> On Tue, Nov 1, 2016 at 6:13 PM, lookman sanni <lookous...@gmail.com>
>> wrote:
>>
>> Hi Tina,
>>>
>>> You can have your query stored in a composed java string (e.g. String
>>> query
>>> = "Select blablabla where { ?emp rdf:type " + someJavaVariable + "}"
>>>
>>> Hope that helps
>>> Le 1 nov. 2016 17:02, "tina sani" <tinamadri...@gmail.com> a écrit :
>>>
>>> Hello.
>>>>
>>>> How can I use a Java variable in the SPARQL query.
>>>> ?emp rdf:type ?SomeVariable
>>>>
>>>> I want rdf:type of Managers and Technicals while these two
>>>>
>>> values(Managers
>>>
>>>> and Technicals) are in my Java variable: employee.
>>>>
>>>> So I need something like:
>>>>
>>>> ?emp rdf:type "employee"
>>>>
>>>> Regards
>>>>
>>>>
>>>
>>


-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to