Skip to content
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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

prnvshrn
Copy link
Collaborator

No description provided.

@prnvshrn prnvshrn requested a review from jdamerow November 16, 2018 22:02
Copy link
Member

@jdamerow jdamerow left a 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.

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):
Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

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':
Copy link
Member

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

@jdamerow jdamerow closed this Nov 20, 2018
@prnvshrn prnvshrn reopened this Dec 4, 2018
@prnvshrn
Copy link
Collaborator Author

prnvshrn commented Dec 4, 2018

Made the following changes :-

  1. Checking by predicates and subject for every graph object
  2. Added a attachment variable in settings.py

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))) == \
Copy link
Member

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
Copy link
Member

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

@jdamerow jdamerow closed this Dec 11, 2018
@prnvshrn prnvshrn reopened this Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants