I have this RDF file with details about my products and I would like to extract the names of the products that cost less than € 300.
rdf file: *<?xml version="1.0" encoding="utf-8"?>* *<rdf:RDF* * xmlns:foaf="http://xmlns.com/foaf/0.1/ <http://xmlns.com/foaf/0.1/>"* * xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns# <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"* * xmlns:gr="http://purl.org/goodrelations/v1# <http://purl.org/goodrelations/v1#>"* * xmlns:vcard="http://www.w3.org/2006/vcard/ns# <http://www.w3.org/2006/vcard/ns#>"* *>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/31-bicicleta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n-8431284579050.html <http://localhost/prestashop/es/bicicletas-elipticas/31-bicicleta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n-8431284579050.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">320,84</gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/50-home_default/bicicleta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n.jpg <http://localhost/prestashop/50-home_default/bicicleta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica BH Quick volante 8 kg uso regular paso 36 cm G233N</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/31-bicicleta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n-8431284579050.html <http://localhost/prestashop/es/bicicletas-elipticas/31-bicicleta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n-8431284579050.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/26-bicicleta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm-4711542953988.html <http://localhost/prestashop/es/bicicletas-elipticas/26-bicicleta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm-4711542953988.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">545,14 </gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/30-home_default/bicicleta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm.jpg <http://localhost/prestashop/30-home_default/bicicleta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica Horizon DELOS volante 7 kg uso regular paso 41 cm</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/26-bicicleta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm-4711542953988.html <http://localhost/prestashop/es/bicicletas-elipticas/26-bicicleta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm-4711542953988.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/30-bicicleta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm-4711542950000.html <http://localhost/prestashop/es/bicicletas-elipticas/30-bicicleta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm-4711542950000.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>"> 572,75 </gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/46-home_default/bicicleta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm.jpg <http://localhost/prestashop/46-home_default/bicicleta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica Vision S60 volante 20 kg uso profesional paso 53 cm</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/30-bicicleta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm-4711542950000.html <http://localhost/prestashop/es/bicicletas-elipticas/30-bicicleta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm-4711542950000.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/28-bicicleta-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm-8435369935229.html <http://localhost/prestashop/es/bicicletas-elipticas/28-bicicleta-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm-8435369935229.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>"> 392,40 </gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/35-home_default/bicicleta-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm.jpg <http://localhost/prestashop/35-home_default/bicicleta-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica ANDES 6 volante 15 kg uso regular paso de 41 cm</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/28-bicicleta-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm-8435369935229.html <http://localhost/prestashop/es/bicicletas-elipticas/28-bicicleta-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm-8435369935229.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/27-bicicleta-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm-4712765996547.html <http://localhost/prestashop/es/bicicletas-elipticas/27-bicicleta-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm-4712765996547.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">818,20 </gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/32-home_default/bicicleta-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm.jpg <http://localhost/prestashop/32-home_default/bicicleta-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica ANDES 3 volante 9 kg uso regular paso de 41 cm</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/27-bicicleta-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm-4712765996547.html <http://localhost/prestashop/es/bicicletas-elipticas/27-bicicleta-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm-4712765996547.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/24-bicicleta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-4712765993768.html <http://localhost/prestashop/es/bicicletas-elipticas/24-bicicleta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-4712765993768.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">350,09</gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/27-home_default/bicicleta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm.jpg <http://localhost/prestashop/27-home_default/bicicleta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica Treo E109 volante 7 kg uso regular paso de 31 cm</gr:name>* * <gr:condition xml:lang="es">Agotado</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/24-bicicleta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-4712765993768.html <http://localhost/prestashop/es/bicicletas-elipticas/24-bicicleta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-4712765993768.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/32-bicicleta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334-8431284486389.html <http://localhost/prestashop/es/bicicletas-elipticas/32-bicicleta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334-8431284486389.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">389,11</gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/52-home_default/bicicleta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334.jpg <http://localhost/prestashop/52-home_default/bicicleta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica BH Athlon volante inercia 10 kg uso regular G2334</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/32-bicicleta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334-8431284486389.html <http://localhost/prestashop/es/bicicletas-elipticas/32-bicicleta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334-8431284486389.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/25-bicicleta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-4712765995403.html <http://localhost/prestashop/es/bicicletas-elipticas/25-bicicleta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-4712765995403.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">457,37</gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/28-home_default/bicicleta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm.jpg <http://localhost/prestashop/28-home_default/bicicleta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica Treo E103 volante 9 kg uso regular paso de 31 cm</gr:name>* * <gr:condition xml:lang="es">Agotado</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/25-bicicleta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-4712765995403.html <http://localhost/prestashop/es/bicicletas-elipticas/25-bicicleta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-4712765995403.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/29-bicicleta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm-4712765998886.html <http://localhost/prestashop/es/bicicletas-elipticas/29-bicicleta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm-4712765998886.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">515,05</gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/41-home_default/bicicleta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm.jpg <http://localhost/prestashop/41-home_default/bicicleta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica Vision X20 volante 16 kg semi profesional paso 51cm</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/29-bicicleta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm-4712765998886.html <http://localhost/prestashop/es/bicicletas-elipticas/29-bicicleta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm-4712765998886.html></gr:description>* * </gr:Offering>* * <gr:Offering rdf:about="http://localhost/prestashop/es/bicicletas-elipticas/33-bicicleta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336-8431284486396.html <http://localhost/prestashop/es/bicicletas-elipticas/33-bicicleta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336-8431284486396.html>">* * <gr:hasPriceSpecification>* * <gr:UnitPriceSpecification>* * <gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float <http://www.w3.org/2001/XMLSchema#float>">437,86</gr:hasCurrencyValue>* * </gr:UnitPriceSpecification>* * </gr:hasPriceSpecification>* * <gr:image rdf:resource="http://localhost/prestashop/54-home_default/bicicleta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336.jpg <http://localhost/prestashop/54-home_default/bicicleta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336.jpg>"/>* * <gr:name xml:lang="es">Bicicleta elÃptica BH Athlon Program volante 10 kg uso regular G2336</gr:name>* * <gr:condition xml:lang="es">Disponible</gr:condition>* * <gr:description xml:lang="es">http://localhost/prestashop/es/bicicletas-elipticas/33-bicicleta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336-8431284486396.html <http://localhost/prestashop/es/bicicletas-elipticas/33-bicicleta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336-8431284486396.html></gr:description>* * </gr:Offering>* *</rdf:RDF>* and the program you want to get this information is : *package tutorial;* *import java.io.UnsupportedEncodingException;* *import com.hp.hpl.jena.query.QueryExecution;* *import com.hp.hpl.jena.query.QueryExecutionFactory;* *import com.hp.hpl.jena.query.QueryFactory;* *import com.hp.hpl.jena.query.QuerySolution;* *import com.hp.hpl.jena.query.ResultSet;* *import com.hp.hpl.jena.rdf.model.Literal;* *import com.hp.hpl.jena.rdf.model.Model;* *import com.hp.hpl.jena.util.FileManager;* *public class SPARQL_bicicletasElipticas {* * public static void main(String args[])* * {* * try {* * sparqlTest();* * } catch (UnsupportedEncodingException e) {* * // TODO Auto-generated catch block* * e.printStackTrace();* * }* * }* * static void sparqlTest() throws UnsupportedEncodingException * * {* * FileManager.get().addLocatorClassLoader(prueba.class.getClassLoader());* * Model model = FileManager.get().loadModel("RDF/elipticas.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:hasPriceSpecification ?ps ." +* * " ?ps gr:hasCurrencyValue ?p . " +* * " FILTER (?p > = 300) " +* * "}";* * 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("p");* * System.out.println(name);* * }* * } finally {* * qexec.close();* * }* *}* *} * Thank you, Nagore. 2014/1/21 Rob Vesse <[email protected]> > We need more information than this to help you, please provide a minimal > reproducible example > > I.e. include a minimal sample of your data that reproduces your issue > (preferably in a readable syntax like Turtle) and show the results you get > and the results you expect > > Telling us that "it does not return the correct solution" is entirely > useless if you don't tell us what you expect the correct solution to be or > provide any data for us to test with. > > Regards, > > Rob > > On 21/01/2014 08:38, "Nagore Salaberria" <[email protected]> wrote: > > >Sorry , this is the code: > > > > > > > > > > > >*.....* > >* 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:name ?d . "+* > >* " ?x gr:hasPriceSpecification ?ps ." +* > >* " ?ps gr:hasCurrencyValue ?p . " +* > >* " FILTER (?p >= '300^^xsd:float' ) " +* > >* "}";* > > > >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("d"); > > System.out.println(name); > > > > } > > } finally { > > qexec.close(); > > } > >} > >} > > > > Thank you, > > > >Nagore. > > > > > > > > > >2014/1/21 Nagore Salaberria <[email protected]> > > > >> > >> Good afternoon everyone, > >> > >> I am making a SPARQL query with filters and although syntactically > >>correct > >> me does not return the correct solution. I have an online store and > >>want to > >> extract the names of items to be priced higher than € 300. > >> > >> *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:hasPriceSpecification ?ps ." +* > >> * " ?ps gr:hasCurrencyValue ?p . " +* > >> * " FILTER (?p >= '300^^xsd:float' ) " +* > >> * "}";* > >> > >> > >> What is the error? > >> > >> Thank you, > >> > >> Nagore. > >> -- > >> Nagore Salaberria<[email protected]> > >> > > > > > > > >-- > >Nagore Salaberria<[email protected]> > > > > > -- Nagore Salaberria<[email protected]>
