NIHVIVO-1876 csv tool optimization.

This commit is contained in:
ass92 2011-01-27 21:15:38 +00:00
parent 0f05edf296
commit a7606b079a

View file

@ -81,23 +81,29 @@ public class Csv2Rdf {
for (int i=0; i<columnHeaders.length; i++) {
dpArray[i] = tboxOntModel.createDatatypeProperty(tboxNamespace+propertyNameBase+columnHeaders[i].replaceAll("\\W",""));
}
Individual ind = null;
for (int row=1; row<fileRows.size(); row++) {
while( uriIsGood == false && attempts < 30 ){
uri = namespace+individualNameBase+random.nextInt( Math.min(Integer.MAX_VALUE,(int)Math.pow(2,attempts + 13)) );
errMsg = wdf.checkURI(uri);
Resource res = ResourceFactory.createResource(uri);
inDestination = destination.contains(res, null);
if( errMsg != null && !inDestination)
uri = null;
else
uriIsGood = true;
attempts++;
}
if(namespace!=null && !namespace.isEmpty()){
while( uriIsGood == false && attempts < 30 ){
uri = namespace+individualNameBase+random.nextInt( Math.min(Integer.MAX_VALUE,(int)Math.pow(2,attempts + 13)) );
errMsg = wdf.checkURI(uri);
Resource res = ResourceFactory.createResource(uri);
inDestination = destination.contains(res, null);
if( errMsg != null && !inDestination)
uri = null;
else
uriIsGood = true;
attempts++;
}
}
uriIsGood = false;
attempts =0;
inDestination = false;
Individual ind = ontModel.createIndividual(uri,theClass);
if(uri!=null)
ind = ontModel.createIndividual(uri,theClass);
else
ind = ontModel.createIndividual(theClass);
String[] cols = fileRows.get(row);
for (int col=0; col<cols.length; col++) {
String value = cols[col].trim();