Is there a library, which is able to build SPARQL queries programmatically like the CriteriaBuilder in JPA or to build the queries like with a PreparedStatement for SQL?
Similar (for SQL): Cleanest way to build an SQL string in Java
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can build queries programmatically in Jena using two methods: syntax or algebra. There’s an introduction in the jena wiki.
Using the algebra you’d do something like:
(taken from the wiki page)
It’s not
CriteriaBuilder(nor was it intended to be), but is some of the way there. YouOpJoinrather than AND,OpUnionwhen you want to OR, etc. The pain points are expressions in my experience: you probably want to parse them from a string.