Fix for VIVO-3871 (#393)
* Fallback to default graph in bulk ontology model update * test added --------- Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
This commit is contained in:
parent
f19d0a08c2
commit
a5a7e640d2
5 changed files with 88 additions and 34 deletions
|
@ -10,7 +10,7 @@ public class BulkGraphMem extends GraphMem {
|
|||
performAdd(t);
|
||||
}
|
||||
|
||||
public final void deleteWithoutNotify(Triple t) {
|
||||
public void deleteWithoutNotify(Triple t) {
|
||||
checkOpen();
|
||||
performDelete(t);
|
||||
}
|
||||
|
|
|
@ -7,33 +7,33 @@ import org.apache.jena.rdf.model.Model;
|
|||
|
||||
public class BulkOntModelImpl extends OntModelImpl {
|
||||
|
||||
public BulkOntModelImpl(OntModelSpec spec) {
|
||||
super(spec);
|
||||
}
|
||||
|
||||
public BulkOntModelImpl(OntModelSpec owlMem, Model bareModel) {
|
||||
super(owlMem, bareModel);
|
||||
}
|
||||
public BulkOntModelImpl(OntModelSpec spec) {
|
||||
super(spec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model remove(Model m) {
|
||||
Graph unwrappedGraph = GraphUtils.unwrapUnionGraphs(graph);
|
||||
if (unwrappedGraph instanceof BulkGraphMem) {
|
||||
GraphUtils.deleteFrom((BulkGraphMem) unwrappedGraph, m.getGraph());
|
||||
} else {
|
||||
super.remove(m);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public BulkOntModelImpl(OntModelSpec owlMem, Model bareModel) {
|
||||
super(owlMem, bareModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model add(Model m) {
|
||||
Graph unwrappedGraph = GraphUtils.unwrapUnionGraphs(graph);
|
||||
if (unwrappedGraph instanceof BulkGraphMem) {
|
||||
GraphUtils.addInto((BulkGraphMem) unwrappedGraph, m.getGraph());
|
||||
} else {
|
||||
super.add(m);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Model remove(Model m) {
|
||||
Graph unwrappedGraph = GraphUtils.unwrapUnionGraphs(graph);
|
||||
if (unwrappedGraph instanceof BulkGraphMem) {
|
||||
GraphUtils.deleteFrom((BulkGraphMem) unwrappedGraph, m.getGraph());
|
||||
} else {
|
||||
super.remove(m);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model add(Model m) {
|
||||
Graph unwrappedGraph = GraphUtils.unwrapUnionGraphs(graph);
|
||||
if (unwrappedGraph instanceof BulkGraphMem) {
|
||||
GraphUtils.addInto((BulkGraphMem) unwrappedGraph, m.getGraph());
|
||||
} else {
|
||||
super.add(m);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,7 @@ final public class GraphUtils {
|
|||
|
||||
public static Graph unwrapUnionGraphs(Graph graph) {
|
||||
if (graph != null && graph instanceof MultiUnion) {
|
||||
List<Graph> subGraphs = ((MultiUnion) graph).getSubGraphs();
|
||||
if (subGraphs == null || subGraphs.isEmpty()) {
|
||||
return ((MultiUnion) graph).getBaseGraph();
|
||||
}
|
||||
return unwrapUnionGraphs(((MultiUnion)graph).getBaseGraph());
|
||||
}
|
||||
return graph;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue