Giter VIP home page Giter VIP logo

Comments (1)

fnielsen avatar fnielsen commented on July 29, 2024

The current implementation is somewhat slow.

This more explicit way renders all years from 2000 with zeros as default. However, yearlier zero years are not rendered.

#defaultView:BarChart
# Inspired from LEGOLAS - http://abel.lis.illinois.edu/legolas/
# Shubhanshu Mishra, Vetle Torvik
SELECT
  (STR(?year) AS ?year)
  (COUNT(?work) AS ?number_of_publications)
  ?role 
WHERE {
  {
    VALUES ?year { 
      2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
      2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
    }
  }
  UNION 
  {
    {
      select ?work (min(?years) as ?year) (count(?coauthors) as ?number_of_authors) ?author_number where {
        ?work (p:P50|p:P2093) ?author_statement . 
        ?author_statement ps:P50 wd:Q20984804 .
        optional { ?author_statement pq:P1545 ?author_number . }
        ?work (wdt:P50|wdt:P2093) ?coauthors . 
        ?work wdt:P577 ?dates .
        bind(str(year(?dates)) as ?years) .
      }
      group by ?work ?author_number
    }
    bind(coalesce(if(?number_of_authors = 1,
              'Solo author',
              if(xsd:integer(?author_number) = 1,
                 'First author',
                 if(xsd:integer(?author_number) = ?number_of_authors,
                    'Last author',
                    'Middle author'))), 'Unknown')
         as ?role)
   }
}
group by ?year ?role
order by ?year

from scholia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.