current = null; //indicates we need to create a new Representation
currentMappings = mapping.subMappings; //and use the sub mappings
}
switch (propertyId) {
case N:
N n = (N)property;
String given = n.getGivenName();
String family = n.getFamilyName();
if((given == null || given.isEmpty()) && (family == null
|| family.isEmpty())){
log.warn("'N' property '{}'does not define given nor family name -> ignored",
n.getValue());
} else {
if(current == null){ //create new Representation
current = createSubRepresentation(rep, ".name",
representations.keySet(), mapping);
representations.put(current.getId(), current);
}
Mapping subPropertyMapping = currentMappings.get(N_GIVEN);
if(subPropertyMapping != null && given != null && !given.isEmpty()){
current.addNaturalText(subPropertyMapping.uri, StringUtils.chomp(given).trim());
}
subPropertyMapping = currentMappings.get(N_FAMILY);
if(subPropertyMapping != null & family != null && !family.isEmpty()){
current.addNaturalText(subPropertyMapping.uri, StringUtils.chomp(family).trim());
}
String[] additional = n.getAdditionalNames();
subPropertyMapping = currentMappings.get(N_ADDITIONAL);
if(subPropertyMapping != null & additional != null && additional.length>0){
for(String value : additional){
if(value != null && !value.isEmpty()){
current.addNaturalText(subPropertyMapping.uri, StringUtils.chomp(value).trim());
}
}
}
String[] prefixes = n.getPrefixes();
subPropertyMapping = currentMappings.get(N_PREFIX);
if(subPropertyMapping != null & prefixes != null && prefixes.length>0){
for(String value : prefixes){
if(value != null && !value.isEmpty()){
current.addNaturalText(subPropertyMapping.uri, StringUtils.chomp(value).trim());
}
}
}
String[] suffixes = n.getSuffixes();
subPropertyMapping = currentMappings.get(N_SUFFIX);
if(subPropertyMapping != null & suffixes != null && suffixes.length>0){
for(String value : suffixes){
if(value != null && !value.isEmpty()){
current.addNaturalText(subPropertyMapping.uri, StringUtils.chomp(value).trim());