def obtain_network_from_scopus(query): """ Obtains a reference network from scopus for a given query """ articles = {} search_result = scopus.ScopusSearch(query) print("Start downloading the abstracts") for eid in search_result.EIDS: article = scopus.ScopusAbstract(eid, view="FULL") articles[eid] = article #time.sleep(200) # six per second allowed, let's do five print(".", end="") print("\nAll downloaded") connections = [] for article in articles.values(): if not article.references: print("No references found for '{eid}'".format(eid=article.eid)) continue for reference in article.references: print(".", end="") if reference in articles: connections.append((article, articles[reference])) return connections
def test_authkeywords(): ab2 = scopus.ScopusAbstract("2-s2.0-0000212165", view="FULL", refresh=True) authkeywords = ab2.authkeywords assert_true(len(authkeywords) == 3) assert_equal(authkeywords[0], 'Fuzzy clustering') assert_equal(authkeywords[1], 'Fuzzy modelling') assert_equal(authkeywords[2], 'Unsupervised learning')
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `ScopusAbstract` module.""" from nose.tools import assert_equal, assert_true import scopus ab = scopus.ScopusAbstract("2-s2.0-84930616647", view="FULL", refresh=True) def test_affiliations(): affs = ab.affiliations assert_true(len(affs) == 1) aff = affs[0] assert_true(isinstance(aff, scopus.scopus_api._ScopusAffiliation)) assert_equal(aff.id, '60027950') assert_equal(aff.affilname, 'Carnegie Mellon University') assert_equal(aff.city, 'Pittsburgh') assert_equal(aff.country, 'United States') link = 'https://api.elsevier.com/content/affiliation/affiliation_id/60027950' assert_equal(aff.href, link) def test_aggregationType(): assert_equal(ab.aggregationType, 'Journal') def test_article_number(): pass