Difference between revisions of "Q2.1"

From BITPlan cr Wiki
Jump to navigation Jump to search
(Created page with "=Query= {{Query |id=1 |title=Affiliations of Authors |description=Identify the affiliations of the authors of paper X |since=2015-08-25 |storemode=property }} =Freitext=")
 
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
{{Query
 
{{Query
 
|id=1
 
|id=1
|title=Affiliations of Authors
+
|name=AuthorsOfPaper
 +
|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
 +
|relevance=3
 +
|comment=Derived from [[Q0.2|AllPapers]] see [https://scholia.toolforge.org/work/Q115265833 Scholia] Example Paper page] scholia query
 +
|task=Task2
 +
|storemode=property
 
|since=2015-08-25
 
|since=2015-08-25
|storemode=property
 
 
}}
 
}}
 
=Freitext=
 
=Freitext=

Latest revision as of 17: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