On 05/04/13 23:58, Jerven Bolleman wrote:
Dear OWLIM developers,
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX up:<http://purl.uniprot.org/core/>
SELECT (count(DISTINCT(?protein)) as ?count) WHERE {
?protein a up:Protein ;
up:reviewed true ;
rdfs:seeAlso ?link .
}
Is allowed
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX up:<http://purl.uniprot.org/core/>
SELECT (count(REDUCED(?protein)) as ?count) WHERE {
?protein a up:Protein ;
up:reviewed true ;
rdfs:seeAlso ?link .
}
throws a malformed query exception.
How come this the case?
This is because REDUCED is not allowed as a qualifier for aggregate
functions, only DISTINCT can be used in this way. This is not a Sesame
restrictions but a feature of the spec. See the SPARQL grammar for
aggregates: http://www.w3.org/TR/sparql11-query/#rAggregate
So there is no bug here. Your second query is simply incorrect SPARQL. I
assume this has been done simply because having REDUCED in an aggregate
(where the exact behavior is undefined) is unlikely to be useful in
practice.
As an aside, REDUCED as a qualifier for the SELECT clause (as opposed to
aggregate functions) is a feature that has been supported by Sesame and
OWLIM for a long while, since SPARQL 1.0 became a standard - though I
must admit I have never used it myself and know of very few use cases in
practice.
The default evaluation strategy for it in Sesame is to filter out
duplicates that are sequential. For example, (A, A, B, A , B, B, C, B)
will be reduced to (A, B, A, B, C, B).
Cheers,
Jeen
_______________________________________________
Owlim-discussion mailing list
Owlim-discussion@ontotext.com
http://ontomail.semdata.org/cgi-bin/mailman/listinfo/owlim-discussion