query: SELECT (wd:Q5 AS ?item) ?statcount 
  WHERE
  {
    SELECT (COUNT(DISTINCT ?rel) AS ?statcount) WHERE {
      ?item wdt:P2949 [] .
      hint:Prior hint:rangeSafe true .        
      OPTIONAL { ?item wdt:P25 ?rel . FILTER NOT EXISTS { ?rel wdt:P2949 [] }  }
    }
  }