Post by tina saniThe value of employee is either Manager or Technical. When user enter
Manager, I want the query to show instances of Manager class and when
Technical, it will show instances of Technical class.
That is not a useful answer to my response.Please learn to provide
detailed information. What is the concrete value?
Is it the String "Manager"? Like
String employee = "Manager";
If so, your SPARQL query expects the URI of a class, do you understand
what I mean?
"Manager" is not a URI. And as I said, if you have the URI, you need to
put this in between '<' and '>'
Post by tina saniAnd yes, I have used all the prefixes with full URI in my query.
I don't understand what you're saying here. Either you use full URIs or
you use prefixed URIs and add the prefixes in the beginning of the
SPARQL query.
Post by tina saniOn Wed, Nov 2, 2016 at 1:02 PM, Lorenz B. <
Post by Lorenz B.WHAT is a concrete value of the variable 'employee'?
And, full URIs have to be put between '<' and '>'
Post by tina saniSelect * where{?emp rdf:type "+employee+"}";
employee variable is : String employee; have values Manager or Technical
depend on user input.
On Wed, Nov 2, 2016 at 10:48 AM, Lorenz B. <
Post by Lorenz B.It should be clear that String concatenation calls the toString() method
of your object. We don't know how this is implemented in your code
though.
Post by tina saniPost by Lorenz B.Post by tina saniWill simply putting a variable inside a query work?
{?emp rdf:type "+employee+"}";
Post by lookman sanniHi Tina,
You can have your query stored in a composed java string (e.g. String
query
Post by tina saniPost by lookman sanni= "Select blablabla where { ?emp rdf:type " + someJavaVariable + "}"
Hope that helps
Post by tina saniHello.
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
Post by tina saniand Technicals) are in my Java variable: employee.
?emp rdf:type "employee"
Regards
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center