Create query in sparql using jena without hard coding the query? [closed]
Can any one tell me how to create a sparql query for dbpedia using jena program without hard coding the query.. I dont want to just store the query in string and to execute it... I have no idead how to make it as i am new to sparql... Could any one plz help me..
Thanks in advance
Can you add more detail on what you want to do i.e. is there a general template to your queries or particular types of queries you want to make?
Jena does have some support for substituting variables into prepared queries so you can hard code a template and then substitute values as desired based on your inputs. But whether this is applicable depends on what queries you want to make.
As a very simple solution you can just build your querystring by string concatenation based on your inputs and then use Jena to send that to DBpedia.
Edit
See Ian's answer to your other question which shows how to do substitution of values into prepared queries using Jena
精彩评论