VladimirAlexiev added a comment.

  Here are some queries to add the counts: directly to the Item node, and using 
some namespace `ontoRecon:`. I show the above counts, plus 3 more.
  They would need a lot of memory (group over 90M items) and a lot of time 
(especially `statements`). 
  Not tested yet.
  
    PREFIX skos:   <http://www.w3.org/2004/02/skos/core#>
    PREFIX schema: <http://schema.org/>
    PREFIX wikibase: <http://wikiba.se/ontology#>
    
    insert {?item ontoRecon:sitelinks ?n}
    where {
      {select ?item (count(*) as ?n) {
        ?x a schema:Article; schema:about ?item. # TODO check the type of 
Category and Commons links
      } group by ?item}
    };
    
    insert {?item ontoRecon:identifiers ?n}
    where {
      {select ?item (count(*) as ?n) {
        ?wd wikibase:propertyType wikibase:ExternalId; wikibase:directClaim 
?wdt.
        ?item ?wdt ?extId
      }
    };
    
    insert {?item ontoRecon:statements ?n}
    where {
      {select ?item (count(*) as ?n) {
        ?item a wikibase:Item; ?p ?y
        filter(?p not in (skos:prefLabel, skos:altLabel, schema:name, 
schema:description, rdfs:label))
      } group by ?item}
    };
    
    insert {?item ontoRecon:prefLabels ?n}
    where {
      {select ?item (count(*) as ?n) {
        ?item a wikibase:Item; skos:prefLabel ?label
      } group by ?item}
    };
    
    insert {?item ontoRecon:allLabels ?n}
    where {
      {select ?item (count(*) as ?n) {
        ?item a wikibase:Item; skos:prefLabel|skos:altLabel  ?label
      } group by ?item}
    };
    
    insert {?item ontoRecon:descriptions ?n}
    where {
      {select ?item (count(*) as ?n) {
        ?item a wikibase:Item; schema:description ?descr
      } group by ?item}
    };

TASK DETAIL
  https://phabricator.wikimedia.org/T270764

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: VladimirAlexiev
Cc: Aklapper, VladimirAlexiev, Akuckartz, Nandana, Lahi, Gq86, 
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to