comparison src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java @ 112:59f26a5ef2b3

AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
author casties
date Tue, 13 Dec 2016 19:04:45 +0100
parents 22a18bfc66b0
children 4aa8c425685d
comparison
equal deleted inserted replaced
111:22a18bfc66b0 112:59f26a5ef2b3
70 70
71 // WITENSS -> was_copied_by -> PERSON 71 // WITENSS -> was_copied_by -> PERSON
72 private ListenerObject copyistLo = new ListenerObject(PERSON, name_translit); 72 private ListenerObject copyistLo = new ListenerObject(PERSON, name_translit);
73 73
74 // WITENSS -> was_copied_at -> PLACE 74 // WITENSS -> was_copied_at -> PLACE
75 private ListenerObject copyPlaceLo = new AliasListenerObject(PLACE, name, "is_alias_name_of"); 75 private AliasListenerObject copyPlaceLo = new AliasListenerObject(PLACE, name, "is_alias_name_of");
76 76
77 // WITNESS -> xx -> PERSON 77 // WITNESS -> xx -> PERSON
78 private ListenerObject patronageLo = new ListenerObject(PERSON, name_translit); 78 private ListenerObject patronageLo = new ListenerObject(PERSON, name_translit);
79 79
80 //private List<SelectItem> citiesWithRepositories; 80 //private List<SelectItem> citiesWithRepositories;
209 209
210 // WITENSS -> was_copied_by -> PERSON 210 // WITENSS -> was_copied_by -> PERSON
211 this.entity.replaceSourceRelation(this.copyistLo.entity, PERSON, rel_was_copied_by); 211 this.entity.replaceSourceRelation(this.copyistLo.entity, PERSON, rel_was_copied_by);
212 212
213 // WITNESS -> was_copied_in -> PLACE 213 // WITNESS -> was_copied_in -> PLACE
214 Entity copyPlace = this.copyPlaceLo.entity; 214 replaceAliasSourceRelation(this.entity, this.copyPlaceLo, PLACE, "was_copied_in", "was_copied_in_as");
215 if (copyPlace != null && copyPlace.getObjectClass().equals(PLACE)) {
216 // regular PLACE
217 this.entity.replaceSourceRelation(copyPlace, PLACE, "was_copied_in");
218 } else if (copyPlace != null && copyPlace.getObjectClass().equals("ALIAS")) {
219 // WITNESS -> was_copied_in_as -> ALIAS
220 this.entity.replaceSourceRelation(copyPlace, "ALIAS", "was_copied_in_as");
221 // ALIAS -> is_alias_name_of -> PLACE
222 List<Entity> places = getWrapper().getTargetsForSourceRelation(copyPlace, "is_alias_name_of", "PLACE", 1);
223 if (! places.isEmpty()) {
224 // WITNESS -> was_copied_in -> PLACE
225 this.entity.replaceSourceRelation(places.get(0), PLACE, "was_copied_in");
226 }
227 }
228 215
229 //REFERENCE -> is_reference_of -> WITNESS 216 //REFERENCE -> is_reference_of -> WITNESS
230 //this.entity = this.prepareReferencesToSave(this.entity); 217 //this.entity = this.prepareReferencesToSave(this.entity);
231 this.prepareEndNoteRefs2Save(); 218 this.prepareEndNoteRefs2Save();
232 219
233 //WITNESS -> was studied by manyToMany -> PERSON 220 //WITNESS -> was studied by manyToMany -> PERSON
234 this.entity.removeAllSourceRelationsByName(rel_was_studied_by); 221 this.entity.removeAllSourceRelationsByName(rel_was_studied_by);
235 for(Entity target : this.studiedByList.getEntities()){ 222 for(Entity target : this.studiedByList.getEntities()){
236 Entity target0 = getWrapper().getEntityByIdWithContent(target.getId()); 223 Entity target0 = getWrapper().getEntityByIdWithContent(target.getId());
237 Relation wasStudiedBy = new Relation(this.entity, target0, rel_was_studied_by); 224 new Relation(this.entity, target0, rel_was_studied_by);
238 } 225 }
239 226
240 // WITNESS -> had_patron -> PERSON 227 // WITNESS -> had_patron -> PERSON
241 this.entity.replaceSourceRelation(this.patronageLo.entity, PERSON, rel_had_patron); 228 this.entity.replaceSourceRelation(this.patronageLo.entity, PERSON, rel_had_patron);
242 229
249 this.entity.removeAllSourceRelations(rel_has_author_written_as, ALIAS); 236 this.entity.removeAllSourceRelations(rel_has_author_written_as, ALIAS);
250 237
251 if(textUnknown){ 238 if(textUnknown){
252 for(Entity target : this.possibleExamplerOfList.getEntities()){ 239 for(Entity target : this.possibleExamplerOfList.getEntities()){
253 Entity target0 = getWrapper().getEntityByIdWithContent(target.getId()); 240 Entity target0 = getWrapper().getEntityByIdWithContent(target.getId());
254 Relation tmp = new Relation(this.entity, target0, is_possible_exemplar_of); 241 new Relation(this.entity, target0, is_possible_exemplar_of);
255 } 242 }
256 }else{ 243 }else{
257 this.saveIndirectedAliases(); 244 this.saveIndirectedAliases();
258 } 245 }
259 246
484 copyistLo.setEntityAndAttribute(target); 471 copyistLo.setEntityAndAttribute(target);
485 } else if (rel.getOwnValue().equals("was_copied_in")) { 472 } else if (rel.getOwnValue().equals("was_copied_in")) {
486 // WITENSS -> was_copied_in -> PLACE 473 // WITENSS -> was_copied_in -> PLACE
487 target = getTargetRelation(rel); 474 target = getTargetRelation(rel);
488 // don't use place if there is an alias 475 // don't use place if there is an alias
489 if (copyPlaceLo.getEntity().getObjectClass() == null) { 476 copyPlaceLo.setEntityAndAttributeIfEmpty(target);
490 copyPlaceLo.setEntityAndAttribute(target);
491 }
492 } else if (rel.getOwnValue().equals("was_copied_in_as")) { 477 } else if (rel.getOwnValue().equals("was_copied_in_as")) {
493 // WITENSS -> was_copied_in_as -> ALIAS 478 // WITENSS -> was_copied_in_as -> ALIAS
494 target = getTargetRelation(rel); 479 target = getTargetRelation(rel);
495 copyPlaceLo.setEntityAndAttribute(target); 480 copyPlaceLo.setEntityAndAttribute(target);
496 } else if (rel.getOwnValue().equals(rel_had_patron)) { 481 } else if (rel.getOwnValue().equals(rel_had_patron)) {
1006 991
1007 public ListenerObject getCopyPlaceLo() { 992 public ListenerObject getCopyPlaceLo() {
1008 return copyPlaceLo; 993 return copyPlaceLo;
1009 } 994 }
1010 995
1011 public void setCopyPlaceLo(ListenerObject copyPlaceLo) { 996 public void setCopyPlaceLo(AliasListenerObject copyPlaceLo) {
1012 this.copyPlaceLo = copyPlaceLo; 997 this.copyPlaceLo = copyPlaceLo;
1013 } 998 }
1014 999
1015 public ListenerObject getPatronageLo() { 1000 public ListenerObject getPatronageLo() {
1016 return patronageLo; 1001 return patronageLo;