NIHVIVO-2108 code correction for nullpointer exception in naming blank nodes method.
This commit is contained in:
parent
a837d62ae8
commit
9b13425258
1 changed files with 35 additions and 33 deletions
|
@ -762,48 +762,50 @@ public class JenaIngestController extends BaseEditController {
|
|||
else{
|
||||
destination.add(utils.renameBNodesByPattern(source, namespaceEtc, vreq.getJenaOntModel(), pattern, property));
|
||||
}
|
||||
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()) {
|
||||
ClosableIterator closfIt = destination.listStatements(res,prop,(RDFNode)null);
|
||||
Statement stmt = null;
|
||||
try {
|
||||
if (closfIt.hasNext()) {
|
||||
stmt = (Statement) closfIt.next();
|
||||
if(csv2rdf!=null){
|
||||
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()) {
|
||||
ClosableIterator closfIt = destination.listStatements(res,prop,(RDFNode)null);
|
||||
Statement stmt = null;
|
||||
try {
|
||||
if (closfIt.hasNext()) {
|
||||
stmt = (Statement) closfIt.next();
|
||||
}
|
||||
} finally {
|
||||
closfIt.close();
|
||||
}
|
||||
if (stmt != null) {
|
||||
Resource outRes = stmt.getSubject();
|
||||
destination.removeAll(outRes,(Property)null,(RDFNode)null);
|
||||
}
|
||||
} finally {
|
||||
closfIt.close();
|
||||
}
|
||||
if (stmt != null) {
|
||||
Resource outRes = stmt.getSubject();
|
||||
destination.removeAll(outRes,(Property)null,(RDFNode)null);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
closeIt.close();
|
||||
}
|
||||
} finally {
|
||||
closeIt.close();
|
||||
csv2rdf = false;
|
||||
getServletContext().setAttribute("csv2rdf", csv2rdf);
|
||||
}
|
||||
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()) {
|
||||
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();
|
||||
}
|
||||
} finally {
|
||||
closeIt.close();
|
||||
csv2rdf = false;
|
||||
getServletContext().setAttribute("csv2rdf", csv2rdf);
|
||||
}
|
||||
csv2rdf = false;
|
||||
getServletContext().setAttribute("csv2rdf", csv2rdf);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue