query-bf22910913da5fbf8ae51f13db985de3

rq turtle/ttl

Persons

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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/Q117023205>

SELECT
  (?number_of_publications AS ?works)

  ?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
    (COUNT(?work) AS ?number_of_publications)
    ?roles
    ?person (SAMPLE(?work) AS ?example_work)
  WHERE {
     {
  SELECT
    (GROUP_CONCAT(DISTINCT ?role; separator=", ") AS ?roles) ?person
  WHERE {
    {
      # speaker added directly in the target item
      target: p:P823 ?person_statement .
      ?person_statement ps:P823 ?person . 
      OPTIONAL {
        ?person_statement pq:P3831 / rdfs:label ?role_ .
        FILTER (LANG(?role_) = "en")
      }
      BIND(COALESCE(?role_, "speaker") AS ?role)
    }
    UNION
    {
      # speaker inferred from presentation items related to the event-target
      ?presentation wdt:P823 ?person; wdt:P5072 target: 
      BIND("speaker" AS ?role)
    }
    UNION
    {
      # organizer
      target: wdt:P664 ?person .
      #BIND(wd:Q2029941 AS ?role)
      BIND("organizer" AS ?role)
    }
    UNION
    {
      # participant
      ?person wdt:P1344| ^wdt:P710 target: .
      BIND("participant" AS ?role)
    }
    UNION
    {
      # editor
      ?person ^wdt:P98 / wdt:P4745 target: .
      BIND("editor of proceedings" AS ?role)
    }
    UNION
    {
      # author
      ?person ^wdt:P50 / wdt:P1433 / wdt:P4745 target: .
      BIND("author" AS ?role)
    }
    UNION
    {
      # program committee member
      target: wdt:P5804 ?person .
      BIND("program committee member" AS ?role)
    }
  }
  GROUP BY ?person
}.
    ?person wdt:P31 wd:Q5.
    OPTIONAL { ?work wdt:P50 ?person . }
  }
  GROUP BY ?roles ?person
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?number_of_publications)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?example_work"):::projected v12("?example_workUrl") v9("?number_of_publications"):::projected v4("?person"):::projected v11("?personUrl") v3("?person_statement") v6("?presentation") v7("?role") v2("?role_") v7("?roles"):::projected v8("?work") v10("?works") a1((" ")) a2((" ")) a3((" ")) a4((" ")) c20(["bd:serviceParam"]):::iri c18(["wd:Q5"]):::iri c2(["wd:Q117023205"]):::iri c22(["#91;AUTO_LANGUAGE#93;,en"]):::literal 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; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; c2 --"p:direct/P5804"--> v4 bind0[/"'program committee member'"/] bind0 --as--o v7 end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; a3 --"p:direct/P50"--> v4 a3 --"p:direct/P1433"--> a4 a4 --"p:direct/P4745"--> c2 bind1[/"'author'"/] bind1 --as--o v7 end union5r <== or ==> union5l end end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; a2 --"p:direct/P98"--> v4 a2 --"p:direct/P4745"--> c2 bind2[/"'editor of proceedings'"/] bind2 --as--o v7 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; subgraph union6[" Union "] subgraph union6l[" "] style union6l fill:#abf,stroke-dasharray: 3 3; c2 --"p:direct/P710"--> v4 end subgraph union6r[" "] style union6r fill:#abf,stroke-dasharray: 3 3; v4 --"p:direct/P1344"--> c2 end union6r <== or ==> union6l end bind3[/"'participant'"/] bind3 --as--o v7 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; c2 --"p:direct/P664"--> v4 bind4[/"'organizer'"/] bind4 --as--o v7 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v6 --"p:direct/P823"--> v4 v6 --"p:direct/P5072"--> c2 bind5[/"'speaker'"/] bind5 --as--o v7 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; c2 --"p:P823"--> v3 v3 --"p:statement/P823"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P3831".-> a1 a1 --"rdfs:label"--> v2 end bind6[/"?role_'speaker'"/] v2 --o bind6 bind6 --as--o v7 end union0r <== or ==> union0l end bind8[/"?role"/] v7 --o bind8 bind8 --as--o v7 v4 --"p:direct/P31"--> c18 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:direct/P50".-> v4 end bind11[/"count(?work)"/] v8 --o bind11 bind11 --as--o v9 bind12[/"sample(?work)"/] v8 --o bind12 bind12 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c20 --"wikibase:language"--> c22 end bind13[/"?number_of_publications"/] v9 --o bind13 bind13 --as--o v10 bind14[/"concat('#author/',substring(str(?person),'32^^xsd:integer'))"/] v4 --o bind14 bind14 --as--o v11 bind15[/"concat('#work/',substring(str(?example_work),'32^^xsd:integer'))"/] v9 --o bind15 bind15 --as--o v12