Wikidata:Synia:scientificevent

From Wikidata
Jump to navigation Jump to search

Synia: Scientific event

[edit]
PREFIX target: <http://www.wikidata.org/entity/Q119153957>

SELECT
  ?description ?descriptionLabel ?descriptionUrl

  ?value ?valueLabel ?valueUrl

  ?wikidata ?wikidataLabel ?wikidataUrl

  ?scholia ?scholiaUrl
WHERE {
  {
    BIND(1 AS ?order)
    BIND(wd:Q52260246 AS ?description)
    BIND("#scientificevent/" AS ?descriptionUrl)
    
    BIND(target: AS ?value)
    
    BIND(target: AS ?wikidata)
    BIND(CONCAT(SUBSTR(STR(target:), 32), "&nbsp;↗") AS ?wikidataLabel)
    BIND(CONCAT("https://www.wikidata.org/wiki/", SUBSTR(STR(target:), 32)) AS ?wikidataUrl)
    
    BIND("Scholia&nbsp;↗" AS ?scholia)
    BIND(CONCAT("https://scholia.toolforge.org/event/", SUBSTR(STR(target:), 32)) AS ?scholiaUrl)
  } 
  UNION
  {
    BIND(2 AS ?order)
    BIND(wd:P1813 AS ?description)
    target: wdt:P1813 ?value .
  }
  UNION
  {
    BIND(3 AS ?order)
    BIND(wd:Q125391566 AS ?description)
    BIND("#scientificeventseries/" AS ?descriptionUrl)
    target: wdt:P179 ?value .
    BIND(CONCAT("#scientificeventseries/", SUBSTR(STR(?value), 32)) AS ?valueUrl)
  }
  UNION
  {
    BIND(4 AS ?order)
    BIND(wd:P11633 AS ?description)
    target: wdt:P11633 | ^wdt:P11633 ?value .
    BIND(CONCAT("#scientificevent/", SUBSTR(STR(?value), 32)) AS ?valueUrl)
  }
  UNION
  {
    BIND(5 AS ?order)
    BIND(wd:Q34770 AS ?description)
    BIND("#language" AS ?descriptionUrl)
    
    target: wdt:P2936 ?value .
    BIND(CONCAT("#language/", SUBSTR(STR(?value), 32)) AS ?valueUrl)

    BIND(?value AS ?wikidata)
    BIND(CONCAT(SUBSTR(STR(?value), 32), "&nbsp;↗") AS ?wikidataLabel)
    BIND(CONCAT("https://www.wikidata.org/wiki/", SUBSTR(STR(?value), 32)) AS ?wikidataUrl)
    
    BIND("Scholia&nbsp;↗" AS ?scholia)
    BIND(CONCAT("https://scholia.toolforge.org/language/", SUBSTR(STR(?value), 32)) AS ?scholiaUrl)

  }
  UNION
  {
    SELECT
      (10 AS ?order)
      ("Organizers" AS ?description)
      (GROUP_CONCAT(?value_; separator=", ") AS ?value)
    {
      BIND(1 AS ?dummy)
      target: wdt:P664 ?iri .
      BIND(SUBSTR(STR(?iri), 32) AS ?q) 
      ?iri rdfs:label ?value_string .
      FILTER (LANG(?value_string) = 'en')
      BIND(COALESCE(?value_string, ?q) AS ?value_)
    }
    GROUP BY ?dummy
  }
  UNION
  {
    # number of participants
    BIND(20 AS ?order)
    BIND(wd:P1132  AS ?description)
    
    target: wdt:P1132 ?value .
  }
  UNION
  {
    # number of submissions
    BIND(21 AS ?order)
    BIND("number of submissions"  AS ?description)
    
    target: p:P12655 ?value_statement .
    ?value_statement ps:P12655 ?submissions.
    OPTIONAL {
      ?value_statement  pq:P518 / rdfs:label ?track .
      FILTER (LANG(?track) = "en")
    }
    BIND(IF(BOUND(?track), CONCAT(STR(?submissions), " (", ?track, ")"), STR(?submissions)) AS ?value)
  }
  UNION
  {
    # number of accepted contributions
    BIND(22 AS ?order)
    BIND("number of accepted contributions"  AS ?description)
    
    target: p:P12649 ?value_statement .
    ?value_statement ps:P12649 ?accepted .
    OPTIONAL {
      ?value_statement  pq:P518 / rdfs:label ?track .
      FILTER (LANG(?track) = "en")
    }
    BIND(IF(BOUND(?track), CONCAT(STR(?accepted), " (", ?track, ")"), STR(?accepted)) AS ?value)
  }
  UNION
  {
    # acceptance rate
    BIND(23 AS ?order)
    BIND("Acceptance&nbsp;rate" AS ?description)
    
    target: p:P5822 ?value_statement .
    ?value_statement ps:P5822 ?acceptance_rate .
    OPTIONAL {
      ?value_statement  pq:P518 / rdfs:label ?track .
      FILTER (LANG(?track) = "en")
    }
    BIND(IF(BOUND(?track), CONCAT(STR(?acceptance_rate * 100), " % (", ?track, ")"), CONCAT(STR(?acceptance_rate * 100), " %")) AS ?value)
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
ORDER BY ?order
Try it!

Persons

[edit]
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)
WITH {
  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
} AS %people  
WITH {
  SELECT
    (COUNT(?work) AS ?number_of_publications)
    ?roles
    ?person (SAMPLE(?work) AS ?example_work)
  WHERE {
    INCLUDE %people .
    ?person wdt:P31 wd:Q5.
    OPTIONAL { ?work wdt:P50 ?person . }
  }
  GROUP BY ?roles ?person
} AS %results
WHERE {
  INCLUDE %results
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?number_of_publications)
Try it!
[edit]
PREFIX target: <http://www.wikidata.org/entity/Q48026503>

SELECT
  ?score

  ?event ?eventLabel
  (CONCAT("#scientificevent/", SUBSTR(STR(?event), 32)) AS ?eventUrl)
  ?eventDescription

  ?example_person ?example_personLabel
  (CONCAT("#author/", SUBSTR(STR(?example_person), 32)) AS ?example_personUrl)
  
WHERE {
  { 
    SELECT
      (COUNT(DISTINCT ?person) AS ?score) ?event
      (SAMPLE(?person) AS ?example_person)
    WHERE {
      ?person ^wdt:P823 | ^wdt:P664 | wdt:P1344 | ^wdt:P710 | (^wdt:P98 / wdt:P4745) | (^wdt:P50 / wdt:P1433 / wdt:P4745 ) | ^wdt:P5804 target: , ?event .
      FILTER (?event != target:)
    }
    GROUP BY ?event
    ORDER BY DESC(?score)
    LIMIT 200
  } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,no,ru,sv,zh". }
}
ORDER BY DESC(?score)
Try it!