@@ -181,14 +181,14 @@ def process_vocabulary_reference_by_value(self, node):
181
181
entity_type = None
182
182
for sibling in parent :
183
183
if sibling .attrib ['name' ] == 'RelationEntityType' :
184
- entity_type = sibling .text
184
+ entity_type = sibling .text . lower ()
185
185
break
186
186
187
- entity_type_in_relation_count = vocabulary_name .count (entity_type )
187
+ entity_type_in_relation_count = vocabulary_name .lower (). count (entity_type )
188
188
if entity_type_in_relation_count == 1 :
189
189
# Find out relation direction
190
190
separator_position = vocabulary_name .index ('-' )
191
- entity_type_position = vocabulary_name .index (entity_type )
191
+ entity_type_position = vocabulary_name .lower (). index (entity_type )
192
192
193
193
# use second column of vocabulary: `Reverse relationship` (The relation vocabulary is specified from `A->B`, the relation references an entity of type `A` and is therefore of type `B`)
194
194
if entity_type_position < separator_position :
@@ -197,9 +197,11 @@ def process_vocabulary_reference_by_value(self, node):
197
197
else :
198
198
search_field = 'Relationship type'
199
199
inverse_search_field = 'Reverse relationship'
200
- else :
200
+ elif entity_type_in_relation_count == 2 :
201
201
search_field = 'Relationship type'
202
202
inverse_search_field = 'Reverse relationship'
203
+ else :
204
+ raise Exception (f'Unable to perform relation column logic on relation [{ vocabulary_name } ] with search entity: { entity_type } ' )
203
205
204
206
try :
205
207
# First, try to find the value in the correct column
@@ -227,7 +229,7 @@ def process_vocabulary_reference_by_value(self, node):
227
229
new_value = self .ctx .extract_preferred_language (translated_main_values )
228
230
229
231
#dump_node(node)
230
- logging .warn (f'Relation is saved in the wrong direction, correct direction found and corrected: "{ old_value } " -> "{ new_value } "' )
232
+ logging .warn (f'Relation [ { vocabulary_name } ] is saved in the wrong direction, correct direction found and corrected: "{ old_value } " -> "{ new_value } "' )
231
233
node .text = new_value
232
234
233
235
else :
0 commit comments