VIVO-542 fixes bug with restriction deletion and various small improvements
This commit is contained in:
parent
d0458047cb
commit
5038451685
7 changed files with 34 additions and 6 deletions
|
@ -57,7 +57,7 @@ public class Classes2ClassesOperationController extends BaseEditController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VClassDao vcDao = request.getUnfilteredAssertionsWebappDaoFactory().getVClassDao();
|
VClassDao vcDao = request.getLanguageNeutralWebappDaoFactory().getVClassDao();
|
||||||
|
|
||||||
String modeStr = request.getParameter("opMode");
|
String modeStr = request.getParameter("opMode");
|
||||||
modeStr = (modeStr == null) ? "" : modeStr;
|
modeStr = (modeStr == null) ? "" : modeStr;
|
||||||
|
|
|
@ -1048,11 +1048,20 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
try {
|
try {
|
||||||
OntResource subclass = getOntClass(ontModel,c2c.getSubclassURI());
|
OntResource subclass = getOntClass(ontModel,c2c.getSubclassURI());
|
||||||
OntResource superclass = getOntClass(ontModel,c2c.getSuperclassURI());
|
OntResource superclass = getOntClass(ontModel,c2c.getSuperclassURI());
|
||||||
|
if(subclass == null || superclass == null) {
|
||||||
|
log.warn("unable to delete " + c2c.getSubclassURI() +
|
||||||
|
" rdfs:subClassOf " + c2c.getSuperclassURI());
|
||||||
|
if (subclass == null) {
|
||||||
|
log.warn(c2c.getSubclassURI() + " not found in the model.");
|
||||||
|
}
|
||||||
|
if (superclass == null) {
|
||||||
|
log.warn(c2c.getSuperclassURI() + " not found in the model.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
Model removal = ModelFactory.createDefaultModel();
|
Model removal = ModelFactory.createDefaultModel();
|
||||||
Model additions = ModelFactory.createDefaultModel(); // to repair any rdf:Lists
|
Model additions = ModelFactory.createDefaultModel(); // to repair any rdf:Lists
|
||||||
if ((subclass != null) && (superclass != null)) {
|
removal.add(ontModel.listStatements(subclass, RDFS.subClassOf, superclass));
|
||||||
removal.add(ontModel.listStatements(subclass, RDFS.subClassOf, superclass));
|
|
||||||
}
|
|
||||||
if (subclass.isAnon()) {
|
if (subclass.isAnon()) {
|
||||||
Model[] changeSet = getSmartRemoval(subclass, getOntModel());
|
Model[] changeSet = getSmartRemoval(subclass, getOntModel());
|
||||||
removal.add(changeSet[0]);
|
removal.add(changeSet[0]);
|
||||||
|
|
|
@ -207,6 +207,14 @@ public class KnowledgeBaseUpdater {
|
||||||
StmtIterator sit = anonModel.listStatements();
|
StmtIterator sit = anonModel.listStatements();
|
||||||
while (sit.hasNext()) {
|
while (sit.hasNext()) {
|
||||||
Statement stmt = sit.nextStatement();
|
Statement stmt = sit.nextStatement();
|
||||||
|
// Skip statements with blank nodes (unsupported) to avoid
|
||||||
|
// excessive deletion. In the future, the whole updater
|
||||||
|
// could be modified to change whole graphs at once through
|
||||||
|
// the RDFService, but right now this whole thing is statement
|
||||||
|
// based.
|
||||||
|
if (stmt.getSubject().isAnon() || stmt.getObject().isAnon()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Iterator<String> graphIt = dataset.listNames();
|
Iterator<String> graphIt = dataset.listNames();
|
||||||
while(graphIt.hasNext()) {
|
while(graphIt.hasNext()) {
|
||||||
String graph = graphIt.next();
|
String graph = graphIt.next();
|
||||||
|
@ -223,8 +231,9 @@ public class KnowledgeBaseUpdater {
|
||||||
//log.info("removed " + anonModel.size() + " statements from SPARQL CONSTRUCTs");
|
//log.info("removed " + anonModel.size() + " statements from SPARQL CONSTRUCTs");
|
||||||
} else {
|
} else {
|
||||||
Model writeModel = dataset.getNamedModel(JenaDataSourceSetupBase.JENA_DB_MODEL);
|
Model writeModel = dataset.getNamedModel(JenaDataSourceSetupBase.JENA_DB_MODEL);
|
||||||
|
Model dedupeModel = dataset.getDefaultModel();
|
||||||
Model additions = jiu.renameBNodes(
|
Model additions = jiu.renameBNodes(
|
||||||
anonModel, settings.getDefaultNamespace() + "n", writeModel);
|
anonModel, settings.getDefaultNamespace() + "n", dedupeModel);
|
||||||
Model actualAdditions = ModelFactory.createDefaultModel();
|
Model actualAdditions = ModelFactory.createDefaultModel();
|
||||||
StmtIterator stmtIt = additions.listStatements();
|
StmtIterator stmtIt = additions.listStatements();
|
||||||
while (stmtIt.hasNext()) {
|
while (stmtIt.hasNext()) {
|
||||||
|
|
|
@ -217,6 +217,9 @@ public abstract class RDFServiceJena extends RDFServiceImpl implements RDFServic
|
||||||
private List<Statement> sort(List<Statement> stmts) {
|
private List<Statement> sort(List<Statement> stmts) {
|
||||||
List<Statement> output = new ArrayList<Statement>();
|
List<Statement> output = new ArrayList<Statement>();
|
||||||
int originalSize = stmts.size();
|
int originalSize = stmts.size();
|
||||||
|
if(originalSize == 1) {
|
||||||
|
return stmts;
|
||||||
|
}
|
||||||
List <Statement> remaining = stmts;
|
List <Statement> remaining = stmts;
|
||||||
ConcurrentLinkedQueue<Resource> subjQueue = new ConcurrentLinkedQueue<Resource>();
|
ConcurrentLinkedQueue<Resource> subjQueue = new ConcurrentLinkedQueue<Resource>();
|
||||||
for(Statement stmt : remaining) {
|
for(Statement stmt : remaining) {
|
||||||
|
|
|
@ -744,6 +744,8 @@ public class RDFServiceSparql extends RDFServiceImpl implements RDFService {
|
||||||
private List<Statement> sort(List<Statement> stmts) {
|
private List<Statement> sort(List<Statement> stmts) {
|
||||||
List<Statement> output = new ArrayList<Statement>();
|
List<Statement> output = new ArrayList<Statement>();
|
||||||
int originalSize = stmts.size();
|
int originalSize = stmts.size();
|
||||||
|
if (originalSize == 1)
|
||||||
|
return stmts;
|
||||||
List <Statement> remaining = stmts;
|
List <Statement> remaining = stmts;
|
||||||
ConcurrentLinkedQueue<com.hp.hpl.jena.rdf.model.Resource> subjQueue =
|
ConcurrentLinkedQueue<com.hp.hpl.jena.rdf.model.Resource> subjQueue =
|
||||||
new ConcurrentLinkedQueue<com.hp.hpl.jena.rdf.model.Resource>();
|
new ConcurrentLinkedQueue<com.hp.hpl.jena.rdf.model.Resource>();
|
||||||
|
|
|
@ -410,6 +410,11 @@ public class ABoxRecomputer {
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
|
|
||||||
|
// skip statements with blank nodes to avoid excessive deletion
|
||||||
|
if (stmt.getSubject().isAnon() || stmt.getObject().isAnon()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
inferenceModel.enterCriticalSection(Lock.WRITE);
|
inferenceModel.enterCriticalSection(Lock.WRITE);
|
||||||
try {
|
try {
|
||||||
inferenceModel.remove(stmt);
|
inferenceModel.remove(stmt);
|
||||||
|
|
|
@ -221,7 +221,7 @@ public class JenaDataSourceSetupBase extends JenaBaseDaoCon {
|
||||||
int[] maxActiveAndIdle = getMaxActiveAndIdle(ctx);
|
int[] maxActiveAndIdle = getMaxActiveAndIdle(ctx);
|
||||||
cpds.setMaxPoolSize(maxActiveAndIdle[0]);
|
cpds.setMaxPoolSize(maxActiveAndIdle[0]);
|
||||||
cpds.setMinPoolSize(maxActiveAndIdle[1]);
|
cpds.setMinPoolSize(maxActiveAndIdle[1]);
|
||||||
cpds.setMaxIdleTime(3600); // ms
|
cpds.setMaxIdleTime(43200); // s
|
||||||
cpds.setMaxIdleTimeExcessConnections(300);
|
cpds.setMaxIdleTimeExcessConnections(300);
|
||||||
cpds.setAcquireIncrement(5);
|
cpds.setAcquireIncrement(5);
|
||||||
cpds.setNumHelperThreads(6);
|
cpds.setNumHelperThreads(6);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue