Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of pages bar chart on organization is too slow #2176

Open
fnielsen opened this issue Nov 16, 2022 · 0 comments
Open

Number of pages bar chart on organization is too slow #2176

fnielsen opened this issue Nov 16, 2022 · 0 comments
Labels
SPARQL the way Scholia queries Wikidata

Comments

@fnielsen
Copy link
Collaborator

What query is this about
Number of pages bar chart on organization is too slow

What change do you propose, and why?

# tool: scholia
#defaultView:BarChart

PREFIX target: <http://www.wikidata.org/entity/Q23048689>

# Pages per year bar chart of an organization
SELECT
  ?year
  (SUM(?pages_per_author) AS ?number_of_pages)
  ?researcher_label
WITH {
  SELECT DISTINCT 
    ?researcher
  WHERE {
     ?researcher wdt:P108 | wdt:P463 | (wdt:P1416 / wdt:P361*) target: .
  }
} AS %researchers
WHERE {
  {
    SELECT
      ?researcher_label ?work ?year
      (SAMPLE(?pages) / COUNT(?researcher_of_paper) AS ?pages_per_author)
    WHERE {
      # Find authors associated with organization
      INCLUDE %researchers
      ?work wdt:P50 ?researcher .
      
      ?work (wdt:P50|wdt:P2093) ?researcher_of_paper .
      
      # Disabled to only look on scholarly articles
      # ?work wdt:P31 wd:Q13442814 .
      
      ?work wdt:P1104 ?pages .
      ?work wdt:P577 ?date . 
      BIND(STR(YEAR(?date)) AS ?year) 
      ?researcher rdfs:label ?researcher_label . FILTER(LANG(?researcher_label) = 'en')
    } 
    GROUP BY ?work ?researcher_label ?year
  }
}
GROUP BY ?year ?researcher_label 
ORDER BY ?year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SPARQL the way Scholia queries Wikidata
Projects
None yet
Development

No branches or pull requests

1 participant