This repo is without a file repo nor a search engine. This code deletes any existing "paper-model0.yaml it might be there.
! rm -f data/paper-model0.yaml
from paperapp.paper_repo import PaperRepo
from paperapp.paper_ipython import *
from paperapp.paper_bibtex import import_bibtex_str
p = PaperRepo("data/paper-model0.yaml", auto_save=True)
print(p.versionhash())
0
# bibtex
ids = import_bibtex_str(p,"""
% p1
@misc{fehlhaber2014hubel,
author={Kate Fehlhaber},
title={Hubel and Wiesel and the Neural Basis of Visual Perception},
howpublished={Retrieved from Knowing Neurons. \\url{https://knowingneurons.com/2014/10/29/hubel-and-wiesel-the-neural-basis-of-visual-perception/}},
year={2014}
}
""")
print("Imported: ", len(ids))
print("Imported ids: ", ids)
p.verify()
Imported: 1 Imported ids: ['fehlhaber2014hubel']
21991
The new node is just a dictionary.
p["fehlhaber2014hubel"]
{'id': 'fehlhaber2014hubel', 'type': 'bibtex', 'text': 'misc', 'year': '2014', 'howpublished': 'Retrieved from Knowing Neurons. \\url{https://knowingneurons.com/2014/10/29/hubel-and-wiesel-the-neural-basis-of-visual-perception/}', 'title': 'Hubel and Wiesel and the Neural Basis of Visual Perception', 'author': 'Kate Fehlhaber'}
As paper was loaded with "auto_save=True", all the changes are on disk. We can verify the written file is correct by loading a second instance, checking its content and version hash.
p2 = PaperRepo("data/paper-model0.yaml")
p2.repo
[{'author': 'Kate Fehlhaber', 'howpublished': 'Retrieved from Knowing Neurons. \\url{https://knowingneurons.com/2014/10/29/hubel-and-wiesel-the-neural-basis-of-visual-perception/}', 'id': 'fehlhaber2014hubel', 'text': 'misc', 'title': 'Hubel and Wiesel and the Neural Basis of Visual Perception', 'type': 'bibtex', 'year': '2014'}]
p2.versionhash()
21991
from paperapp.paper_ipython import *
render_node(p, "fehlhaber2014hubel")
edit_node(p, p["fehlhaber2014hubel"])
help(p.new_topic)
Help on method new_topic in module paperapp.paper_repo: new_topic(_id, text, related_to=None, note=None, default=False) method of paperapp.paper_repo.PaperRepo instance Create a new topic, possibly related to existing ones. Returns the newly created node.
p.new_topic("topic-cv", "Computer Vision")
{'id': 'topic-cv', 'type': 'topic', 'text': 'Computer Vision'}
Fill in this information:
new_node(p, _id='paper-620', _type='artifact', upload=False)
render_node(p,'paper-620')
help(p.new_reading_list)
Help on method new_reading_list in module paperapp.paper_repo: new_reading_list(_id, text, *papers, **kwargs) method of paperapp.paper_repo.PaperRepo instance Create a new reading list, possibly related to some topics. Returns the newly created node. Valid keyword arguments are "related_to" and "note".
p.new_reading_list("reading-example", "Example reading list", related_to=p['topic-cv'])
{'id': 'reading-example', 'type': 'reading-list', 'text': 'Example reading list', 'related-to': {'id': 'topic-cv', 'type': 'topic', 'text': 'Computer Vision'}, 'artifacts': []}
help(p.add_to_reading_list)
Help on method add_to_reading_list in module paperapp.paper_repo: add_to_reading_list(reading_list, paper, front=False) method of paperapp.paper_repo.PaperRepo instance Add a paper to the end of a reading list. Both can be expressed ids or nodes. Returns the reading list node
p.add_to_reading_list('reading-example', 'paper-620')
{'id': 'reading-example', 'type': 'reading-list', 'text': 'Example reading list', 'related-to': {'id': 'topic-cv', 'type': 'topic', 'text': 'Computer Vision'}, 'artifacts': [{'id': 'paper-620', 'type': 'artifact', 'text': 'Hubel and Wiesel & the Neural Basis of Visual Perception -- Kate Fehlhaber -- 2014', 'status': 'read', 'bibtex': {'id': 'fehlhaber2014hubel', 'type': 'bibtex', 'text': 'misc', 'year': '2014', 'howpublished': 'Retrieved from Knowing Neurons. \\url{https://knowingneurons.com/2014/10/29/hubel-and-wiesel-the-neural-basis-of-visual-perception/}', 'title': 'Hubel and Wiesel and the Neural Basis of Visual Perception', 'author': 'Kate Fehlhaber'}, 'date': '2014', 'found-date': '201803', 'found-in': 'aavc18 course, 02-concepts', 'on-disk': '/home/pablo/local/hubel.pdf', 'read': '20180705, home yvr projected', 'related-to': {'id': 'topic-cv', 'type': 'topic', 'text': 'Computer Vision'}}]}
These steps could be combined:
p.new_reading_list("reading-example", "Example reading list", p['paper-620'], related_to=p['topic-cv'])
render_node(p, "reading-example")
!cat data/paper-model0.yaml
- type: types types: artifact: bibtex: - bibtex date: [] external: - external found-date: [] found-in: - search - artifact - external id: [] note: [] on-disk: - file read: - scenario related-to: - topic status: [] text: [] type: [] bibtex: address: [] author: [] biburl: [] booktitle: [] chapter: [] crossref: [] date: [] doi: [] editor: [] howpublished: [] id: [] institution: [] isbn: [] issn: [] issue: [] journal: [] link: [] meta: [] month: [] note: [] number: [] organization: [] pages: [] publisher: [] school: [] series: [] text: [] timestamp: [] title: [] type: [] volume: [] year: [] external: cited-by: [] date: [] id: [] note: [] provider: [] text: [] type: [] url: [] file: date: [] id: [] md5hash: [] mimetype: [] note: [] number: [] text: [] type: [] place: date: [] id: [] note: [] text: [] type: [] reading-list: artifacts: - artifact date: [] id: [] note: [] related-to: - topic text: [] type: [] relation: date: [] id: [] note: [] source: - artifact target: - artifact text: [] type: [] scenario: date: [] id: [] location: - place note: [] text: [] type: [] search: date: [] id: [] note: [] related-to: - topic site: [] text: [] type: [] topic: date: [] id: [] note: [] related-to: - topic text: [] type: [] - &fehlhaber2014hubel author: Kate Fehlhaber howpublished: Retrieved from Knowing Neurons. \url{https://knowingneurons.com/2014/10/29/hubel-and-wiesel-the-neural-basis-of-visual-perception/} id: fehlhaber2014hubel text: misc title: Hubel and Wiesel and the Neural Basis of Visual Perception type: bibtex year: '2014' - &topic-cv id: topic-cv text: Computer Vision type: topic - &paper-620 bibtex: *fehlhaber2014hubel date: '2014' found-date: '201803' found-in: aavc18 course, 02-concepts id: paper-620 on-disk: /home/pablo/local/hubel.pdf read: 20180705, home yvr projected related-to: *topic-cv status: read text: Hubel and Wiesel & the Neural Basis of Visual Perception -- Kate Fehlhaber -- 2014 type: artifact - artifacts: - *paper-620 id: reading-example related-to: *topic-cv text: Example reading list type: reading-list