diff --git a/Mods/modsBib.py b/Mods/modsBib.py index ecfb50a..87a83bc 100644 --- a/Mods/modsBib.py +++ b/Mods/modsBib.py @@ -46,7 +46,6 @@ } genre_graph = None - genre_map = {} # from writing parsing genre_mapping = {} # genre mapping from CSV geoMapper = None @@ -57,8 +56,6 @@ MEDIUMS = [] AGENTS = {} - - # --------- UTILITY FUNCTIONS ------- @@ -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: @@ -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 @@ -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") @@ -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) @@ -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"]: @@ -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)