On Monday, February 24, 2014 04:39:14 PM Nagore Salaberria wrote:
>
> This is my code:
>
>
>
> *public class rodillos {*
>
> *public static void main(String args[])*
> * {*
> * try {*
> * sparqlTest3( "Elite AL13 Roller" ,"Rodillo",200,300 );*
> * } catch (UnsupportedEncodingException e) {*
> * // TODO Auto-generated catch block*
> * e.printStackTrace();*
> * }*
> * }*
>
>
> *public static void sparqlTest3(String g, String h,int a, int b) throws
> UnsupportedEncodingException *
> * {*
> *
> FileManager.get().addLocatorClassLoader(elipticas.class.getClassLoader());*
> * Model model = FileManager.get().loadModel("RDF/rodillo.rdf");*
> * String querys = *
> * " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>> " +*
> * " PREFIX gr: <http://purl.org/goodrelations/v1#
> <http://purl.org/goodrelations/v1#>> " +*
> * " PREFIX xsd: <http://www.w3.org/2001/XMLSchema#
> <http://www.w3.org/2001/XMLSchema#>> " +*
> * " SELECT * WHERE {" +*
> * " ?x a gr:Offering . " +*
> * " ?x gr:includes ?m . " +*
> * " ?m gr:name ?z ." +*
> * " ?m gr:quantitativeProductOrServiceProperty ?s . " +*
> * " ?s gr:hasValue ?g ." +*
> * " FILTER (regex(str(?g),"+g+")) ." +*
> * " ?m gr:quantitativeProductOrServiceProperty ?ñ. " +*
> * " ?ñ gr:hasValue ?h ." +*
> * " FILTER (regex(str(?h),"+h+")) ." +*
> * " ?x gr:hasPriceSpecification ?ps ." +*
> * " ?ps gr:hasCurrencyValue ?p . " +*
> * " FILTER(?p >= "+a+" && ?p <= "+b+" ) . " +*
> * "}";*
> * com.hp.hpl.jena.query.Query query = QueryFactory.create(querys);*
> * QueryExecution qexec = QueryExecutionFactory.create(query, model);*
> * try {*
> * ResultSet results = qexec.execSelect();*
> * while ( results.hasNext() ) {*
> * QuerySolution soln = results.nextSolution();*
> * Literal name = soln.getLiteral("z");*
> * System.out.println(name);*
>
> * }*
> * } finally {*
> * qexec.close();*
> * }*
> *}*
Put newlines in your query. (At the beginning or end of your strings.)
Print it out or look at it in an editor, especially if it can show
line numbers.
Then you can see where the problem is & it will likely be obvious
how to fix it.
Chris
--
"Some of these", Hazleton had said, looking at a /A Clash of Cymbals/
just-completed tangle of wires, lenses, antennae and
kernels of metal with rueful respect, "ought to prove pretty potent in the
pinch. I just wish I knew which ones they were."
Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)