inspirehep/relations

Name: relations

Owner: inspirehep

Description: Neo4J-based module to handle INSPIRE specific relations

Created: 2015-10-27 15:00:38.0

Updated: 2015-10-27 16:09:00.0

Pushed: 2015-10-27 20:22:40.0

Homepage: null

Size: 156

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Relations

Build Status

Coverage Status

PyPi

License

A simple module built on top of neomodels, py2neo to persist citation graph information to a neo4j graph database.

Installation
install inspire_relation

port this variable - required for neomodels to connect to the database.
rt NEO4J_REST_URL=http://localhost:7474/db/data/
ython

tion_manager = RelationManager()
my_citation_network = [
{"record": 1, "references": [11, 15, 17, 18], "authors": [1, 2, 3]},
{"record": 2, "references": [15, 17, 18], "authors": [2, 3]}, 
{"record": 3, "references": [1, 2, 18], "authors": [3, 2]}


citation_graph_item in _dummy_citation_network:
for reference in citation_graph_item["references"]:
    relation_manager.add_reference(citation_graph_item["record"], reference)

for author in citation_graph_item["authors"]:
    relation_manager.add_author(citation_graph_item["record"], author)

Now, from the relation_manager you can get some information back

I can also easily find which papers were created by a particular author using its author ID.

thors = self.relation_manager.get_authors_for_record(2)

pers_for_author = self.relation_manager.get_papers_for_author(2)
r paper in papers_for_author:
print paper.record_id

 Will return 3, 2 and 1, referring to the 3 papers authored by author 2.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.