copying changes to trunk for NIHVIVO-322 'Statements added by SPARQL CONSTRUCTs in the ontology updater are not recorded in the log or added statements file'
This commit is contained in:
parent
a2da8aedde
commit
66e555b0bf
1 changed files with 16 additions and 2 deletions
|
@ -30,6 +30,8 @@ import com.hp.hpl.jena.rdf.model.ModelFactory;
|
|||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.jena.JenaIngestUtils;
|
||||
|
@ -159,8 +161,20 @@ public class OntologyUpdater {
|
|||
aboxModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
JenaIngestUtils jiu = new JenaIngestUtils();
|
||||
aboxModel.add(jiu.renameBNodes(anonModel, settings.getDefaultNamespace() + "n",
|
||||
aboxModel));
|
||||
Model additions = jiu.renameBNodes(anonModel, settings.getDefaultNamespace() + "n",
|
||||
aboxModel);
|
||||
Model actualAdditions = ModelFactory.createDefaultModel();
|
||||
StmtIterator stmtIt = additions.listStatements();
|
||||
while (stmtIt.hasNext()) {
|
||||
Statement stmt = stmtIt.nextStatement();
|
||||
if (!aboxModel.contains(stmt)) {
|
||||
actualAdditions.add(stmt);
|
||||
}
|
||||
}
|
||||
aboxModel.add(actualAdditions);
|
||||
logger.log("Constructed " + actualAdditions.size() + " new " +
|
||||
"statements using SPARQL CONSTRUCT queries.");
|
||||
record.recordAdditions(actualAdditions);
|
||||
} finally {
|
||||
aboxModel.leaveCriticalSection();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue