Hi Houda, Virtuoso does now implement the SPARQL 1.1 GROUP_CONCAT and SAMPLE aggregate functions.
Note however their is a slight deviation from SPARQL 1.1 in that as the specification is not fully ratified stable, SAMPLE and GROUP_CONCAT are not added as keywords directly and need to be prefixed with “sql:” until the specification is complete. So for the DBpedia query given on answers.semanticweb, the following now works: PREFIX w3geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT ?name (sql:SAMPLE(?lat) as ?latlat) ?long ?city ?imageBlankEmblem WHERE { ?city dbpprop:imageBlankEmblem ?imageBlankEmblem . ?city rdfs:label ?name . ?city w3geo:lat ?lat . ?city w3geo:long ?long . FILTER ( ( LANG(?name) = 'en' ) && ( datatype(?lat) = datatype(?long) ) && ( datatype(?long) = xsd:float ) ) } As you are using the Virtuoso open source version you would need a later snapshot to the current 6.1.3 available on source forge, as this support was added recently. A snapshot build containing this support can be obtained from: ftp://download.openlinksw.com/support/vos/virtuoso-opensource-6-20110614.tar.gz which you can rebuild and test with ... Best Regards Hugh Williams Professional Services OpenLink Software Web: http://www.openlinksw.com Support: http://support.openlinksw.com Forums: http://boards.openlinksw.com/support Twitter: http://twitter.com/OpenLink On 2 Aug 2011, at 14:01, Houda kr wrote: > Hi, > > I need to know how to return one random label (for each item) when the item > has several labels (using SPARQL). I tried the following query, but it > returns the same label for all persons > > SELECT ?person ?name WHERE { > ?person a foaf:Agent . > { SELECT ?name WHERE { > ?person rdfs:label ?name > } LIMIT 1 } . > } > > Same behavior on DBpedia SPARQL endpoint (see > http://answers.semanticweb.com/questions/2726/using-sample-keyword-and-subqueries-at-dbpediaorg). > I need to understand why this query doesn't work since the second query > should retrieve the first name for each resource from the first query. > > I am trying to use the SAMPLE keyword (SPARQL 1.1), but it is not supported > by the current version of Virtuoso. I want to know when the SPARQL 1.1 will > be fully integrated in the open source distribution. Any other suggestion is > welcome. > > > thanks in advance > Houda > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos & much more. Register early & save! > http://p.sf.net/sfu/rim-blackberry-1_______________________________________________ > Virtuoso-users mailing list > Virtuoso-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/virtuoso-users