On 12/01/13 11:22, iman paryudi wrote:
I am trying to make a query using Jena ARQ as follows:

static public final String NL = System.getProperty("line.separator") ;

//some codes

String prolog = "PREFIX rdf: <"+ RDF.getURI()+"> PREFIX rdfs: <"+RDFS.getURI()+"> PREFIX 
myproject: <http://www.myproject.com/ontologies/myproject.owl#>" ;

String queryString = prolog + NL + "SELECT ?individu WHERE {?individu rdf:type 
myproject:Plant. ?individu myproject:height ?height.  FILTER(?height <= 6.0). ?individu 
myproject:diameter ?diameter. FILTER(?diameter = 0.5)} ORDER BY ?individu" ;

//some codes

Using this code my program works well. As we can see that I use constant filter 
values for height and diameter (6.0 and 0.5 respectively). However actually 
what I want is not a constant filter values. Instead I want variable filter 
values. This is similar to PreparedStatement in MySQL. I need this because the 
query must change dynamically based on user input.
So, my question is: how can I make a query using variable filter value?
Thanks.

Iman Paryudi


See ParameterizedSparqlString or
QueryExecutionFcatory.create(... QuerySolution)

        Andy

Reply via email to