And if I want to put in the FILTER two values, as would be the syntax ?
is this?? PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + " PREFIX gr: <http://purl.org/goodrelations/v1#> " + " PREFIX xsd: <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' && ?p >= '800') " + "}"; Thank you, Nagore. 2014-01-21 Nagore Salaberria <[email protected]> > ouuhh yes, thank you!!! > > That was the mistake, the price was separated by comma and put the point, > all sorted. > > :) > > > 2014/1/21 Rob Vesse <[email protected]> > >> The auto-formatting of your email client makes the data unusable once it >> reaches the list (in future it is better to set your email to Plain Text >> when sending data and preferably also disable any auto-formatting of URLs) >> but I think I see what your issue is regardless. >> >> An example price in your data is as follows: >> >> <gr:hasCurrencyValue >> rdf:datatype="http://www.w3.org/2001/XMLSchema#float >> ">320,84</gr:hasCurrenc >> yValue> >> >> Here you appear to have used a comma to separate the decimal portion of >> the price. Am I right in assuming you are from a country where comma is >> the official decimal separator? >> >> However RDF uses XML Schema Datatypes for representing typed literals and >> the XML Schema Float datatype (http://www.w3.org/TR/xmlschema-2/#float) >> requires the serialisation to use a period as the decimal separator. >> >> What this means in practise is that the SPARQL engine treats all your >> currency values as being invalid float values and so none of them can >> possibly match the filter hence why you presumably get no results. >> >> Rob >> >> >> >> On 21/01/2014 09:28, "Nagore Salaberria" <[email protected]> wrote: >> >> >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-biciclet >> >> >a-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-elptic >> >a-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n.jpg >> >< >> http://localhost/prestashop/50-home_default/bicicleta-elptica-bh-quick-vo >> >lante-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-bicic >> >> >leta-elptica-bh-quick-volante-8-kg-uso-regular-paso-36-cm-g233n-8431284579 >> >050.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-biciclet >> >> >a-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-elptic >> >a-horizon-delos-volante-7-kg-uso-regular-paso-41-cm.jpg >> >< >> http://localhost/prestashop/30-home_default/bicicleta-elptica-horizon-del >> >os-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-bicic >> >> >leta-elptica-horizon-delos-volante-7-kg-uso-regular-paso-41-cm-47115429539 >> >88.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-biciclet >> >> >a-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm-471154295000 >> >0.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-elptic >> >a-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-bicic >> >> >leta-elptica-vision-s60-volante-20-kg-uso-profesional-paso-53-cm-471154295 >> >0000.html >> >< >> http://localhost/prestashop/es/bicicletas-elipticas/30-bicicleta-elptica- >> >> >vision-s60-volante-20-kg-uso-profesional-paso-53-cm-4711542950000.html></g >> >r:description>* >> >* </gr:Offering>* >> >* <gr:Offering >> >rdf:about=" >> http://localhost/prestashop/es/bicicletas-elipticas/28-biciclet >> > >> a-elptica-andes-6-volante-15-kg-uso-regular-paso-de-41-cm-8435369935229.ht >> >ml >> >< >> 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-elptic >> >a-andes-6-volante-15-kg-uso-regular-paso-de-41-cm.jpg >> >< >> http://localhost/prestashop/35-home_default/bicicleta-elptica-andes-6-vol >> >ante-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-bicic >> >> >leta-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:de >> >scription>* >> >* </gr:Offering>* >> >* <gr:Offering >> >rdf:about=" >> http://localhost/prestashop/es/bicicletas-elipticas/27-biciclet >> >> >a-elptica-andes-3-volante-9-kg-uso-regular-paso-de-41-cm-4712765996547.htm >> >l >> >< >> 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-elptic >> >a-andes-3-volante-9-kg-uso-regular-paso-de-41-cm.jpg >> >< >> http://localhost/prestashop/32-home_default/bicicleta-elptica-andes-3-vol >> >ante-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-bicic >> >> >leta-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:des >> >cription>* >> >* </gr:Offering>* >> >* <gr:Offering >> >rdf:about=" >> http://localhost/prestashop/es/bicicletas-elipticas/24-biciclet >> >> >a-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-4712765993768.h >> >tml >> >< >> 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-elptic >> >a-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm.jpg >> >< >> http://localhost/prestashop/27-home_default/bicicleta-elptica-treo-e109-v >> >olante-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-bicic >> >> >leta-elptica-treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-471276599376 >> >8.html >> >< >> http://localhost/prestashop/es/bicicletas-elipticas/24-bicicleta-elptica- >> >> >treo-e109-volante-7-kg-uso-regular-paso-de-31-cm-4712765993768.html></gr:d >> >escription>* >> >* </gr:Offering>* >> >* <gr:Offering >> >rdf:about=" >> http://localhost/prestashop/es/bicicletas-elipticas/32-biciclet >> >> >a-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-elptic >> >a-bh-athlon-volante-inercia-10-kg-uso-regular-g2334.jpg >> >< >> http://localhost/prestashop/52-home_default/bicicleta-elptica-bh-athlon-v >> >olante-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-bicic >> >> >leta-elptica-bh-athlon-volante-inercia-10-kg-uso-regular-g2334-84312844863 >> >89.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-biciclet >> >> >a-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-4712765995403.h >> >tml >> >< >> 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-elptic >> >a-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm.jpg >> >< >> http://localhost/prestashop/28-home_default/bicicleta-elptica-treo-e103-v >> >olante-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-bicic >> >> >leta-elptica-treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-471276599540 >> >3.html >> >< >> http://localhost/prestashop/es/bicicletas-elipticas/25-bicicleta-elptica- >> >> >treo-e103-volante-9-kg-uso-regular-paso-de-31-cm-4712765995403.html></gr:d >> >escription>* >> >* </gr:Offering>* >> >* <gr:Offering >> >rdf:about=" >> http://localhost/prestashop/es/bicicletas-elipticas/29-biciclet >> >> >a-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm-471276599888 >> >6.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-elptic >> >a-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-bicic >> >> >leta-elptica-vision-x20-volante-16-kg-semi-profesional-paso-51cm-471276599 >> >8886.html >> >< >> http://localhost/prestashop/es/bicicletas-elipticas/29-bicicleta-elptica- >> >> >vision-x20-volante-16-kg-semi-profesional-paso-51cm-4712765998886.html></g >> >r:description>* >> >* </gr:Offering>* >> >* <gr:Offering >> >rdf:about=" >> http://localhost/prestashop/es/bicicletas-elipticas/33-biciclet >> >> >a-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-elptic >> >a-bh-athlon-program-volante-10-kg-uso-regular-g2336.jpg >> >< >> http://localhost/prestashop/54-home_default/bicicleta-elptica-bh-athlon-p >> >rogram-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-bicic >> >> >leta-elptica-bh-athlon-program-volante-10-kg-uso-regular-g2336-84312844863 >> >96.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]> >> >> >> >> >> > > > -- > Nagore Salaberria<[email protected]> > -- Nagore Salaberria<[email protected]>
