Skip to content

Commit

Permalink
cleaned everything
Browse files Browse the repository at this point in the history
  • Loading branch information
OrsolaMBorrini committed May 19, 2023
1 parent 74f840a commit 267845f
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 21,658 deletions.
30 changes: 0 additions & 30 deletions GenericQueryP.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,16 @@ def getPublicationsPublishedInYear(self, year):
for item in self.queryProcessor:
# For every query processor added to the generic query processor, call the query
partial_result = item.getPublicationsPublishedInYear(year)
#print(partial_result)
# Concatenate the result of this query (type DataFrame) to the empty df outside of the for-in cycle to *save* the result
complete_result = pd.concat([complete_result,partial_result])

# complete_result is now populated by all the results of the query for every query processor
result = list() # list[Publication]
#print(complete_result)
# Drop all duplicate values
ids = set() # unordered collection of unique elements, no worries about duplicates
# Scroll the complete_result dataframe
for idx,row in complete_result.iterrows():
ids.add(row["doi"])
#print(ids)
# Iterate over the cleaned set of DOIs and create a Publication object for each
for item in ids:
# Append the Publication object to the result list
Expand All @@ -59,16 +56,13 @@ def getPublicationsByAuthorId(self, orcid):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getPublicationsByAuthorId(orcid)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list() # list[Publication]
#print(complete_result)
# Drop duplicate ids
ids = set()
for idx,row in complete_result.iterrows():
ids.add(row["doi"])
#print(ids)
for item in ids:
result.append(createPublicationObj(item))

Expand Down Expand Up @@ -141,18 +135,15 @@ def getVenuesByPublisherId(self, crossref):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getVenuesByPublisherId(crossref)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

# complete_result is now populated by all the results of the query for every query processor
result = list() # list[Publication]
#print(complete_result)
# Drop all duplicate values
ven_name = set() # unordered collection of unique elements, no worries about duplicates
# Scroll the complete_result dataframe
for idx,row in complete_result.iterrows():
ven_name.add(row["publication_venue"])
#print(ven_name)
# Iterate over the cleaned set of publication venue names and create a Venue object for each
for item in ven_name:
# Append the Publication object to the result list
Expand All @@ -169,16 +160,13 @@ def getPublicationInVenue(self, issn_isbn):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getPublicationInVenue(issn_isbn)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list() # list[Publication]
#print(complete_result)
# Drop duplicate ids
ids = set()
for idx,row in complete_result.iterrows():
ids.add(row["doi"])
#print(ids)
for item in ids:
result.append(createPublicationObj(item))

Expand All @@ -192,11 +180,9 @@ def getJournalArticlesInIssue(self, issue, volume, journalId):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getJournalArticlesInIssue(issue,volume,journalId)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()
#print(complete_result)
ids = set()
for idx,row in complete_result.iterrows():
ids.add(row["doi"])
Expand All @@ -214,11 +200,9 @@ def getJournalArticlesInVolume(self, volume, journalId):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getJournalArticlesInVolume(volume,journalId)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()
#print(complete_result)
ids = set()
for idx,row in complete_result.iterrows():
ids.add(row["doi"])
Expand All @@ -236,16 +220,13 @@ def getJournalArticlesInJournal(self, journalId):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getJournalArticlesInJournal(journalId)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()
#print(complete_result)
ids = set()
for idx,row in complete_result.iterrows():
ids.add(row["doi"])

#print(ids)
for item in ids:
result.append(createJournalArticleObj(item))

Expand All @@ -259,15 +240,13 @@ def getProceedingsByEvent(self, eventPartialName):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getProceedingsByEvent(eventPartialName)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()

ven_name = set()
for idx,row in complete_result.iterrows():
ven_name.add(row["publication_venue"])
#print(ven_name)
for item in ven_name:
result.append(createVenueObj(item,"proceedings"))

Expand All @@ -282,15 +261,12 @@ def getPublicationAuthors(self, doi):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getPublicationAuthors(doi)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()
#print(complete_result)
orcid = set()
for idx,row in complete_result.iterrows():
orcid.add(row["orcid"])
#print(orcid)
for item in orcid:
result.append(createAuthorObj(item))

Expand All @@ -305,15 +281,12 @@ def getPublicationsByAuthorName(self, authorPartialName):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getPublicationsByAuthorName(authorPartialName)
#print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()
#print(complete_result)
ids = set()
for idx,row in complete_result.iterrows():
ids.add(row["doi"])
#print(ids)
for item in ids:
result.append(createPublicationObj(item))

Expand All @@ -328,15 +301,12 @@ def getDistinctPublishersOfPublications(self, doiList):
complete_result = pd.DataFrame()
for item in self.queryProcessor:
partial_result = item.getDistinctPublishersOfPublications(doiList)
print(partial_result)
complete_result = pd.concat([complete_result,partial_result])

result = list()
print(complete_result)
crossrefs = set()
for idx,row in complete_result.iterrows():
crossrefs.add(row["crossref"])
print(crossrefs)
for item in crossrefs:
result.append(createPublisherObj(item))

Expand Down
101 changes: 1 addition & 100 deletions ModelClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ def getIds(self):
return result


""" id1 = IdentifiableEntity(["10546"])
print(id1)
print(type(id1))
print(id1.getIds())
print("\n------------------------\n")
id2 = IdentifiableEntity(["10546","46351"])
print("This is id2 \n",id2)
print(type(id2))
print(id2.getIds())
"""



class Person(IdentifiableEntity):
# -- Constructor
def __init__(self, givenName, familyName, identifiers):
Expand All @@ -47,15 +32,6 @@ def getFamilyName(self):
return self.familyName


#person1 = Person("Ahsan","Syed",["Ahsa98"])
""" print("This is person1",person1)
print(type(person1))
print("This is the familyName of person1\n",person1.getFamilyName())
print("This is the givenName of person1\n",person1.getGivenName())
print(person1.getIds())
"""
#person2 = Person("Francesca","Budel",["FraB99","Fra99"])

class Organization(IdentifiableEntity):
# -- Constructor
def __init__(self, name, identifiers):
Expand All @@ -69,14 +45,6 @@ def getName(self):
return self.name


#org1 = Organization("The Belmeloro organization",["belm2023"])
"""
print(org1)
print(type(org1))
print("This is the name of org1\n",org1.getName())
print(org1.getIds()) """


class Venue(IdentifiableEntity):
# -- Constructor
def __init__(self, title, identifiers, publisher):
Expand All @@ -96,21 +64,6 @@ def getPublisher(self): # Returns an Organization object
return self.publisher


#ven1 = Venue("Belmeloro Venue", ["belm0000", "belm1111"], org1)
"""
print(ven1)
print(type(ven1))
print("This is the title of the venue\n",ven1.getTitle())
print("This is the publisher of the venue",ven1.getPublisher())
print("This is the ID of the venue", ven1.getIds())
print("------------------------------------ \n ------------------------------")
print("ID OF THE PUBLISHER\n",ven1.getPublisher().getIds())
print("NAME OF THE PUBLISHER\n",ven1.getPublisher().getName())
"""

class Publication(IdentifiableEntity):
# -- Constructor
def __init__(self, title, identifiers, author, cites, publicationVenue=None, publicationYear=None):
Expand Down Expand Up @@ -144,17 +97,6 @@ def getAuthors(self):
result.add(person)
return result

#pub1 = Publication(1963, "The Name of the Rose", ["abc1001","cba1001"], ven1,[person1,person2],[])
"""
print(pub1)
print(type(pub1))
print(pub1.getIds())
print("This is the publication year of the publication\n",pub1.getPublicationYear())
print("This is the title of the publication",pub1.getTitle())
print("This is the cited publications of the publication", pub1.getCitedPublications())
print("This is the publication venue of the publication",pub1.getPublicationVenue())
print("This is the authors of the publication",pub1.getAuthors())
"""

class JournalArticle(Publication):
# -- Constructor
Expand All @@ -172,20 +114,7 @@ def getIssue(self):
def getVolume(self):
return self.volume

#journal_article1 = JournalArticle("issue1","volume1",1944,"Journal Article on WW2",["id1","id2"],ven1,[person2],[pub1])
"""
print(journal_article1)
print(type(journal_article1))
print(journal_article1.getIssue())
print(journal_article1.getVolume())
print(journal_article1.getAuthors())
print(journal_article1.getCitedPublications())
print(journal_article1.getIds())
print(journal_article1.getPublicationYear())
print(journal_article1.getTitle())
print(journal_article1.getPublicationVenue())
"""


class BookChapter(Publication):
# -- Constructor
Expand All @@ -199,46 +128,22 @@ def __init__(self, chapterNumber, title, identifiers, author, cites, publication
def getChapterNumber(self):
return self.chapterNumber

""" book_chapter1 = BookChapter(1,1944,"Book on WW2",["id11","id12"],ven1,[person1],[pub1])
print(book_chapter1)
print(type(book_chapter1))
print(book_chapter1.getChapterNumber())
print(book_chapter1.getAuthors())
print(book_chapter1.getCitedPublications())
print(book_chapter1.getIds())
print(book_chapter1.getPublicationYear())
print(book_chapter1.getTitle())
print(book_chapter1.getPublicationVenue())

print("--------------------- \n ------------------- \n -----------------") """

class ProceedingsPaper(Publication):
pass

""" proceedings_paper1 = ProceedingsPaper(1963, "The Name of the Rose", ["abc1001","cba1001"], ven1,[person1,person2],[])
print(proceedings_paper1)
print(type(proceedings_paper1))

print("--------------------- \n ------------------- \n -----------------") """

class Journal(Venue):
pass

""" journal1 = Journal("Belmeloro Venue", ["belm0000", "belm1111"], org1)
print(journal1)
print(type(journal1))

print("--------------------- \n ------------------- \n -----------------") """

class Book(Venue):
pass

""" book1 = Book("Belmeloro Venue", ["belm0000", "belm1111"], org1)
print(book1)
print(type(book1))

print("--------------------- \n ------------------- \n -----------------") """

class Proceedings(Venue):
# -- Constructor
Expand All @@ -251,10 +156,6 @@ def __init__(self, event, title, identifiers, publisher):
def getEvent(self):
return self.event

""" proceedings1 = Proceedings("Event Belmeloro","Belmeloro Venue", ["belm0000", "belm1111"], org1)
print(proceedings1)
print(type(proceedings1))
print(proceedings1.getEvent()) """

class QueryProcessor(object):
pass
Loading

0 comments on commit 267845f

Please sign in to comment.