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

Recent publications by co-authors #82

Open
Daniel-Mietchen opened this issue Mar 18, 2017 · 2 comments

Comments

2 participants
@Daniel-Mietchen
Copy link
Collaborator

commented Mar 18, 2017

In the author aspect, something like recent publications by former co-authors could be a useful discovery tool (shown here for Uta Frith):

SELECT DISTINCT ?work2 ?work2Label ?date 
(GROUP_CONCAT(DISTINCT ?author2Label; separator=", ") AS ?authorLabels) 
WHERE {
  ?work wdt:P50 wd:Q8219 .
  ?work wdt:P50 ?author1 .
  ?work wdt:P50 ?author2 .
  VALUES ?publication_type { wd:Q13442814 wd:Q571 wd:Q26973022}  # journal and conference articles, books, not (yet?) software
  ?work2 wdt:P31 ?publication_type;
         wdt:P50 ?author2 ;
         wdt:P577 ?date.
  MINUS { ?work2 wdt:P50 wd:Q8219 } .
  ?author2 rdfs:label ?author2Label . filter (lang(?author2Label) = 'en')
  ?work2 rdfs:label ?work2Label . filter (lang(?work2Label) = 'en')
} GROUP BY ?work2 ?work2Label ?date 
ORDER BY DESC (?date)

LIMIT 200
@Daniel-Mietchen

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 13, 2019

The query barely runs through for Uta Frith, so I removed the VALUES part:

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

SELECT DISTINCT ?work2 ?work2Label ?date 
(GROUP_CONCAT(DISTINCT ?author2Label; separator=", ") AS ?authorLabels) 
WHERE {
  ?work wdt:P50 target: .
  ?work wdt:P50 ?author1 .
  ?work wdt:P50 ?author2 .
  ?work2 wdt:P50 ?author2 ;
         wdt:P577 ?date.
  MINUS { ?work2 wdt:P50 target: } .
  ?author2 rdfs:label ?author2Label . filter (lang(?author2Label) = 'en')
  ?work2 rdfs:label ?work2Label . filter (lang(?work2Label) = 'en')
} GROUP BY ?work2 ?work2Label ?date 
ORDER BY DESC (?date)

LIMIT 200

Try it

This times out for people with large collaboration networks, so it would make sense to limit this to a maximum of co-authors.

@fnielsen

This comment has been minimized.

Copy link
Owner

commented Jun 13, 2019

This runs in two seconds:

SELECT
  ?date ?work ?workLabel 
  (GROUP_CONCAT(?author_string; separator=" // ") AS ?authors)
WHERE { 
  {
    SELECT (MAX(?date_) AS ?date) ?work 
    WHERE {
      BIND(wd:Q8219 AS ?target)
      [] wdt:P50 ?target, ?author_ .
      ?work wdt:P50 ?author_ ; 
            wdt:P577 ?date_ .
      MINUS { ?work wdt:P50 ?target } .
    }
    GROUP BY ?work 
    ORDER BY DESC (?date)
    LIMIT 200
  }
  hint:Query hint:optimizer "None" .
  ?work wdt:P50 ?author .
  ?author rdfs:label ?author_string . 
  FILTER (LANG(?author_string) = 'en')
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?date ?work ?workLabel 
ORDER BY DESC(?date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.