Thank you Martyna and Nicola. Both queries worked perfectly!

Bob


On 1/24/22 6:21 PM, Nicola Vitucci wrote:
Hey Bob,

does this one do what you're after?

SELECT DISTINCT ?cl (COUNT(DISTINCT ?p) AS ?c)
WHERE {
   ?s a ?cl .
   ?s ?p ?o .
}
GROUP BY ?cl

Nicola

Il giorno lun 24 gen 2022 alle ore 23:05 Bob DuCharme <b...@snee.com> ha
scritto:

Using arq and the data at
http://www.snee.com/bobdc.blog/files/BeatlesMusicians.ttl, I’m trying to
write a query that will list the classes used in the data and the number
of distinct properties used by instances of that class. I’m having a
hard time and can’t even write a query that lists the number of
properties used for just one of the classes; the following just shows me
a series of ones.

     SELECT (COUNT(DISTINCT ?p) AS ?pcount)
     WHERE {
        ?s a <http://learningsparql.com/ns/schema/Song> .
        ?s ?p ?o .
     }
     GROUP BY ?p

Any suggestions?

Thanks,

Bob


Reply via email to