def __init__(self, name, id, uri, dDate, dCauses, deathplace, dContexts, burialplace): self.name = name self.id = id self.uri = uri self.deathDate = dDate self.deathCauses = dCauses self.deathplace = deathplace self.burialplace = burialplace self.deathContexts = dContexts self.death_list = [] if self.deathDate != "": self.death_list.append( predicateValue(NS_DICT["cwrc"].hasDeathDate, format_date(self.deathDate))) if self.deathplace: self.death_list.append( predicateValue(NS_DICT["cwrc"].hasDeathPlace, deathplace)) if self.burialplace: self.death_list.append( predicateValue(NS_DICT["cwrc"].hasBurialPlace, burialplace))
def __init__(self, name, id, uri, bDate, bPosition, birthplace): self.name = name self.id = id self.uri = uri self.birthDate = bDate self.birthPositions = bPosition self.birthplace = birthplace self.birth_list = [] if self.birthDate != "": self.birth_list.append( predicateValue(NS_DICT["cwrc"].hasBirthDate, format_date(self.birthDate))) for birthPosition in self.birthPositions: if birthPosition == "ONLY": positionObj = NS_DICT["cwrc"].onlyChild elif birthPosition == "ELDEST": positionObj = NS_DICT["cwrc"].eldestChild elif birthPosition == "YOUNGEST": positionObj = NS_DICT["cwrc"].youngestChild elif birthPosition == "MIDDLE:": positionObj = NS_DICT["cwrc"].middleChild self.birth_list.append( predicateValue(NS_DICT["cwrc"].hasBirthPosition, positionObj)) if self.birthplace: self.birth_list.append( predicateValue(NS_DICT["cwrc"].hasBirthPlace, birthplace))
def to_triple(self): global g spList = [] g = rdflib.Graph() namespace_manager = rdflib.namespace.NamespaceManager(g) bind_ns(namespace_manager, NS_DICT) if self.birthDate != "": g.add((self.uri, NS_DICT["cwrc"].hasBirthDate, format_date(self.birthDate))) spList.append( addDict("cwrc.hasBirthDate", format_date(self.birthDate), False)) for birthPosition in self.birthPositions: if birthPosition == "ONLY": positionObj = NS_DICT["cwrc"].onlyChild elif birthPosition == "ELDEST": positionObj = NS_DICT["cwrc"].eldestChild elif birthPosition == "YOUNGEST": positionObj = NS_DICT["cwrc"].youngestChild elif birthPosition == "MIDDLE:": positionObj = NS_DICT["cwrc"].middleChild g.add((self.uri, NS_DICT["cwrc"].hasBirthPosition, positionObj)) spList.append( addDict("cwrc.hasBirthPosition", longFormtoShort(Literal(positionObj)), False)) if self.birthplace: g.add((self.uri, NS_DICT["cwrc"].hasBirthPlace, self.birthplace)) spList.append(addDict("cwrc.hasBirthPlace", self.birthplace, False)) # if self.birthContexts != None and len(self.birthContexts) > 0: # listProperties = {} # listProperties["subjectName"] = getStandardUri(self.name) # listProperties["unchangedName"] = self.name # listProperties["descType"] = NS_DICT["cwrc"].FriendsAndAssociatesContext # listProperties["subjectsObjects"] = spList # # for context in self.birthContexts: # addContextsNew(self.id,"birthContext",context,self.uri,1,listProperties) return g
def to_triple(self, person): g = utilities.create_graph() if self.date: g.add((person.uri, utilities.NS_DICT["cwrc"].hasBirthDate, format_date(self.date))) for x in self.position: g.add((person.uri, utilities.NS_DICT["cwrc"].hasBirthPosition, x)) if self.place: g.add((person.uri, utilities.NS_DICT["cwrc"].hasBirthPlace, self.place)) return g
def to_triple(self, person): g = utilities.create_graph() if self.date: g.add((person.uri, utilities.NS_DICT["cwrc"].hasDeathDate, format_date(self.date))) if self.burial: g.add((person.uri, utilities.NS_DICT["cwrc"].hasBurialPlace, self.burial)) if self.place: g.add((person.uri, utilities.NS_DICT["cwrc"].hasDeathPlace, self.place)) return g
def to_triples(self): global g spList = [] g = rdflib.Graph() namespace_manager = rdflib.namespace.NamespaceManager(g) bind_ns(namespace_manager, NS_DICT) if self is not None: # if dateValidate(self.deathInfo.deathDate): if self.deathDate != "": g.add((self.uri, NS_DICT["cwrc"].hasDeathDate, format_date(self.deathDate))) spList.append( addDict("cwrc.hasDeathDate", Literal(self.deathDate), False)) if self.deathplace: g.add( (self.uri, NS_DICT["cwrc"].hasDeathPlace, self.deathplace)) spList.append( addDict("cwrc.hasDeathPlace", self.deathplace, False)) if self.burialplace: g.add((self.uri, NS_DICT["cwrc"].hasBurialPlace, self.burialplace)) spList.append( addDict("cwrc.hasBurialPlace", self.burialplace, False)) # if self.deathContexts != None and len(self.deathContexts) > 0: # listProperties = {} # listProperties["subjectName"] = getStandardUri(self.name) # listProperties["unchangedName"] = self.name # listProperties["descType"] = NS_DICT["cwrc"].FriendsAndAssociatesContext # listProperties["subjectsObjects"] = spList # for context in self.deathContexts: # addContextsNew(self.id, "deathContext", context, self.uri, 1, listProperties) # # # addContexts(fileName,"hasDeathContext",self.deathContexts,sou return g