SPARQL Java integration


(Smrati) #1

Hi Team,

I am working on developing a java code to query stardog db. I want to write a query :
select ?s ?p ?o where {
values ?p { prop1 prop2 prop3 prop4 }
?s ?p ?o
}
I know i can pass any parameter as query.parameter(a,prop)
But here it is a list of string values which is provided by user in config file. Not sure how to pick that up. Would really appreciate if someone has already done similar thing and can help on the same.

thank you!


(Lorenz B.) #2

What speaks against loading the values from the config file into a Java string of set of strings? And then process it via the API? I mean, you're using Java, so you should be able to read from a file or not? Do I miss something here?


(Pavel Klinov) #3

Indeed there's no built-in support for binding a variable to a list of values. Thus you'll have to resort to string concatenation to generate your VALUES pattern.

Cheers,
Pavel


(Smrati) #4

Thank you for the reply.
@lorenz_b : I can definitely rad set/list, but the format in which SPARQL accepts it is not list/set. I was just wondering if there is something built-in that i am missing out on.
@pavel Thank you. Will use basic String functions then!


(system) #5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.