Skip to content

Commit

Permalink
cache & faster
Browse files Browse the repository at this point in the history
  • Loading branch information
yindaheng98 committed Dec 15, 2023
1 parent 79e376e commit 08031d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dblp_crawler/summarizer/neo4j.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ def add_person(tx, person: DBLPPerson, added_pubs: set, added_journals: set):
pid=person.pid(), name=person.name(),
aff=list(person.person().affiliations()),
orcid=orcid)
exist_write_papers = set([title_hash for (title_hash, ) in tx.run(
"MATCH (a:Person {dblp_pid: $pid})-[:WRITE]->(p:Publication) RETURN p.title_hash",
pid=person.pid()
).values()])
for publication in person.publications():
tx.run("MERGE (a:Person {dblp_pid: $pid}) "
if publication.title_hash() in exist_write_papers:
continue
tx.run("MATCH (a:Person {dblp_pid: $pid}) "
"MERGE (p:Publication {title_hash: $title_hash}) "
"MERGE (a)-[:WRITE]->(p)",
pid=person.pid(),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

setup(
name='dblp_crawler',
version='1.8.9',
version='1.8.10',
author='yindaheng98',
author_email='[email protected]',
url='https://github.com/yindaheng98/dblp-crawler',
Expand Down

0 comments on commit 08031d5

Please sign in to comment.