Skip to content

Commit fe084c9

Browse files
committed
apacheGH-3237: jena-ontapi - use default memory graph
1 parent 678cf4a commit fe084c9

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

jena-ontapi/src/main/java/org/apache/jena/ontapi/OntModelFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static void init() {
7878
* @return {@code Graph}
7979
*/
8080
public static Graph createDefaultGraph() {
81-
return GraphMemFactory.createGraphMem();
81+
return GraphMemFactory.createDefaultGraph();
8282
}
8383

8484
/**

jena-ontapi/src/main/java/org/apache/jena/ontapi/impl/OntGraphModelImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@ public ValidityReport validate() {
17631763
public StmtIterator listStatements(Resource subject, Property predicate, RDFNode object, Model posit) {
17641764
InfGraph graph = getInfGraph();
17651765
if (graph != null) {
1766-
Graph gp = posit == null ? GraphMemFactory.createGraphMem() : posit.getGraph();
1766+
Graph gp = posit == null ? GraphMemFactory.createDefaultGraph() : posit.getGraph();
17671767
Iterator<Triple> iter = graph.find(asNode(subject), asNode(predicate), asNode(object), gp);
17681768
return IteratorFactory.asStmtIterator(iter, this);
17691769
} else {

jena-ontapi/src/test/java/org/apache/jena/ontapi/GraphUtilsTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected ExtendedIterator<Triple> graphBaseFind(Triple tp) {
117117

118118
@Test
119119
public void testIsSame() {
120-
Graph g = GraphMemFactory.createGraphMem();
120+
Graph g = GraphMemFactory.createDefaultGraph();
121121
Assertions.assertTrue(Graphs.isSameBase(g, g));
122122

123123
Graph a = new UnionGraphImpl(g);
@@ -134,7 +134,8 @@ public void testIsSame() {
134134
UnionGraph c2 = new UnionGraphImpl(new WrappedGraph(g));
135135
Assertions.assertTrue(Graphs.isSameBase(a, c2));
136136

137-
Assertions.assertFalse(Graphs.isSameBase(g, new GraphMem()));
137+
Graph g2 = GraphMemFactory.createDefaultGraph();
138+
Assertions.assertFalse(Graphs.isSameBase(g, g2));
138139

139140
Graph d = new UnionGraphImpl(new WrappedGraph(new WrappedGraph(g)));
140141
Assertions.assertTrue(Graphs.isSameBase(a, d));

jena-ontapi/src/test/java/org/apache/jena/ontapi/OntListTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public void testListSpec() {
336336
@Test
337337
public void testTypedList() {
338338
OntGraphModelImpl m = new OntGraphModelImpl(
339-
OntModelFactory.createUnionGraph(GraphMemFactory.createGraphMem()),
339+
OntModelFactory.createUnionGraph(GraphMemFactory.createDefaultGraph()),
340340
OntSpecification.OWL2_DL_MEM_BUILTIN_RDFS_INF.getPersonality()
341341
);
342342
m.setNsPrefixes(OntModelFactory.STANDARD);

jena-ontapi/src/test/java/org/apache/jena/ontapi/OntPersonalityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void testPersonalityReserved() {
153153
@Test
154154
public void testPersonalityPunnings() {
155155
String ns = "http://x#";
156-
OntModel m1 = OntModelFactory.createModel(GraphMemFactory.createGraphMem(), TestOntPersonalities.OWL2_PERSONALITY_STRICT_PUNNS)
156+
OntModel m1 = OntModelFactory.createModel(GraphMemFactory.createDefaultGraph(), TestOntPersonalities.OWL2_PERSONALITY_STRICT_PUNNS)
157157
.setNsPrefixes(OntModelFactory.STANDARD)
158158
.setNsPrefix("x", ns);
159159
OntClass.Named c1 = m1.createOntClass(ns + "C1");

jena-ontapi/src/test/java/org/apache/jena/ontapi/UnionGraphTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ public void testWrapAsUnmodified() {
159159

160160
@Test
161161
public void testCloseRecursiveGraph() {
162-
UnionGraph a = new UnionGraphImpl(GraphMemFactory.createGraphMem());
163-
UnionGraph b = new UnionGraphImpl(GraphMemFactory.createGraphMem());
164-
UnionGraph c = new UnionGraphImpl(GraphMemFactory.createGraphMem());
165-
UnionGraph d = new UnionGraphImpl(GraphMemFactory.createGraphMem());
166-
UnionGraph e = new UnionGraphImpl(GraphMemFactory.createGraphMem());
162+
UnionGraph a = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
163+
UnionGraph b = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
164+
UnionGraph c = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
165+
UnionGraph d = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
166+
UnionGraph e = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
167167
assertClosed(a, false);
168168
assertClosed(b, false);
169169
assertClosed(c, false);
@@ -185,9 +185,9 @@ public void testCloseRecursiveGraph() {
185185

186186
@Test
187187
public void testCloseHierarchyGraph() {
188-
UnionGraphImpl a = new UnionGraphImpl(GraphMemFactory.createGraphMem());
189-
UnionGraphImpl b = new UnionGraphImpl(GraphMemFactory.createGraphMem());
190-
UnionGraphImpl c = new UnionGraphImpl(GraphMemFactory.createGraphMem());
188+
UnionGraphImpl a = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
189+
UnionGraphImpl b = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
190+
UnionGraphImpl c = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
191191
assertClosed(a, false);
192192
assertClosed(b, false);
193193
assertClosed(c, false);
@@ -199,7 +199,7 @@ public void testCloseHierarchyGraph() {
199199
assertClosed(c, true);
200200
assertClosed(a, false);
201201

202-
UnionGraphImpl d = new UnionGraphImpl(GraphMemFactory.createGraphMem());
202+
UnionGraphImpl d = new UnionGraphImpl(GraphMemFactory.createDefaultGraph());
203203
try {
204204
b.addSubGraph(d);
205205
Assertions.fail("Possible to add a sub-graph");

0 commit comments

Comments
 (0)