query-4df2a588b8476066ca9f7c20baaee86f
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?name ?followers ?subscribers WHERE 
{
  { 
  ?item p:P4033 ?stat . 
  ?stat ps:P4033 ?name .
  OPTIONAL {?stat pq:P8687 ?followers . }
  OPTIONAL {?stat pq:P3744 ?subscribers . }
  } 
  UNION
  {
  ?item p:P8687 ?stat . 
  ?stat ps:P8687 ?followers . 
  ?stat pq:P4033 ?name .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}  ORDER BY (!bound(?followers)) ?followers (!bound(?subscribers)) ?subscribers
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?followers"):::projected 
  v3("?item"):::projected 
  v5("?name"):::projected 
  v4("?stat")
  v2("?subscribers"):::projected 
  c9(["bd:serviceParam"]):::iri 
  c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal 
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    v3 --"p:P8687"-->  v4
    v4 --"p:statement/P8687"-->  v1
    v4 --"p:qualifier/P4033"-->  v5
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v3 --"p:P4033"-->  v4
    v4 --"p:statement/P4033"-->  v5
    subgraph optional0["(optional)"]
    style optional0 fill:#bbf,stroke-dasharray: 5 5;
      v4 -."p:qualifier/P8687".->  v1
    end
    subgraph optional1["(optional)"]
    style optional1 fill:#bbf,stroke-dasharray: 5 5;
      v4 -."p:qualifier/P3744".->  v2
    end
  end
  union0r <== or ==> union0l
  end
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c9 --"wikibase:language"-->  c11
  end