query-64d249064437bef8076e182b6e85117a

rq turtle/ttl

People

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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#>
PREFIX target: <http://www.wikidata.org/entity/Q6053150>

SELECT
  ?number_of_roles

  ?person ?personLabel
  (CONCAT("#author/", SUBSTR(STR(?person), 32)) AS ?personUrl)
  ?personDescription

  ?roles

  ?example_work ?example_workLabel
  (CONCAT("#work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)

WHERE {
   {
  SELECT
    ?number_of_roles
    ?roles
    ?person (SAMPLE(?work) AS ?example_work)
  WHERE {
     {
  SELECT
    (COUNT(?role) AS ?number_of_roles)
    (GROUP_CONCAT(DISTINCT ?role; separator=", ") AS ?roles) ?person
  WHERE {
    {
      # speaker
      target: ^wdt:P179 / wdt:P823 ?person .
      BIND("speaker" AS ?role)
    }
    UNION
    {
      # organizer
      ?organizer_statement ps:P664 ?person .
      target: ^wdt:P179 / p:P664 ?organizer_statement .
      OPTIONAL {
        ?organizer_statement pq:P3831 / rdfs:label ?organization_role . 
        FILTER (LANG(?organization_role) = "en")
      }
      BIND(COALESCE(?organization_role, "organizer") AS ?role)
    }
    UNION
    {
      # participant
      ?person (wdt:P1344| ^wdt:P710) / wdt:P179 target: .
      BIND("participant" AS ?role)
    }
    UNION
    {
      # editor
      ?person (^wdt:P98 / wdt:P4745) / wdt:P179 target: .
      BIND("editor of proceedings" AS ?role)
    }
    UNION
    {
      # author
      ?person (^wdt:P50 / wdt:P1433 / wdt:P4745) / wdt:P179 target: .
      BIND("author" AS ?role)
    }
    UNION
    {
      # program committee member
      target: ^wdt:P179 / wdt:P5804 ?person .
      BIND("program committee member" AS ?role)
    }
  }
  GROUP BY ?person
}.
    OPTIONAL { ?work wdt:P50 ?person . }
  }
  GROUP BY ?number_of_roles ?roles ?person
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,da,de,es,fr,jp,no,ru,sv,zh". }
}
ORDER BY DESC(?number_of_roles)
LIMIT 500

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?example_work"):::projected v10("?example_workUrl") v6("?number_of_roles"):::projected v4("?organization_role") v5("?organizer_statement") v2("?person"):::projected v9("?personUrl") v6("?role") v6("?roles"):::projected v7("?work") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a6((" ")) a5((" ")) a9((" ")) a7((" ")) a8((" ")) a10((" ")) c19(["#91;AUTO_LANGUAGE#93;,en,da,de,es,fr,jp,no,ru,sv,zh"]):::literal c17(["bd:serviceParam"]):::iri c2([http://www.wikidata.org/entity/Q6053150]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; a10 --"p:direct/P179"--> c2 a10 --"p:direct/P5804"--> v2 bind0[/"'program committee member'"/] bind0 --as--o v6 end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; a7 --"p:direct/P50"--> v2 a7 --"p:direct/P1433"--> a8 a8 --"p:direct/P4745"--> a9 a9 --"p:direct/P179"--> c2 bind1[/"'author'"/] bind1 --as--o v6 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; a5 --"p:direct/P98"--> v2 a5 --"p:direct/P4745"--> a6 a6 --"p:direct/P179"--> c2 bind2[/"'editor of proceedings'"/] bind2 --as--o v6 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; a4 --"p:direct/P710"--> v2 end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P1344"--> a4 end union5r <== or ==> union5l end a4 --"p:direct/P179"--> c2 bind3[/"'participant'"/] bind3 --as--o v6 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v5 --"p:statement/P664"--> v2 a2 --"p:direct/P179"--> c2 a2 --"p:P664"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P3831".-> a3 a3 --"rdfs:label"--> v4 end bind4[/"?organization_role'organizer'"/] v4 --o bind4 bind4 --as--o v6 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; a1 --"p:direct/P179"--> c2 a1 --"p:direct/P823"--> v2 bind5[/"'speaker'"/] bind5 --as--o v6 end union0r <== or ==> union0l end bind8[/"count(?role)"/] v6 --o bind8 bind8 --as--o v6 bind9[/"?role"/] v6 --o bind9 bind9 --as--o v6 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P50".-> v2 end bind11[/"sample(?work)"/] v7 --o bind11 bind11 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c17 --"wikibase:language"--> c19 end bind12[/"concat('#author/',substring(str(?person),'32^^xsd:integer'))"/] v2 --o bind12 bind12 --as--o v9 bind13[/"concat('#work/',substring(str(?example_work),'32^^xsd:integer'))"/] v8 --o bind13 bind13 --as--o v10