Difference between revisions of "Q2.1"

From BITPlan cr Wiki
Jump to navigation Jump to search
 
Line 6: Line 6:
 
|title=Affiliations of Authors (Paper X)
 
|title=Affiliations of Authors (Paper X)
 
|description=Identify the affiliations of the authors of paper X
 
|description=Identify the affiliations of the authors of paper X
 +
|sparql=PREFIX target: <http://www.wikidata.org/entity/Q115265833>
 +
 +
# List of authors for a work
 +
SELECT DISTINCT
 +
  # Author order
 +
  ?order
 +
 +
  ?academic_age
 +
 +
  # Author item and label
 +
  ?author ?authorUrl ?authorDescription
 +
 +
WHERE {
 +
  {
 +
    target: p:P50 ?author_statement .
 +
    ?author_statement ps:P50 ?author_ .
 +
    ?author_ rdfs:label ?author .
 +
    FILTER (LANG(?author) = 'en')
 +
    BIND(CONCAT("../author/", SUBSTR(STR(?author_), 32)) AS ?authorUrl)
 +
    OPTIONAL {
 +
      ?author_statement pq:P1545 ?order_ .
 +
      BIND(xsd:integer(?order_) AS ?order)
 +
    }
 +
    OPTIONAL {
 +
      ?author_ schema:description ?authorDescription .
 +
      FILTER (LANG(?authorDescription) = "en")
 +
    }
 +
  }
 +
  UNION
 +
  {
 +
    target: p:P2093 ?authorstring_statement .
 +
    ?authorstring_statement ps:P2093 ?author_
 +
    BIND(CONCAT(?author_, " ↗") AS ?author)
 +
    OPTIONAL {
 +
      ?authorstring_statement pq:P1545 ?order_ .
 +
      BIND(xsd:integer(?order_) AS ?order)
 +
    }
 +
    BIND(CONCAT("https://author-disambiguator.toolforge.org/names_oauth.php?doit=Look+for+author&name=", ENCODE_FOR_URI(?author_)) AS ?authorUrl)
 +
  }
 +
  OPTIONAL {
 +
    SELECT ?author_ (MAX(?academic_age_) AS ?academic_age) {
 +
      target: wdt:P50 ?author_ ;
 +
                wdt:P577 ?publication_date .
 +
      [] wdt:P31 / wdt:P279* wd:Q55915575 ;
 +
        wdt:P50 ?author_ ;
 +
        wdt:P577 ?other_publication_date .
 +
      BIND(YEAR(?publication_date) - YEAR(?other_publication_date) AS ?academic_age_)
 +
    }
 +
    GROUP BY ?author_
 +
  }
 +
}
 +
ORDER BY ?order
 
|scholia=work_list-of-authors.sparql
 
|scholia=work_list-of-authors.sparql
 
|relevance=3
 
|relevance=3

Latest revision as of 18:11, 21 March 2023

Query

Query
edit
id  1
name  AuthorsOfPaper
title  Affiliations of Authors (Paper X)
description  Identify the affiliations of the authors of paper X
sparql  
PREFIX target: <http://www.wikidata.org/entity/Q115265833>

# List of authors for a work
SELECT DISTINCT
  # Author order
  ?order

  ?academic_age

  # Author item and label
  ?author ?authorUrl ?authorDescription

WHERE {
  {
    target: p:P50 ?author_statement .
    ?author_statement ps:P50 ?author_ .
    ?author_ rdfs:label ?author .
    FILTER (LANG(?author) = 'en')
    BIND(CONCAT("../author/", SUBSTR(STR(?author_), 32)) AS ?authorUrl)
    OPTIONAL {
      ?author_statement pq:P1545 ?order_ .
      BIND(xsd:integer(?order_) AS ?order)
    }
    OPTIONAL {
      ?author_ schema:description ?authorDescription .
      FILTER (LANG(?authorDescription) = "en")
    }
  }
  UNION
  {
    target: p:P2093 ?authorstring_statement .
    ?authorstring_statement ps:P2093 ?author_
    BIND(CONCAT(?author_, " ↗") AS ?author)
    OPTIONAL {
      ?authorstring_statement pq:P1545 ?order_ .
      BIND(xsd:integer(?order_) AS ?order)
    }
    BIND(CONCAT("https://author-disambiguator.toolforge.org/names_oauth.php?doit=Look+for+author&name=", ENCODE_FOR_URI(?author_)) AS ?authorUrl)
  }
  OPTIONAL {
    SELECT ?author_ (MAX(?academic_age_) AS ?academic_age) {
      target: wdt:P50 ?author_ ;
                 wdt:P577 ?publication_date .
      [] wdt:P31 / wdt:P279* wd:Q55915575 ;
         wdt:P50 ?author_ ;
         wdt:P577 ?other_publication_date .
      BIND(YEAR(?publication_date) - YEAR(?other_publication_date) AS ?academic_age_)
    }
    GROUP BY ?author_
  }
}
ORDER BY ?order
tryiturl  →
wdqsurl  →
scholia  work_list-of-authors.sparql→work_list-of-authors.sparql
relevance  3
comment  Derived from AllPapers see Scholia Example Paper page] scholia query
task  Task2→Task2

Freitext