Number of identifier properties by class and typeEdit

SELECT DISTINCT ?classes ?type (COUNT(DISTINCT ?p) as ?count) WHERE {
  SELECT DISTINCT ?p ?type (GROUP_CONCAT(?class) AS ?classes) WHERE {
      # Wikidata property with datatype external identifier
      ?p wikibase:propertyType wikibase:ExternalId .
      BIND ('I' AS ?class)
    } UNION { 
      # Wikidata property for a unique identifier
      SELECT DISTINCT ?p ?class { 
        ?p wdt:P31/wdt:P279* wd:Q19847637 .
        BIND ('U' AS ?class) 
    ?p wikibase:propertyType ?type .
    # SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  } GROUP BY ?p ?type
} GROUP BY ?classes ?type

Try it!