Hi all! I have the following problem with the MAX aggregate function in SPARQL. If I run the query
PREFIX foaf:<http://xmlns.com/foaf/0.1/> PREFIX km4c:<http://www.disit.org/km4city/schema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?ride (max(?avmr) AS ?avmrLast) FROM <http://localhost:8890/avm_quadStore_50K> FROM <http://www.disit.org/km4city/resource/Autobus/5_Lotto_Metropolitano_Firenze_f> WHERE{ ?bs rdf:type km4c:BusStop. ?bs foaf:name "PISANA 08". ?bsf km4c:isForecastOfBusStop ?bs. ?bsf km4c:isForecastOfAVM ?avmr. ?ride km4c:hasAVMRecord ?avmr. } GROUP BY ?ride ORDER BY DESC (?avmrLast) LIMIT 15 I get the result ride avmrLast http://www.disit.org/km4city/resource/4900006 iri_id_0_with_no_name_entry http://www.disit.org/km4city/resource/4900000 iri_id_0_with_no_name_entry This is not correct, since I expect ?avmrLast to be bound to an IRI. If I don't use the MAX function, that is if I run the following query PREFIX foaf:<http://xmlns.com/foaf/0.1/> PREFIX km4c:<http://www.disit.org/km4city/schema#> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?ride (?avmr AS ?avmrLast) FROM <http://localhost:8890/avm_quadStore_50K> FROM <http://www.disit.org/km4city/resource/Autobus/5_Lotto_Metropolitano_Firenze_f> WHERE{ ?bs rdf:type km4c:BusStop. ?bs foaf:name "PISANA 08". ?bsf km4c:isForecastOfBusStop ?bs. ?bsf km4c:isForecastOfAVM ?avmr. ?ride km4c:hasAVMRecord ?avmr. } GROUP BY ?ride ORDER BY DESC (?avmrLast) LIMIT 15 I get instead ride avmrLast http://www.disit.org/km4city/resource/4900000 http://www.disit.org/km4city/resource/2015-12-11T15:16:54.3500000+02:00+4900000 http://www.disit.org/km4city/resource/4900006 http://www.disit.org/km4city/resource/2015-12-11T09:10:22.3500006+02:00+4900006 Which may be the reasons? I am using Virtuoso for Windows Version: 07.20.3214 Build: Jun 24 2015 Thank you very much for your help. Best regards, Francesco Balzano
------------------------------------------------------------------------------
_______________________________________________ Virtuoso-users mailing list Virtuoso-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/virtuoso-users