Skip to content

Commit

Permalink
Revert "appending properly to genre_map #36"
Browse files Browse the repository at this point in the history
This reverts commit 0fd024e.
  • Loading branch information
alliyya committed Jul 19, 2022
1 parent 62deace commit 2fd3134
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions Mods/modsBib.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
}

genre_graph = None

genre_map = {} # from writing parsing
genre_mapping = {} # genre mapping from CSV
geoMapper = None
Expand All @@ -57,8 +56,6 @@
MEDIUMS = []
AGENTS = {}



# --------- UTILITY FUNCTIONS -------


Expand Down Expand Up @@ -242,6 +239,7 @@ class WritingParse:
"""
matched_documents = None
soup = None

def __init__(self, filename, matched_documents):

with open(filename,encoding='utf-8') as f:
Expand All @@ -251,7 +249,8 @@ def __init__(self, filename, matched_documents):
self.matched_documents = matched_documents

self.parse_db_refs()

# print(self.matched_documents)
# input()
def parse_db_refs(self):
"""
Maps all genres within a textscope to the given ref/dbref
Expand Down Expand Up @@ -279,15 +278,7 @@ def parse_db_refs(self):
name = genre.attrs['GENRENAME']
genres.append(name)


if rec_id in self.matched_documents:
for x in genres:
if x not in self.matched_documents[rec_id]:
self.matched_documents[rec_id].append(x)
else:
self.matched_documents[rec_id] = list(set(genres))


self.matched_documents[rec_id] = genres
else:
logger.error("TEXTSCOPE missing REF & DBREF attribute")

Expand Down Expand Up @@ -697,13 +688,10 @@ def get_main_title(self, titles):
if x['usage'] == 'primary':
self.mainTitle = x['title'].strip().replace("\n"," ").replace("\t"," ")
return


def build_graph(self):
g = self.g
i = 0


titles = self.get_title()
self.get_main_title(titles)
resource = g.resource(self.mainURI)
Expand Down Expand Up @@ -738,6 +726,8 @@ def build_graph(self):

for name in self.get_names():
# contribution_resource = g.resource(self.mainURI + "#contribution_{}".format(i))



agent_resource = None
if "uri" in name and name["uri"]:
Expand Down Expand Up @@ -776,6 +766,7 @@ def build_graph(self):




# agent_resource = g.resource(self.mainURI + "#agent_{}".format(i))
if name['type'] == 'personal':
agent_resource.add(RDF.type, BF.Person)
Expand Down

0 comments on commit 2fd3134

Please sign in to comment.