[TASK] Add gender thing for business role names.
This commit is contained in:
parent
b37360c97d
commit
3cb2749494
52
triplify.py
52
triplify.py
|
@ -1,3 +1,4 @@
|
||||||
|
# coding=utf-8
|
||||||
#SQL
|
#SQL
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
@ -176,6 +177,55 @@ class IdSequence:
|
||||||
self.num += 1
|
self.num += 1
|
||||||
return self.num
|
return self.num
|
||||||
|
|
||||||
|
def getBusinessRoleName(membership):
|
||||||
|
"""Gender based mapping for business role names."""
|
||||||
|
names = {
|
||||||
|
"M": {
|
||||||
|
1000000000: "Beschäftigter",
|
||||||
|
1000000001: "Professor",
|
||||||
|
1000000002: "Wissenschaftlicher Mitarbeiter",
|
||||||
|
1000000003: "Auszubildender",
|
||||||
|
1000000004: "Lehrkraft für besondere Aufgaben",
|
||||||
|
1000000005: "Lehrbeauftragter",
|
||||||
|
1000000006: "Praktikant",
|
||||||
|
1000000007: "Wissenschaftliche Hilfskraft",
|
||||||
|
1000000008: "Studentische Hilfskraft",
|
||||||
|
1000000009: "Lehrkraft",
|
||||||
|
1000000010: "Leiter"
|
||||||
|
},
|
||||||
|
"F": {
|
||||||
|
1000000000: "Beschäftigte",
|
||||||
|
1000000001: "Professorin",
|
||||||
|
1000000002: "Wissenschaftliche Mitarbeiterin",
|
||||||
|
1000000003: "Auszubildende",
|
||||||
|
1000000004: "Lehrkraft für besondere Aufgaben",
|
||||||
|
1000000005: "Lehrbeauftragte",
|
||||||
|
1000000006: "Praktikantin",
|
||||||
|
1000000007: "Wissenschaftliche Hilfskraft",
|
||||||
|
1000000008: "Studentische Hilfskraft",
|
||||||
|
1000000009: "Lehrkraft",
|
||||||
|
1000000010: "Leiterin"
|
||||||
|
},
|
||||||
|
"?": {
|
||||||
|
1000000000: "Beschäftigte(r)",
|
||||||
|
1000000001: "ProfessorIn",
|
||||||
|
1000000002: "Wissenschaftliche(r) MitarbeiterIn",
|
||||||
|
1000000003: "Auszubildende(r)",
|
||||||
|
1000000004: "Lehrkraft für besondere Aufgaben",
|
||||||
|
1000000005: "Lehrbeauftragte(r)",
|
||||||
|
1000000006: "PraktikantIn",
|
||||||
|
1000000007: "Wissenschaftliche Hilfskraft",
|
||||||
|
1000000008: "Studentische Hilfskraft",
|
||||||
|
1000000009: "Lehrkraft",
|
||||||
|
1000000010: "LeiterIn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gender = membership.mPerson.gender
|
||||||
|
business_role = membership.mBusinessRole.id
|
||||||
|
if gender == None:
|
||||||
|
gender = "?"
|
||||||
|
return names[gender][business_role]
|
||||||
|
|
||||||
def addPersonToGraph(sqlP, additionalIdSeq):
|
def addPersonToGraph(sqlP, additionalIdSeq):
|
||||||
"""Add a given HsHPerson to the graph."""
|
"""Add a given HsHPerson to the graph."""
|
||||||
combined_title = ''
|
combined_title = ''
|
||||||
|
@ -219,7 +269,7 @@ def processMembership(membership, additionalIdSeq):
|
||||||
|
|
||||||
rdfM = OboMembership(membershipUri)
|
rdfM = OboMembership(membershipUri)
|
||||||
rdfM = Membership(membershipUri)
|
rdfM = Membership(membershipUri)
|
||||||
rdfM.label = membership.mBusinessRole.name
|
rdfM.label = getBusinessRoleName(membership)
|
||||||
rdfM.person = personUri
|
rdfM.person = personUri
|
||||||
rdfM.organization = organizationUri
|
rdfM.organization = organizationUri
|
||||||
rdfM.dateTimeInterval = dtiUri
|
rdfM.dateTimeInterval = dtiUri
|
||||||
|
|
Loading…
Reference in New Issue