Skip to content
Snippets Groups Projects
Commit d2f35a88 authored by Philipp Schneider's avatar Philipp Schneider
Browse files

Restructure if-clauses to add annotators to description events

parent ed41971b
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,8 @@ def add_data_to_description_event(description_event_node, coa_node, row, person_
if bool(row['BannerItem']) == False and bool(row['PersonItem']) == False:
g.add((description_event_node, dho_rep_n.coatOfArmsPresentedAs, dho_rep_n.Shield))
g.add((description_event_node, dho_rep_n.hasOMABranchID, Literal(str(row['BranchIDR']), datatype=XSD.string)))
g.add((description_event_node, dho_rep_n.textHasTranscription, Literal(str(row['ArmTxt']))))
g.add((description_event_node, DCTERMS.creator, person_uri))
......@@ -58,8 +60,6 @@ def create_identified_entity(row):
g.add((new_entity_node, dho_ent_n.hasAppellation, Literal(row['ArmIdf'], datatype=XSD.string)))
print(new_entity_node)
return new_entity_node
else:
return None
......@@ -105,7 +105,7 @@ for index, row in df_tblArmItems.iterrows():
g.add((coa_reference_node, RDF.type, dho_rep_n.CoatOfArmsRepresentation))
g.add((coa_reference_node, RDF.type, OWL.NamedIndividual))
g.add((coa_reference_node, dho_rep_n.hasOMAid, Literal(str(int(row['ArmItemID'])), datatype=XSD.string)))
g.add((coa_reference_node, dho_rep_n.hasOMAArmItem, Literal(str(int(row['ArmItemID'])), datatype=XSD.string)))
if not pd.isnull(row['ItemNr']):
g.add((coa_reference_node, dho_rep_n.hasItemID, Literal(int(row['ItemNr']))))
......@@ -122,36 +122,39 @@ for index, row in df_tblArmItems.iterrows():
coa_id = str(row['BranchIDR'])
coa_node = functions.construct_new_coa_uri(coa_id)
if row['descriptor_id'] == int(1):
person_uri = URIRef(dho_data_n + 'Steen-Clemmensen')
add_data_to_description_event(description_event_node, coa_node, row, person_uri)
if row['checked_for_publication'] == True and ( row['descriptor_id'] == int(2) or pd.isnull(row['descriptor_id']) ):
person_uri = URIRef(dho_data_n + 'Philipp-Schneider')
if (coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, None) not in g:
primary_person_uri = URIRef(dho_data_n + 'Philipp-Schneider')
# Create new primary node
primary_description_event_node = URIRef(dho_rep_n + str(uuid.uuid4()))
g.add((primary_description_event_node, RDF.type, dho_rep_n.CoADescriptionAct))
g.add((primary_description_event_node, RDF.type, OWL.NamedIndividual))
g.add((coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, primary_description_event_node))
g.add((coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, description_event_node))
g.add((coa_reference_node, dho_rep_n.hasPrimaryBlazon, coa_node))
add_data_to_description_event(primary_description_event_node, coa_node, row, primary_person_uri)
elif row['descriptor_id'] == int(2) or pd.isnull(row['descriptor_id']):
person_uri = URIRef(dho_data_n + 'Philipp-Schneider')
g.add((coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, description_event_node))
g.add((coa_reference_node, dho_rep_n.hasPrimaryBlazon, coa_node))
add_data_to_description_event(description_event_node, coa_node, row, person_uri)
elif row['descriptor_id'] == int(1) or pd.isnull(row['descriptor_id']):
person_uri = URIRef(dho_data_n + 'Steen-Clemmensen')
add_data_to_description_event(description_event_node, coa_node, row, person_uri)
if (coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, None) not in g:
if row['checked_for_publication'] == True:
primary_person_uri = URIRef(dho_data_n + 'Philipp-Schneider')
# Create new primary node
primary_description_event_node = URIRef(dho_rep_n + str(uuid.uuid4()))
g.add((primary_description_event_node, RDF.type, dho_rep_n.CoADescriptionAct))
g.add((primary_description_event_node, RDF.type, OWL.NamedIndividual))
g.add((coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, primary_description_event_node))
g.add((coa_reference_node, dho_rep_n.hasPrimaryBlazon, coa_node))
add_data_to_description_event(primary_description_event_node, coa_node, row, primary_person_uri)
else:
g.add((coa_reference_node, dho_rep_n.hasPrimaryDescriptionAct, description_event_node))
g.add((coa_reference_node, dho_rep_n.hasPrimaryBlazon, coa_node))
# elif pd.isnull(row['descriptor_id']):
# person_uri = URIRef(dho_data_n + 'Philipp-Schneider')
if not pd.isnull(row['description_time']):
if not pd.isnull(row['description_time']) and row['descriptor_id'] != int(1):
g.add((description_event_node, DCTERMS.date, Literal(str(row['description_time']), datatype=XSD.date)))
# Add textual transcription from source
......@@ -177,7 +180,9 @@ for index, row in df_tblArmItems.iterrows():
# Add user comment by Steen Clemmensen
if not pd.isnull(row['AiCmnt']):
g.add((identification_event_node, dho_ent_n.hasAnnotatorComment, Literal(row['AiCmnt'], datatype=XSD.string)))
user_comment = row['AiCmnt']
user_comment = user_comment.replace('\n', ' ')
g.add((identification_event_node, dho_ent_n.hasAnnotatorComment, Literal(user_comment, datatype=XSD.string)))
# VORGEHEN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment