NIHVIVO-1876 csv tool optimization.
This commit is contained in:
parent
0f05edf296
commit
a7606b079a
1 changed files with 19 additions and 13 deletions
|
@ -81,23 +81,29 @@ public class Csv2Rdf {
|
||||||
for (int i=0; i<columnHeaders.length; i++) {
|
for (int i=0; i<columnHeaders.length; i++) {
|
||||||
dpArray[i] = tboxOntModel.createDatatypeProperty(tboxNamespace+propertyNameBase+columnHeaders[i].replaceAll("\\W",""));
|
dpArray[i] = tboxOntModel.createDatatypeProperty(tboxNamespace+propertyNameBase+columnHeaders[i].replaceAll("\\W",""));
|
||||||
}
|
}
|
||||||
|
Individual ind = null;
|
||||||
for (int row=1; row<fileRows.size(); row++) {
|
for (int row=1; row<fileRows.size(); row++) {
|
||||||
while( uriIsGood == false && attempts < 30 ){
|
if(namespace!=null && !namespace.isEmpty()){
|
||||||
uri = namespace+individualNameBase+random.nextInt( Math.min(Integer.MAX_VALUE,(int)Math.pow(2,attempts + 13)) );
|
while( uriIsGood == false && attempts < 30 ){
|
||||||
errMsg = wdf.checkURI(uri);
|
uri = namespace+individualNameBase+random.nextInt( Math.min(Integer.MAX_VALUE,(int)Math.pow(2,attempts + 13)) );
|
||||||
Resource res = ResourceFactory.createResource(uri);
|
errMsg = wdf.checkURI(uri);
|
||||||
inDestination = destination.contains(res, null);
|
Resource res = ResourceFactory.createResource(uri);
|
||||||
if( errMsg != null && !inDestination)
|
inDestination = destination.contains(res, null);
|
||||||
uri = null;
|
if( errMsg != null && !inDestination)
|
||||||
else
|
uri = null;
|
||||||
uriIsGood = true;
|
else
|
||||||
attempts++;
|
uriIsGood = true;
|
||||||
}
|
attempts++;
|
||||||
|
}
|
||||||
|
}
|
||||||
uriIsGood = false;
|
uriIsGood = false;
|
||||||
attempts =0;
|
attempts =0;
|
||||||
inDestination = false;
|
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);
|
String[] cols = fileRows.get(row);
|
||||||
for (int col=0; col<cols.length; col++) {
|
for (int col=0; col<cols.length; col++) {
|
||||||
String value = cols[col].trim();
|
String value = cols[col].trim();
|
||||||
|
|
Loading…
Add table
Reference in a new issue