oc_graphenricher.APIs package
Submodules
oc_graphenricher.APIs.test_queryinterface module
Copyright 2021 Gabriele Pisciotta - ga.pisciotta@gmail.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Module contents
Copyright 2021 Gabriele Pisciotta - ga.pisciotta@gmail.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- class oc_graphenricher.APIs.QueryInterface[source]
Bases:
ABC
This class is a sort of interface that you can implement in your own class
- _abc_impl = <_abc_data object>
- class oc_graphenricher.APIs.VIAF[source]
Bases:
QueryInterface
This class let you extract the VIAF of an author, by querying the viaf.org API
- query(given_name, family_name, title)[source]
Having specified the author’s names and the title of a paper, extract a VIAF
- Parameters:
given_name (str) – author’s given name
family_name (str) – author’s family name
title (str) – paper’s title
- Returns:
VIAF, if exists, otherwise None
- _abc_impl = <_abc_data object>
- class oc_graphenricher.APIs.WikiData[source]
Bases:
QueryInterface
This class let you query WikiData by means of another identifier, in order to check the existance of a related entity on WikiData
- query(entity, schema)[source]
Method to query WikiData, given the literal of an identifier and its schema
- Parameters:
entity (str) – the literal of the given identifier
schema (str) – the schema of the given identifier
- Returns:
Wikidata ID if found, otherwise None
- _abc_impl = <_abc_data object>
- class oc_graphenricher.APIs.Crossref(crossref_min_similarity_score=0.95, max_iteration=6, sec_to_wait=10, headers={'User-Agent': 'GraphEnricher (via OpenCitations - http://opencitations.net; mailto:contact@opencitations.net)'}, timeout=30, is_json=True)[source]
Bases:
QueryInterface
This class let you query Crossref in order to extract DOIs, ISSNs and publishers’ IDs
- _cleaning_title(title)[source]
Clean a given title, filtering the words according to a stoplist and extracting a subset of the keywords
- Parameters:
title (str) – the title string
- Returns:
the cleaned title
- static _cleaning_name(name_raw)[source]
Clean the name of an author
- Parameters:
name_raw (str) – the name string
- Returns:
the cleaned name
- query_journal(issn)[source]
Query Crossref to get a list of any other ISSN known, related to an entity described by an ISSN to give in input. The list of ISSNs retur will be cleaned from the ISSN already known.
- Parameters:
issn (str) – the ISSN of the bibliographic entity
- Returns:
a list that contains any other ISSN found, otherwise an empty list
- query_publisher(doi)[source]
Method to extract the identifier of a publisher starting from a given DOI.
- Parameters:
doi (str) – the DOI of the paper
- Returns:
a string representing the ID of the publisher, otherwise None
- query(fullnames, title, year)[source]
Method to extract the DOI, given the names of the authors, the title of the paper and the year of publication
- Parameters:
fullnames (list) – a list composed of a tuple of <name, family_name> (e.g.: [ (“Gabriele”, “Pisciotta”) ]
title (str) – the title of the paper
year (str) – a string that represent the year of publication
- Returns:
the DOI found, otherwise None
- _abc_impl = <_abc_data object>
- class oc_graphenricher.APIs.ORCID(max_iteration=6, sec_to_wait=10, headers={'Content-Type': 'application/json', 'User-Agent': 'GraphEnricher (via OpenCitations - http://opencitations.net; mailto:contact@opencitations.net)'}, timeout=30, repok=None, reperr=None, is_json=True)[source]
Bases:
QueryInterface
This class let you query ORCID in order to extract ORCID IDs
- query(authors, identifiers)[source]
Given a list of authors and a list of identifiers, returns the ORCIDs in the list of authors
- Parameters:
authors (list) – a list of tuples in the following form [ (name, family_name, ORCID, ar_object) ]
identifiers (list) – a list of identifiers of the bibliographic resource
- Returns:
the authors list enriched with the ORCID identifier
- _get_orcid_records(identifiers, family_names=[])[source]
- Parameters:
identifiers (list) –
family_names (list) –
- __dict_get(d, key_list)
- __dict_add()
- __get_data(get_url)
Method to send requests
- Parameters:
get_url – the URL to query
- Returns:
results if found, otherwise None
- _abc_impl = <_abc_data object>