Revision 41147
Added by Eri Katsari over 8 years ago
Serializer.java | ||
---|---|---|
234 | 234 |
|
235 | 235 |
} |
236 | 236 |
|
237 |
public static boolean isNumeric(String str) { |
|
238 |
|
|
239 |
str = str.replaceAll("[^A-Za-z0-9 ]", ""); |
|
240 |
str = str.replaceAll(" ", ""); |
|
241 |
return str.matches("-?\\d+(\\.\\d+)?"); // match a number with optional |
|
242 |
// '-' and decimal. |
|
243 |
} |
|
244 |
|
|
245 | 237 |
private HashMap<String, List<String>> getResultTopics(OafEntity valueEntity) { |
246 | 238 |
HashMap<String, List<String>> rels = new HashMap<String, List<String>>(); |
247 | 239 |
List<String> buffs = new ArrayList<String>(); |
... | ... | |
388 | 380 |
String oid = new String(); |
389 | 381 |
|
390 | 382 |
for (String ids : data.getOriginalIdList()) { |
391 |
oid += ids.replace(DELIM,"").replace(ENCLOSED,"")+ ";"; |
|
383 |
oid += ids.replace(DELIM,"").replace(ENCLOSED,"").replace("\n","")+ ";";
|
|
392 | 384 |
|
393 | 385 |
} |
394 |
buff += ENCLOSED + oid + ENCLOSED + DELIM;
|
|
386 |
buff += clean(oid) + DELIM;
|
|
395 | 387 |
|
396 | 388 |
//TODO dois in results |
397 | 389 |
|
... | ... | |
399 | 391 |
|
400 | 392 |
for (StructuredProperty p : data.getPidList()) { |
401 | 393 |
if (p.getQualifier().getClassid().contains("doi")) { |
402 |
doi = p.getValue().replace(DELIM,"").replace(ENCLOSED,""); |
|
394 |
doi = p.getValue().replace(DELIM,"").replace(ENCLOSED,"").replace("\n","");
|
|
403 | 395 |
break; |
404 | 396 |
} |
405 | 397 |
} |
... | ... | |
407 | 399 |
|
408 | 400 |
if (doi.isEmpty()) { |
409 | 401 |
for (StructuredProperty p : data.getPidList()) { |
410 |
doi = p.getValue().replace(DELIM,"").replace(ENCLOSED,""); |
|
402 |
doi = p.getValue().replace(DELIM,"").replace(ENCLOSED,"").replace("\n","");
|
|
411 | 403 |
break; |
412 | 404 |
} |
413 | 405 |
} |
414 | 406 |
|
415 |
buff += ENCLOSED + doi + ENCLOSED + DELIM;
|
|
407 |
buff += clean(doi) + DELIM;
|
|
416 | 408 |
|
417 |
// pubtitle
|
|
409 |
// pubtitle
|
|
418 | 410 |
|
419 | 411 |
String titleString = new String(); |
420 | 412 |
String alternativeTitles = new String(); |
... | ... | |
561 | 553 |
oid += ids + ";"; |
562 | 554 |
|
563 | 555 |
} |
564 |
buff += ENCLOSED + oid + ENCLOSED + DELIM;
|
|
556 |
buff += clean(oid) + DELIM;
|
|
565 | 557 |
|
566 | 558 |
// `acronym`, |
567 | 559 |
String acronym = metadata.getAcronym().getValue(); |
... | ... | |
829 | 821 |
value = value.replaceAll(DELIM, ""); |
830 | 822 |
value = value.replaceAll(ENCLOSED, ""); |
831 | 823 |
value = value.replaceAll("\\r\\n|\\r|\\n", " "); |
832 |
|
|
824 |
value = value.replace("\\n", ""); |
|
833 | 825 |
value = value.replaceAll("\\s+", " "); |
834 | 826 |
value = value.replaceAll("(\\r|\\n)", " "); |
835 | 827 |
value = value.replaceAll("\\t", " "); |
Also available in: Unified diff