Linking the result of an aggregate function to a predicted variable

I am trying to calculate the number of values ​​for a given property and print each of the extracted resources along with this number. I am trying to use BINDto store the result of the result of a function COUNTin a variable and pass that variable to my results. However, this value seems empty, and I do not understand why this is so.

Currently my query looks like this:

SELECT DISTINCT ?a ?c
WHERE {
  ?a <http://www.w3.org/2000/01/rdf-schema#label> ?b.
  BIND(COUNT(?b) AS ?c).
}
LIMIT 100

I think I will have to group by ?a, although I'm still not sure how to proceed when I want to do this for several properties, but this is not the problem of this question: at the moment I just want to find out why ?cit seems empty.

Shouldn't - at the moment - there is exactly one label on each line? If so, why is the literal 1^^xsd:integernot tied to ?c- or at least some large number representing the total (non-group) number of labels (similar to what happened here ) - for example, at the following endpoints:

I know that the function I'm looking for may not be supported by some or all of these implementations, but if so, it seems unusual that it COUNTjust “swallows” without an error message (I received an error message at some other endpoints for the syntax) .

So my question is: Why is the return value COUNTempty?

  • COUNT ?
    • , SPARQL, ?
  • COUNT ( , , , - 0)?
+4
1

. SPARQL sparql.org, count:

:

4, 8: ,

, . , SPARQL, , . , SPARQL ( ). , , .

, , , . (aggregate-function(args) as variable) ?b ?a ?c ?a.

select distinct ?a (count(?b) as ?c)
where { ?a rdfs:label ?b }
group by ?a
+4

All Articles