}
}
for (int row = 0; row < table.getRowCount(); row++) {
String uri = uriType + ":" + row;
Resource resource = new Resource(uri);
for (int column = 0; column < table.getColumnCount(); column++) {
String stringValue = table.getValue(row, column);
/*
* TODO should not be parsed at this point - change once setting
* property types possible
*/
Serializable value;
switch (columnTypes[column]) {
case NUMBER:
if (!NUMBER_DETECTION_REGEX.test(stringValue)) {
throw new ParseException("Invalid number", stringValue,
row + 1);
}
value = new Double(stringValue);
break;
case DATE:
if (DATE_FORMAT_1_REGEX.test(stringValue)) {
value = parseDate1(stringValue);
} else if (DATE_FORMAT_2_REGEX.test(stringValue)) {
value = parseDate2(stringValue);
} else {
throw new ParseException("Invalid date", stringValue,
row + 1);
}
break;
case LOCATION:
if (!LOCATION_DETECTION_REGEX.test(stringValue)) {
throw new ParseException("Invalid location",
stringValue, row + 1);
}
Resource locationResource = new Resource();
String[] split = stringValue.split("\\/");
locationResource.putValue(ResourceSetUtils.LATITUDE,
Double.parseDouble(split[0]));
locationResource.putValue(ResourceSetUtils.LONGITUDE,
Double.parseDouble(split[1]));
value = locationResource;
break;
default:
value = stringValue;