NIHVIVO-1876 csv tool optimization.
This commit is contained in:
parent
c01dc9bf65
commit
0f05edf296
1 changed files with 16 additions and 2 deletions
|
@ -756,14 +756,13 @@ public class JenaIngestController extends BaseEditController {
|
|||
else{
|
||||
destination.add(utils.renameBNodesByPattern(source, namespaceEtc, vreq.getJenaOntModel(), pattern, property));
|
||||
}
|
||||
if(csv2rdf){
|
||||
if(csv2rdf && property!=null){
|
||||
ClosableIterator closeIt = destination.listSubjects();
|
||||
Property prop = ResourceFactory.createProperty(property);
|
||||
try {
|
||||
for (Iterator it = closeIt; it.hasNext();) {
|
||||
Resource res = (Resource) it.next();
|
||||
if (res.isAnon()) {
|
||||
// now we do something hacky to get the same resource in the outModel, since there's no getResourceById();
|
||||
ClosableIterator closfIt = destination.listStatements(res,prop,(RDFNode)null);
|
||||
Statement stmt = null;
|
||||
try {
|
||||
|
@ -785,6 +784,21 @@ public class JenaIngestController extends BaseEditController {
|
|||
csv2rdf = false;
|
||||
getServletContext().setAttribute("csv2rdf", csv2rdf);
|
||||
}
|
||||
else if(csv2rdf && property == null){
|
||||
ClosableIterator closeIt = destination.listSubjects();
|
||||
try {
|
||||
for (Iterator it = closeIt; it.hasNext();) {
|
||||
Resource res = (Resource) it.next();
|
||||
if (res.isAnon()) {
|
||||
destination.removeAll(res,(Property)null,(RDFNode)null);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
closeIt.close();
|
||||
}
|
||||
csv2rdf = false;
|
||||
getServletContext().setAttribute("csv2rdf", csv2rdf);
|
||||
}
|
||||
|
||||
} finally {
|
||||
destination.leaveCriticalSection();
|
||||
|
|
Loading…
Add table
Reference in a new issue