-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JARS-144] Document that dont have rdf:type relation are ingested #146
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__len__
also needs to be changed, or the length of the iterator doesn't equal the number of iterated entries.
cookies/accession/zotero.py
Outdated
raise StopIteration() | ||
self.current_entries = self._get_resources_nodes(self.current_class) | ||
next_entry = self.current_entries.next() | ||
for i in self.graph.objects(subject=next_entry): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i
is a pretty bad variable name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you provide the predicate you're looking for here? there is no reason to iterate over all triples. in addition, if any of the other triples have an object 'attachment', the entry will be skipped although it might be a real one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, just assume there is either no itemtype or one. if there are more than one, this would be an error anyways and the other ones can be disregarded.
cookies/accession/zotero.py
Outdated
self.current_entries = self._get_resources_nodes(self.current_class) | ||
next_entry = self.current_entries.next() | ||
for i in self.graph.objects(subject=next_entry): | ||
if str(i) == 'attachment': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a constant
Made the following changes :-
|
raise StopIteration() | ||
self.current_entries = self._get_resources_nodes(self.current_class) | ||
next_entry = self.current_entries.next() | ||
if str(next(self.graph.objects(subject=next_entry, predicate=ZOTERO.itemType))) == \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if 'self.graph.objects(subject=next_entry, predicate=ZOTERO.itemType)' is None?
next_entry = self.current_entries.next() | ||
if str(next(self.graph.objects(subject=next_entry, predicate=ZOTERO.itemType))) == \ | ||
settings.ATTACHMENT_ITEMTYPE: | ||
next_entry = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len still returning wrong length
No description provided.