You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2025/05/23 15:24:44 UTC
(jena) 04/05: GH-3196: Deprecation removal of Graph.dependsOn
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 11e2615157ad5e6b8e204d7131ae033661d1bc58
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Wed May 14 20:37:28 2025 +0100
GH-3196: Deprecation removal of Graph.dependsOn
---
.../org/apache/jena/sparql/graph/GraphWrapper.java | 1 +
.../src/main/java/org/apache/jena/graph/Graph.java | 6 +-
.../java/org/apache/jena/graph/compose/Dyadic.java | 1 +
.../java/org/apache/jena/graph/impl/GraphBase.java | 1 +
.../org/apache/jena/graph/impl/WrappedGraph.java | 1 +
.../org/apache/jena/graph/GraphContractTest.java | 1525 --------------------
.../jena/graph/compose/test/TestMultiUnion.java | 140 +-
.../apache/jena/graph/impl/CollectionGraph_CS.java | 67 -
.../rulesys/test/FRuleEngineIFactoryTest.java | 1 +
.../examples/riot/ExRIOT5_StreamRDFCollect.java | 2 -
.../querybuilder/UpdateBuilderExampleTests.java | 14 +-
.../jena/arq/querybuilder/UpdateBuilderTest.java | 32 +-
.../permissions/graph/impl/SecuredGraphImpl.java | 1 +
.../model/impl/SecuredStatementTermImpl.java | 4 +-
.../jena/permissions/graph/MemGraphTest.java | 5 +-
15 files changed, 98 insertions(+), 1703 deletions(-)
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphWrapper.java b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphWrapper.java
index 3c150f58e3..f44d5dff4a 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphWrapper.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphWrapper.java
@@ -40,6 +40,7 @@ public class GraphWrapper implements Graph
get().add(t);
}
+ @SuppressWarnings("removal")
@Override
public boolean dependsOn(Graph other) {
return get().dependsOn(other);
diff --git a/jena-core/src/main/java/org/apache/jena/graph/Graph.java b/jena-core/src/main/java/org/apache/jena/graph/Graph.java
index 6685077f1c..72424da11f 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/Graph.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/Graph.java
@@ -64,9 +64,11 @@ public interface Graph {
pessimistic (i.e. return true if it's not sure). Typically true when a
graph is a composition of other graphs, eg union.
- @param other the graph this graph may depend on
- @return false if this does not depend on other
+ @param other the graph this graph may depend on
+ @return false if this does not depend on other
+ @deprecated To be removed.
*/
+ @Deprecated(forRemoval = true)
boolean dependsOn( Graph other );
/** returns this Graph's transaction handler */
diff --git a/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java b/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java
index f266bf80ae..e7208a41dd 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java
@@ -66,6 +66,7 @@ public abstract class Dyadic extends CompositionBase {
/**
* Generic dependsOn, true iff it depends on either of the subgraphs.
*/
+ @SuppressWarnings("removal")
@Override
public boolean dependsOn(Graph other) {
return other == this || L.dependsOn(other) || R.dependsOn(other);
diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/GraphBase.java b/jena-core/src/main/java/org/apache/jena/graph/impl/GraphBase.java
index 64be06a73d..668b495bf3 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/impl/GraphBase.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/impl/GraphBase.java
@@ -83,6 +83,7 @@ public abstract class GraphBase implements GraphWithPerform
Default implementation answers <code>true</code> iff this graph is the
same graph as the argument graph.
*/
+ @SuppressWarnings("removal")
@Override
public boolean dependsOn( Graph other )
{ return this == other; }
diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/WrappedGraph.java b/jena-core/src/main/java/org/apache/jena/graph/impl/WrappedGraph.java
index 8de2b3ad92..777e285039 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/impl/WrappedGraph.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/impl/WrappedGraph.java
@@ -35,6 +35,7 @@ public class WrappedGraph implements GraphWithPerform
public WrappedGraph( Graph base )
{ this.base = base; }
+ @SuppressWarnings("removal")
@Override
public boolean dependsOn( Graph other )
{ return base.dependsOn( other ); }
diff --git a/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java b/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java
deleted file mode 100644
index 6a1353ba13..0000000000
--- a/jena-core/src/test/java/org/apache/jena/graph/GraphContractTest.java
+++ /dev/null
@@ -1,1525 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.graph;
-
-import static org.apache.jena.testing_framework.GraphHelper.*;
-import static org.junit.Assert.*;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Function;
-
-import org.apache.jena.mem.TrackingTripleIterator;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.impl.ReifierStd;
-import org.apache.jena.shared.ClosedException;
-import org.apache.jena.shared.DeleteDeniedException;
-import org.apache.jena.shared.PrefixMapping;
-import org.apache.jena.testing_framework.AbstractGraphProducer;
-import org.apache.jena.testing_framework.NodeCreateUtils;
-import org.apache.jena.util.iterator.ClosableIterator;
-import org.apache.jena.util.iterator.ExtendedIterator;
-import org.junit.After;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xenei.junit.contract.Contract;
-import org.xenei.junit.contract.ContractTest;
-
-/**
- * Graph contract test.
- */
-@Contract(Graph.class)
-public class GraphContractTest<T extends Graph>
-{
-
- private static final Logger LOG = LoggerFactory
- .getLogger(GraphContractTest.class);
-
- private AbstractGraphProducer<T> producer;
-
- protected RecordingGraphListener GL = new RecordingGraphListener();
-
- @Contract.Inject
- public final void setGraphContractTestProducer(
- AbstractGraphProducer<T> graphProducer)
- {
- producer = graphProducer;
- }
-
- @After
- public final void afterGraphContractTest()
- {
- producer.cleanUp();
- GL.clear();
- }
-
- @ContractTest
- public void testAdd_Triple()
- {
- Graph graph = producer.newInstance();
- graph.getEventManager().register(GL);
- txnBegin(graph);
- graph.add(triple("S P O"));
- txnCommit(graph);
- GL.assertHasStart("add", graph, triple("S P O"));
- txnRun(graph, () -> assertTrue("Graph should contain <S P O>",
- graph.contains(triple("S P O"))));
-
- }
-
- /**
- * Inference graphs can not be truly empty.
- *
- * @param g
- * @param b
- */
- private void assertEmpty(Graph g, Graph b)
- {
- if (b.isEmpty())
- {
- assertTrue("Graph should be empty", g.isEmpty());
- } else
- {
- assertEquals("Graph should be in base state",
- b.find(Triple.ANY).toList(), g.find(Triple.ANY).toList());
- }
- }
-
- /**
- * Inference graphs can not be truly empty
- *
- * @param g
- * @param b
- */
- private void assertNotEmpty(Graph g, Graph b)
- {
- if (b.isEmpty())
- {
- assertFalse("Graph not should be empty", g.isEmpty());
- } else
- {
- assertNotEquals("Graph should not be in base state",
- b.find(Triple.ANY).toList(), g.find(Triple.ANY).toList());
- }
- }
-
- @SuppressWarnings("deprecation")
- private static boolean xsupportsLiteralTyping(Graph g) {
- //return g.getCapabilities().handlesLiteralTyping();
- return g instanceof org.apache.jena.mem.GraphMem;
- }
-
- /**
- * Test that clear works, in the presence of inferencing graphs that mean
- * emptyness isn't available. This is why we go round the houses and test
- * that expected ~= initialContent + addedStuff - removed - initialContent.
- */
- @ContractTest
- public void testClear_Empty()
- {
- Graph graph = producer.newInstance();
- Graph base = copy(graph);
-
- graph.getEventManager().register(GL);
- txnRun(graph, () -> graph.clear());
-
- txnRun(graph, () -> assertEmpty(graph, base));
- GL.assertHasStart("someEvent", graph, GraphEvents.removeAll);
- GL.clear();
- }
-
- @ContractTest
- public void testClear()
- {
- Graph graph = producer.newInstance();
- Graph base = copy(graph);
- // test after adding
- graphWith(graph, "S P O; S e:ff 27; _1 P P3; S4 P4 'en'");
- graph.getEventManager().register(GL);
- txnRun(graph, () -> graph.clear());
-
- txnRun(graph, () -> assertEmpty(graph, base));
- if (GL.contains("delete"))
- {
- // deletes are listed -- ensure all deletes are listed
- GL.assertContains("delete", graph, triple("S P O"));
- GL.assertContains("delete", graph, triple("S e:ff 27"));
- GL.assertContains("delete", graph, triple("_1 P P3"));
- GL.assertContains("delete", graph, triple("S4 P4 'en'"));
- }
- GL.assertHasEnd("someEvent", graph, GraphEvents.removeAll);
- GL.clear();
-
- }
-
- @ContractTest
- public void testClose()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S P2 O2; S3 P P3");
- graph.getEventManager().register(GL);
- assertFalse("Graph was constructed closed", graph.isClosed());
-
- txnRun(graph, () -> graph.close());
-
- assertTrue("Graph should be closed", graph.isClosed());
-
- // exception may be thrown on begin or on execution.
- try
- {
- txnBegin(graph);
- try
- {
- graph.add(triple("S P O"));
- fail("added when closed");
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- } finally
- {
- txnRollback(graph);
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
- try
- {
- graph.delete(triple("x R y"));
- fail("delete when closed");
- } catch (ClosedException c)
- {
- // Expected
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
-
- try
- {
- graph.add(triple("x R y"));
- fail("add when closed");
- } catch (ClosedException c)
- { /* as required */
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
- try
- {
- graph.contains(triple("x R y"));
- fail("contains[triple] when closed");
- } catch (ClosedException c)
- { /* as required */
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
- try
- {
- graph.contains(Node.ANY, Node.ANY, Node.ANY);
- fail("contains[SPO] when closed");
- } catch (ClosedException c)
- { /* as required */
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
- try
- {
- graph.find(triple("x R y"));
- fail("find [triple] when closed");
- } catch (ClosedException c)
- { /* as required */
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
- try
- {
- graph.find(Node.ANY, Node.ANY, Node.ANY);
- fail("find[SPO] when closed");
- } catch (ClosedException c)
- { /* as required */
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
-
- try
- {
- txnBegin(graph);
- try
- {
- graph.size();
- fail("size when closed (" + this.getClass() + ")");
- } catch (ClosedException c)
- { /* as required */
- } finally
- {
- txnRollback(graph);
- GL.assertEmpty();
- }
- } catch (Exception expected)
- {
- GL.assertEmpty();
- // expected
- }
- }
-
- @ContractTest
- public void testContains_Node_Node_Node()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S2 P2 O2; S3 P3 O3");
-
- txnRun(graph, () -> {
- assertTrue(graph.contains(node("S"), node("P"), node("O")));
- assertFalse(graph.contains(node("S"), node("P"), node("O2")));
- assertFalse(graph.contains(node("S"), node("P2"), node("O")));
- assertFalse(graph.contains(node("S2"), node("P"), node("O")));
- assertTrue(graph.contains(Node.ANY, Node.ANY, Node.ANY));
- assertTrue(graph.contains(Node.ANY, Node.ANY, node("O")));
- assertTrue(graph.contains(Node.ANY, node("P"), Node.ANY));
- assertTrue(graph.contains(node("S"), Node.ANY, Node.ANY));
- });
- }
-
- @ContractTest
- public void testContains_Node_Node_Node_RepeatedSubjectDoesNotConceal()
- {
-
- Graph g = graphWith(producer.newInstance(), "s P o; s Q r");
- Node s = node("s");
- Node P = node("P");
- Node o = node("o");
- Node Q = node("Q");
- Node r = node("r");
- Node any = node("??");
- txnRun(g, () -> {
- assertTrue(g.contains(s, P, o));
- assertTrue(g.contains(s, Q, r));
- assertTrue(g.contains(any, P, o));
- assertTrue(g.contains(any, Q, r));
- assertTrue(g.contains(any, P, any));
- assertTrue(g.contains(any, Q, any));
- });
- }
-
- @ContractTest
- public void testContains_Node_Node_Node_Concrete()
- {
- Node s = node("s");
- Node P = node("P");
- Node o = node("o");
-
- Node _x = node("_x");
- Node R = node("R");
- Node _y = node("_y");
-
- Node x = node("x");
- Node S = node("S");
-
- Graph g = graphWith(producer.newInstance(), "s P o; _x R _y; x S 0");
- txnRun(g, () -> {
-
- assertTrue("Graph should have contained s P o",
- g.contains(s, P, o));
- assertTrue("Graph should have contained _x _R _y",
- g.contains(_x, R, _y));
- assertTrue("Graph should have contained x S 'O'",
- g.contains(x, S, node("0")));
- /* */
- assertFalse(g.contains(s, P, node("Oh")));
- assertFalse(g.contains(S, P, node("O")));
- assertFalse(g.contains(s, node("p"), o));
- assertFalse(g.contains(_x, node("_r"), _y));
- assertFalse(g.contains(x, S, node("1")));
- });
- }
-
- @ContractTest
- public void testContains_Node_Node_Node_Concrete_BlankPredicate()
- {
- Node s = node("s");
- Node P = node("P");
- Node o = node("o");
-
- Node _x = node("_x");
- Node _R = node("_R");
- Node _y = node("_y");
-
- Node x = node("x");
- Node S = node("S");
-
- Graph g = graphWith(producer.newInstance(), "s P o; _x _R _y; x S 0");
- txnRun(g, () -> {
-
- assertTrue("Graph should have contained _x _R _y",
- g.contains(_x, _R, _y));
- assertFalse(g.contains(_x, node("_r"), _y));
- });
- }
-
- @ContractTest
- public void testContains_Node_Node_Node_Fluid()
- {
- Node x = node("x");
- Node R = node("R");
- Node P = node("P");
- Node y = node("y");
- Node a = node("a");
- Node b = node("b");
- Graph g = graphWith(producer.newInstance(), "x R y; a P b");
-
- txnRun(g, () -> {
- assertTrue(g.contains(Node.ANY, R, y));
- assertTrue(g.contains(x, Node.ANY, y));
- assertTrue(g.contains(x, R, Node.ANY));
- assertTrue(g.contains(Node.ANY, P, b));
- assertTrue(g.contains(a, Node.ANY, b));
- assertTrue(g.contains(a, P, Node.ANY));
- assertTrue(g.contains(Node.ANY, R, y));
- /* */
- assertFalse(g.contains(Node.ANY, R, b));
- assertFalse(g.contains(a, Node.ANY, y));
- assertFalse(g.contains(x, P, Node.ANY));
- assertFalse(g.contains(Node.ANY, R, x));
- assertFalse(g.contains(x, Node.ANY, R));
- assertFalse(g.contains(a, node("S"), Node.ANY));
- });
- }
-
- @ContractTest
- public void testContains_Triple()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S2 P2 O2; S3 P3 O3");
- txnRun(graph, () -> {
- assertTrue(graph.contains(triple("S P O")));
- assertFalse(graph.contains(triple("S P O2")));
- assertFalse(graph.contains(triple("S P2 O")));
- assertFalse(graph.contains(triple("S2 P O")));
- assertTrue(graph.contains(Triple.ANY));
- assertTrue(
- graph.contains(Triple.create(Node.ANY, Node.ANY, node("O"))));
- assertTrue(
- graph.contains(Triple.create(Node.ANY, node("P"), Node.ANY)));
- assertTrue(
- graph.contains(Triple.create(node("S"), Node.ANY, Node.ANY)));
- });
-
- }
-
- @ContractTest
- public void testContains_Triple_RepeatedSubjectDoesNotConceal()
- {
-
- Graph g = graphWith(producer.newInstance(), "s P o; s Q r");
- txnRun(g, () -> {
- assertTrue(g.contains(triple("s P o")));
- assertTrue(g.contains(triple("s Q r")));
- assertTrue(g.contains(triple("?? P o")));
- assertTrue(g.contains(triple("?? Q r")));
- assertTrue(g.contains(triple("?? P ??")));
- assertTrue(g.contains(triple("?? Q ??")));
- });
- }
-
- @ContractTest
- public void testContains_Triple_Concrete()
- {
- Graph g = graphWith(producer.newInstance(), "s P o; _x R _y; x S 0");
- txnRun(g, () -> {
- assertTrue(g.contains(triple("s P o")));
- assertTrue(g.contains(triple("_x R _y")));
- assertTrue(g.contains(triple("x S 0")));
- /* */
- assertFalse(g.contains(triple("s P Oh")));
- assertFalse(g.contains(triple("S P O")));
- assertFalse(g.contains(triple("s p o")));
- assertFalse(g.contains(triple("_x _r _y")));
- assertFalse(g.contains(triple("x S 1")));
- });
- }
-
- @ContractTest
- public void testContains_Triple_Concrete_BlankPredicate()
- {
- Graph g = graphWith(producer.newInstance(), "s P o; _x _R _y; x S 0");
- txnRun(g, () -> {
- assertTrue(g.contains(triple("s P o")));
- assertTrue(g.contains(triple("_x _R _y")));
- assertTrue(g.contains(triple("x S 0")));
- /* */
- assertFalse(g.contains(triple("s P Oh")));
- assertFalse(g.contains(triple("S P O")));
- assertFalse(g.contains(triple("s p o")));
- assertFalse(g.contains(triple("_x _r _y")));
- assertFalse(g.contains(triple("x S 1")));
- });
- }
-
- @ContractTest
- public void testContains_Triple_Fluid()
- {
- Graph g = graphWith(producer.newInstance(), "x R y; a P b");
- txnRun(g, () -> {
-
- assertTrue(g.contains(triple("?? R y")));
- assertTrue(g.contains(triple("x ?? y")));
- assertTrue(g.contains(triple("x R ??")));
- assertTrue(g.contains(triple("?? P b")));
- assertTrue(g.contains(triple("a ?? b")));
- assertTrue(g.contains(triple("a P ??")));
- assertTrue(g.contains(triple("?? R y")));
- /* */
- assertFalse(g.contains(triple("?? R b")));
- assertFalse(g.contains(triple("a ?? y")));
- assertFalse(g.contains(triple("x P ??")));
- assertFalse(g.contains(triple("?? R x")));
- assertFalse(g.contains(triple("x ?? R")));
- assertFalse(g.contains(triple("a S ??")));
- });
- }
-
- /**
- * Inference graphs can not be empty
- */
- @ContractTest
- public void testDelete_Triple()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S2 P2 O2; S3 P3 O3");
- Graph base = producer.newInstance();
- graph.getEventManager().register(GL);
-
- try
- {
- txnBegin(graph);
- graph.delete(triple("S P O"));
- txnCommit(graph);
- } catch (DeleteDeniedException expected)
- {
- txnRollback(graph);
- fail("delete( S P O ) failed: " + expected.getMessage());
- }
-
- GL.assertContains("delete", graph, triple("S P O"));
-
- txnRun(graph, () -> {
- assertFalse("Graph should not contain <S P O>",
- graph.contains(triple("S P O")));
- assertNotEmpty(graph, base);
- assertTrue("Graph should contain <S2 P2 O2>",
- graph.contains(triple("S2 P2 O2")));
- assertTrue("Graph should contain <S3 P3 O3>",
- graph.contains(triple("S3 P3 O3")));
- });
- }
-
- @ContractTest
- public void testDelete_Triple_Wildcard()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S2 P2 O2; S3 P3 O3");
- Graph base = producer.newInstance();
- graph.getEventManager().register(GL);
-
- // should not modify anything on wildcard delete
- GL.clear();
- try
- {
- txnBegin(graph);
- graph.delete(Triple.create(node("S2"), node("P2"), Node.ANY));
- txnCommit(graph);
- } catch (DeleteDeniedException expected)
- {
- txnRollback(graph);
- }
- txnRun(graph, () -> {
-
- assertTrue("Graph should contain <S2 P2 O2>",
- graph.contains(triple("S2 P2 O2")));
- assertTrue("Graph should contain <S3 P3 O3>",
- graph.contains(triple("S3 P3 O3")));
- });
- GL.assertHas("delete", graph,
- Triple.create(node("S2"), node("P2"), Node.ANY));
- }
-
- @ContractTest
- public void testDelete_Triple_FromNothing()
- {
- Graph g = producer.newInstance();
- g.getEventManager().register(GL);
- txnBegin(g);
- g.delete(triple("quint rdf:subject S"));
- txnCommit(g);
- GL.assertContains("delete", g, triple("quint rdf:subject S"));
- }
-
- @ContractTest
- public void testDependsOn()
- {
- Graph g = producer.newInstance();
- Graph[] depGraphs = producer.getDependsOn(g);
- if (depGraphs != null)
- {
- for (Graph dg : depGraphs)
- {
- assertTrue(
- String.format("Graph %s should depend upon %s", g, dg),
- g.dependsOn(dg));
- }
- }
- depGraphs = producer.getNotDependsOn(g);
- if (depGraphs != null)
- {
- for (Graph dg : depGraphs)
- {
- assertFalse(String.format("Graph %s should not depend upon %s",
- g, dg), g.dependsOn(dg));
- }
- }
- }
-
- @ContractTest
- public void testFind_Node_Node_Node()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S2 P2 O2; S3 P3 O3");
- txnBegin(graph);
- List<Triple> s = graph.find(Node.ANY, Node.ANY, Node.ANY).toList();
- assertEquals(3, s.size());
- List<Triple> expected = Arrays.asList(new Triple[] { triple("S P O"),
- triple("S2 P2 O2"), triple("S3 P3 O3") });
- assertTrue("Missing some values",
- expected.containsAll(s) && s.containsAll(expected));
-
- s = graph.find(node("S"), Node.ANY, Node.ANY).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S P O")));
-
- s = graph.find(Node.ANY, node("P"), Node.ANY).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S P O")));
-
- s = graph.find(Node.ANY, Node.ANY, node("O")).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S P O")));
-
- s = graph.find(node("S2"), node("P2"), node("O2")).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S2 P2 O2")));
-
- s = graph.find(node("S2"), node("P3"), node("O2")).toList();
- assertEquals(0, s.size());
-
- s = graph.find(Node.ANY, node("P3"), node("O2")).toList();
- assertEquals(0, s.size());
-
- s = graph.find(node("S3"), Node.ANY, node("O2")).toList();
- assertEquals(0, s.size());
-
- s = graph.find(node("S3"), node("P2"), Node.ANY).toList();
- assertEquals(0, s.size());
- txnRollback(graph);
- }
-
- @ContractTest
- public void testFind_Node_Node_Node_ByFluidTriple()
- {
- Node x = node("x");
- Node y = node("y");
- Node z = node("z");
- Graph g = graphWith(producer.newInstance(), "x y z ");
- Set<Triple> expect = tripleSet("x y z");
- txnBegin(g);
- assertEquals(expect, g.find(Node.ANY, y, z).toSet());
- assertEquals(expect, g.find(x, Node.ANY, z).toSet());
- assertEquals(expect, g.find(x, y, Node.ANY).toSet());
- txnRollback(g);
- }
-
- @ContractTest
- public void testFind_Node_Node_Node_MatchLanguagedLiteralCaseInsensitive()
- {
- Graph g = graphWith(producer.newInstance(), "a p 'chat'en");
- Node chaten = node("'chat'en"), chatEN = node("'chat'EN");
- assertEquals(chaten, chatEN);
- assertTrue(chaten.sameValueAs(chatEN));
- assertEquals(chaten.getIndexingValue(), chatEN.getIndexingValue());
- txnBegin(g);
- assertEquals(1, g.find(Node.ANY, Node.ANY, chaten).toList().size());
- assertEquals(1, g.find(Node.ANY, Node.ANY, chatEN).toList().size());
- txnRollback(g);
- }
-
- @ContractTest
- public void testFind_Node_Node_Node_NoMatchAgainstUnlanguagesLiteral()
- {
- Graph g = graphWith(producer.newInstance(), "a p 'chat'en; a p 'chat'");
- Node chaten = node("'chat'en"), chatEN = node("'chat'EN");
- assertEquals(chaten, chatEN);
- assertTrue(chaten.sameValueAs(chatEN));
- assertEquals(chaten.getIndexingValue(), chatEN.getIndexingValue());
- txnBegin(g);
- assertEquals(1, g.find(Node.ANY, Node.ANY, chaten).toList().size());
- assertEquals(1, g.find(Node.ANY, Node.ANY, chatEN).toList().size());
- txnRollback(g);
- }
-
- @ContractTest
- public void testFind_Triple()
- {
- Graph graph = graphWith(producer.newInstance(),
- "S P O; S2 P2 O2; S3 P3 O3");
- txnBegin(graph);
- List<Triple> s = graph.find(Triple.ANY).toList();
- assertEquals(3, s.size());
- List<Triple> expected = Arrays.asList(new Triple[] { triple("S P O"),
- triple("S2 P2 O2"), triple("S3 P3 O3") });
- assertTrue("Missing some values", expected.containsAll(s));
-
- s = graph.find(Triple.create(node("S"), Node.ANY, Node.ANY)).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S P O")));
-
- s = graph.find(Triple.create(Node.ANY, node("P"), Node.ANY)).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S P O")));
-
- s = graph.find(Triple.create(Node.ANY, Node.ANY, node("O"))).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S P O")));
-
- s = graph.find(Triple.create(node("S2"), node("P2"), node("O2"))).toList();
- assertEquals(1, s.size());
- assertTrue("Missing some values", s.contains(triple("S2 P2 O2")));
-
- s = graph.find(Triple.create(node("S2"), node("P3"), node("O2"))).toList();
- assertEquals(0, s.size());
-
- s = graph.find(Triple.create(Node.ANY, node("P3"), node("O2"))).toList();
- assertEquals(0, s.size());
-
- s = graph.find(Triple.create(node("S3"), Node.ANY, node("O2"))).toList();
- assertEquals(0, s.size());
-
- s = graph.find(Triple.create(node("S3"), node("P2"), Node.ANY)).toList();
- assertEquals(0, s.size());
- txnRollback(graph);
- }
-
- @ContractTest
- public void testFind_Triple_ByFluidTriple()
- {
- Graph g = graphWith(producer.newInstance(), "x y z ");
- Set<Triple> expect = tripleSet("x y z");
- txnBegin(g);
- assertEquals(expect, g.find(triple("?? y z")).toSet());
- assertEquals(expect, g.find(triple("x ?? z")).toSet());
- assertEquals(expect, g.find(triple("x y ??")).toSet());
- txnRollback(g);
- }
-
- @ContractTest
- public void testFind_Triple_NoMatchAgainstUnlanguagesLiteral()
- {
- Graph g = graphWith(producer.newInstance(), "a p 'chat'en; a p 'chat'");
- Node chaten = node("'chat'en"), chatEN = node("'chat'EN");
- assertEquals(chaten, chatEN);
- assertTrue(chaten.sameValueAs(chatEN));
- assertEquals(chaten.getIndexingValue(), chatEN.getIndexingValue());
- txnBegin(g);
- assertEquals(1, g.find(Triple.create(Node.ANY, Node.ANY, chaten))
- .toList().size());
- assertEquals(1, g.find(Triple.create(Node.ANY, Node.ANY, chatEN))
- .toList().size());
- txnRollback(g);
- }
-
- @ContractTest
- public void testGetEventManager()
- {
- assertNotNull("Must return an EventManager",
- producer.newInstance().getEventManager());
- }
-
- @ContractTest
- public void testGetPrefixMapping()
- {
- Graph g = producer.newInstance();
- txnBegin(g);
- PrefixMapping pm = g.getPrefixMapping();
- assertNotNull("Must return prefix mapping", pm);
- assertSame("getPrefixMapping must always return the same object", pm,
- g.getPrefixMapping());
- txnRollback(g);
- pm.setNsPrefix("pfx1", "http://example.com/");
- pm.setNsPrefix("pfx2", "scheme:rope/string#");
-
- txnBegin(g);
- // assert same after adding to other mapl
- assertSame("getPrefixMapping must always return the same object", pm,
- g.getPrefixMapping());
- txnRollback(g);
-
- }
-
- @ContractTest
- public void testGetTransactionHandler()
- {
- Graph g = producer.newInstance();
- assertNotNull("Must return a Transaction handler",
- g.getTransactionHandler());
- }
-
- @ContractTest
- public void testIsClosed()
- {
- Graph g = producer.newInstance();
- assertFalse("Graph created in closed state", g.isClosed());
- txnBegin(g);
- g.close();
- txnCommit(g);
- txnBegin(g);
- assertTrue("Graph does not report closed state after close called",
- g.isClosed());
- txnRollback(g);
- }
-
- @ContractTest
- public void testIsEmpty()
- {
- Graph g = producer.newInstance();
- txnBegin(g);
- if (!g.isEmpty())
- {
- LOG.warn(String.format(
- "Graph type %s can not be empty (Empty test skipped)",
- g.getClass()));
- txnRollback(g);
- } else
- {
- txnRollback(g);
- graphAddTxn(g, "S P O");
- txnBegin(g);
- assertFalse("Graph reports empty after add", g.isEmpty());
- txnRollback(g);
-
- txnBegin(g);
- g.add(NodeCreateUtils.createTriple("Foo B C"));
- g.delete(NodeCreateUtils.createTriple("S P O"));
- txnCommit(g);
- txnBegin(g);
- assertFalse("Should not report empty", g.isEmpty());
- txnRollback(g);
-
- txnBegin(g);
- g.delete(NodeCreateUtils.createTriple("Foo B C"));
- txnCommit(g);
- txnBegin(g);
- assertTrue("Should report empty after all entries deleted",
- g.isEmpty());
- txnRollback(g);
- }
- }
-
- @ContractTest
- public void testIsIsomorphicWith_Graph()
- {
- Graph graph = producer.newInstance();
- Graph g2 = memGraph();
- txnBegin(graph);
- assertTrue("Empty graphs should be isomorphic",
- graph.isIsomorphicWith(g2));
- txnRollback(graph);
- graphWith(graph, "S P O; S2 P2 O2; S3 P3 O3");
- g2 = graphWith("S3 P3 O3; S2 P2 O2; S P O");
- txnBegin(graph);
- assertTrue("Should be isomorphic", graph.isIsomorphicWith(g2));
- txnRollback(graph);
- txnBegin(graph);
- graph.add(triple("_1, P4 S4"));
- txnCommit(graph);
-
- txnBegin(g2);
- g2.add(triple("_2, P4 S4"));
- txnCommit(g2);
- txnBegin(graph);
- assertTrue("Should be isomorphic after adding anonymous nodes",
- graph.isIsomorphicWith(g2));
- txnRollback(graph);
-
- txnBegin(graph);
- graph.add(triple("_1, P3 S4"));
- txnCommit(graph);
-
- txnBegin(g2);
- g2.add(triple("_2, P4 S4"));
- txnCommit(g2);
- txnBegin(graph);
- assertFalse("Should not be isomorphic", graph.isIsomorphicWith(g2));
- txnRollback(graph);
- }
-
- private Graph copy(Graph g)
- {
- Graph result = producer.newInstance();
- txnBegin(result);
- GraphUtil.addInto(result, g);
- txnCommit(result);
- return result;
- }
-
- private Graph remove(Graph toUpdate, Graph toRemove)
- {
- txnBegin(toUpdate);
- GraphUtil.deleteFrom(toUpdate, toRemove);
- txnCommit(toUpdate);
- return toUpdate;
- }
-
- /**
- * Test that remove(s, p, o) works, in the presence of inferencing graphs
- * that mean emptyness isn't available. This is why we go round the houses
- * and test that expected ~= initialContent + addedStuff - removed -
- * initialContent.
- */
- @ContractTest
- public void testRemove_Node_Node_Node()
- {
- for (int i = 0; i < cases.length; i += 1)
- for (int j = 0; j < 3; j += 1)
- {
- Graph content = producer.newInstance();
-
- Graph baseContent = copy(content);
- graphAddTxn(content, cases[i][0]);
- Triple remove = triple(cases[i][1]);
- Graph expected = graphWith(cases[i][2]);
- Triple[] removed = tripleArray(cases[i][3]);
- content.getEventManager().register(GL);
- GL.clear();
- txnBegin(content);
- content.remove(remove.getSubject(), remove.getPredicate(),
- remove.getObject());
- txnCommit(content);
-
- // check for optional delete notifications
- if (GL.contains("delete"))
- {
- // if it contains any it must contain all.
- for (Triple t : removed)
- {
- GL.assertContains("delete", content, t);
- }
- }
- GL.assertHasEnd("someEvent", content,
- GraphEvents.remove(remove.getSubject(),
- remove.getPredicate(), remove.getObject()));
-
- content.getEventManager().unregister(GL);
- Graph finalContent = remove(copy(content), baseContent);
- txnBegin(finalContent);
- assertIsomorphic(cases[i][1], expected, finalContent);
- txnRollback(finalContent);
- }
- }
-
- @ContractTest
- public void testRemove_ByIterator()
- {
- testRemove("?? ?? ??", "?? ?? ??");
- testRemove("S ?? ??", "S ?? ??");
- testRemove("S ?? ??", "?? P ??");
- testRemove("S ?? ??", "?? ?? O");
- testRemove("?? P ??", "S ?? ??");
- testRemove("?? P ??", "?? P ??");
- testRemove("?? P ??", "?? ?? O");
- testRemove("?? ?? O", "S ?? ??");
- testRemove("?? ?? O", "?? P ??");
- testRemove("?? ?? O", "?? ?? O");
- }
-
- private void testRemove(String findRemove, String findCheck)
- {
- Graph g = graphWith(producer.newInstance(), "S P O");
- txnBegin(g);
- ExtendedIterator<Triple> it = g
- .find(NodeCreateUtils.createTriple(findRemove));
- txnRollback(g);
- try
- {
- it.next();
- it.remove();
- it.close();
- assertEquals("remove with " + findRemove + ":", 0, g.size());
- assertFalse(g.contains(NodeCreateUtils.createTriple(findCheck)));
- } catch (UnsupportedOperationException e)
- {
- it.close();
- }
- }
-
- /**
- * This test case was generated by Ian and was caused by GraphMem not
- * keeping up with changes to the find interface.
- */
- @ContractTest
- public void testFindAndContains()
- {
- Graph g = producer.newInstance();
- Node r = NodeCreateUtils.create("r"), s = NodeCreateUtils.create("s"),
- p = NodeCreateUtils.create("P");
- txnBegin(g);
- try
- {
- g.add(Triple.create(r, p, s));
- txnCommit(g);
- txnBegin(g);
- assertTrue(g.contains(r, p, Node.ANY));
- assertEquals(1, g.find(r, p, Node.ANY).toList().size());
- } catch (Exception e)
- {
- fail(e.getMessage());
- } finally
- {
- txnRollback(g);
- }
- }
-
- /**
- * Check that contains respects by-value semantics.
- */
-
- @ContractTest
- public void testAGraph()
- {
- String title = this.getClass().getName();
- Graph g = producer.newInstance();
- txnBegin(g);
- int baseSize = g.size();
- txnRollback(g);
- graphAddTxn(g, "x R y; p S q; a T b");
- /* */
- txnBegin(g);
- assertContainsAll(title + ": simple graph", g, "x R y; p S q; a T b");
- assertEquals(title + ": size", baseSize + 3, g.size());
- txnRollback(g);
-
- graphAddTxn(g,
- "spindizzies lift cities; Diracs communicate instantaneously");
- txnBegin(g);
- assertEquals(title + ": size after adding", baseSize + 5, g.size());
-
- g.delete(triple("x R y"));
- g.delete(triple("a T b"));
- txnCommit(g);
- txnBegin(g);
- assertEquals(title + ": size after deleting", baseSize + 3, g.size());
- assertContainsAll(title + ": modified simple graph", g,
- "p S q; spindizzies lift cities; Diracs communicate instantaneously");
- assertOmitsAll(title + ": modified simple graph", g, "x R y; a T b");
- /* */
- ClosableIterator<Triple> it = g.find(Node.ANY, node("lift"), Node.ANY);
- assertTrue(title + ": finds some triple(s)", it.hasNext());
- assertEquals(title + ": finds a 'lift' triple",
- triple("spindizzies lift cities"), it.next());
- assertFalse(title + ": finds exactly one triple", it.hasNext());
- txnRollback(g);
- it.close();
- }
-
- @ContractTest
- public void testAddWithReificationPreamble()
- {
- Graph g = producer.newInstance();
- txnBegin(g);
- xSPO(g);
- txnCommit(g);
- txnBegin(g);
- assertFalse(g.isEmpty());
- txnRollback(g);
- }
-
- protected void xSPOyXYZ(Graph g)
- {
- xSPO(g);
- ReifierStd.reifyAs(g, NodeCreateUtils.create("y"),
- NodeCreateUtils.createTriple("X Y Z"));
- }
-
- protected void aABC(Graph g)
- {
- ReifierStd.reifyAs(g, NodeCreateUtils.create("a"),
- NodeCreateUtils.createTriple("Foo B C"));
- }
-
- protected void xSPO(Graph g)
- {
- ReifierStd.reifyAs(g, NodeCreateUtils.create("x"),
- NodeCreateUtils.createTriple("S P O"));
- }
-
- @ContractTest
- public void failingTestDoubleRemoveAll()
- {
- final Graph g = producer.newInstance();
- try
- {
- graphAddTxn(g, "c S d; e:ff GGG hhhh; _i J 27; Ell Em 'en'");
- txnBegin(g);
- Iterator<Triple> it = new TrackingTripleIterator(g.find(Triple.ANY))
- {
- @Override
- public void remove()
- {
- super.remove(); // removes current
- g.delete(current); // no-op.
- }
- };
- txnRollback(g);
- while (it.hasNext())
- {
- it.next();
- it.remove();
- }
- txnBegin(g);
- assertTrue(g.isEmpty());
- txnRollback(g);
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
- }
-
- /**
- * Test cases for RemoveSPO(); each entry is a triple (add, remove, result).
- * <ul>
- * <li>add - the triples to add to the graph to start with
- * <li>remove - the pattern to use in the removal
- * <li>result - the triples that should remain in the graph
- * </ul>
- */
- protected static String[][] cases = { { "x R y", "x R y", "", "x R y" },
- { "x R y; a P b", "x R y", "a P b", "x R y" },
- { "x R y; a P b", "?? R y", "a P b", "x R y" },
- { "x R y; a P b", "x R ??", "a P b", "x R y" },
- { "x R y; a P b", "x ?? y", "a P b", "x R y" },
- { "x R y; a P b", "?? ?? ??", "", "x R y; a P b" },
- { "x R y; a P b; c P d", "?? P ??", "x R y", "a P b; c P d" },
- { "x R y; a P b; x S y", "x ?? ??", "a P b", "x R y; x S y" }, };
-
- /**
- * testIsomorphism from file data
- *
- * @throws URISyntaxException
- * @throws MalformedURLException
- */
- @ContractTest
- public void testIsomorphismFile()
- throws URISyntaxException, MalformedURLException
- {
- testIsomorphismXMLFile(1, true);
- testIsomorphismXMLFile(2, true);
- testIsomorphismXMLFile(3, true);
- testIsomorphismXMLFile(4, true);
- testIsomorphismXMLFile(5, false);
- testIsomorphismXMLFile(6, false);
- testIsomorphismNTripleFile(7, true);
- testIsomorphismNTripleFile(8, false);
-
- }
-
- private void testIsomorphismNTripleFile(int i, boolean result)
- {
- testIsomorphismFile(i, "N-TRIPLE", "nt", result);
- }
-
- private void testIsomorphismXMLFile(int i, boolean result)
- {
- testIsomorphismFile(i, "RDF/XML", "rdf", result);
- }
-
- private InputStream getInputStream(int n, int n2, String suffix)
- {
- String urlStr = String.format("regression/testModelEquals/%s-%s.%s", n,
- n2, suffix);
- return GraphContractTest.class.getClassLoader()
- .getResourceAsStream(urlStr);
- }
-
- private void testIsomorphismFile(int n, String lang, String suffix,
- boolean result)
- {
- Graph g1 = producer.newInstance();
- Graph g2 = producer.newInstance();
- Model m1 = ModelFactory.createModelForGraph(g1);
- Model m2 = ModelFactory.createModelForGraph(g2);
-
- txnBegin(g1);
- m1.read(getInputStream(n, 1, suffix), "http://www.example.org/", lang);
- txnCommit(g1);
-
- txnBegin(g2);
- m2.read(getInputStream(n, 2, suffix), "http://www.example.org/", lang);
- txnCommit(g2);
-
- txnBegin(g1);
- boolean rslt = g1.isIsomorphicWith(g2) == result;
- txnRollback(g1);
- if (!rslt)
- {
- System.out.println("g1:");
- m1.write(System.out, "N-TRIPLE");
- System.out.println("g2:");
- m2.write(System.out, "N-TRIPLE");
- }
- assertTrue("Isomorphism test failed", rslt);
- }
-
- protected Graph getClosed()
- {
- Graph result = producer.newInstance();
- result.close();
- return result;
- }
-
- /**
- * Ensure that triples removed by calling .remove() on the iterator returned
- * by a find() will generate deletion notifications.
- */
- @ContractTest
- public void testIterator_Remove()
- {
- Graph graph = graphWith(producer.newInstance(), "a R b; b S e");
- graph.getEventManager().register(GL);
- txnBegin(graph);
- Triple toRemove = triple("a R b");
- ExtendedIterator<Triple> rtr = graph.find(toRemove);
- assertTrue("ensure a(t least) one triple", rtr.hasNext());
- txnRollback(graph);
- try
- {
- rtr.next();
- rtr.remove();
- rtr.close();
- GL.assertHas("delete", graph, toRemove);
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
- }
-
- @ContractTest
- public void testTransactionHandler_Commit()
- {
- Graph g = producer.newInstance();
- if (g.getTransactionHandler().transactionsSupported())
- {
- Graph initial = graphWith("initial hasValue 42; also hasURI hello");
- Graph extra = graphWith("extra hasValue 17; also hasURI world");
- g.getTransactionHandler().begin();
- GraphUtil.addInto(g, initial);
- g.getTransactionHandler().commit();
- g.getTransactionHandler().begin();
- GraphUtil.addInto(g, extra);
- g.getTransactionHandler().commit();
- Graph union = memGraph();
- GraphUtil.addInto(union, initial);
- GraphUtil.addInto(union, extra);
- g.getTransactionHandler().begin();
- assertIsomorphic(union, g);
- g.getTransactionHandler().abort();
- // Model inFiIProducer<TransactionHandler>le =
- // ModelFactory.createDefaultModel();
- // inFile.read( "file:///" + foo, "N-TRIPLES" );
- // assertIsomorphic( union, inFile.getGraph() );
- }
- }
-
- @ContractTest
- public void testTransactionHandler_Abort()
- {
- Graph g = producer.newInstance();
- if (g.getTransactionHandler().transactionsSupported())
- {
- Graph initial = graphWith(producer.newInstance(),
- "initial hasValue 42; also hasURI hello");
- Graph extra = graphWith(producer.newInstance(),
- "extra hasValue 17; also hasURI world");
- g.getTransactionHandler().begin();
- GraphUtil.addInto(g, initial);
- g.getTransactionHandler().commit();
-
- g.getTransactionHandler().begin();
- GraphUtil.addInto(g, extra);
- g.getTransactionHandler().abort();
-
- g.getTransactionHandler().begin();
- assertIsomorphic(initial, g);
- g.getTransactionHandler().abort();
- }
- }
-
- @ContractTest
- public void testTransactionHandler_CommitThenAbort()
- {
- Graph g = producer.newInstance();
- if (g.getTransactionHandler().transactionsSupported())
- {
- Graph initial = graphWith(producer.newInstance(),
- "Foo pings B; B pings C");
- Graph extra = graphWith(producer.newInstance(),
- "C pingedBy B; fileGraph rdf:type Graph");
- g.getTransactionHandler().begin();
- GraphUtil.addInto(g, initial);
- g.getTransactionHandler().commit();
- g.getTransactionHandler().begin();
- GraphUtil.addInto(g, extra);
- g.getTransactionHandler().abort();
- g.getTransactionHandler().begin();
- assertIsomorphic(initial, g);
- g.getTransactionHandler().abort();
- // Model inFile = ModelFactory.createDefaultModel();
- // inFile.read( "file:///" + foo, "N-TRIPLES" );
- // assertIsomorphic( initial, inFile.getGraph() );
- }
- }
-
- //
- // Test that literal typing works when supported
- //
-
- // used to find the object set from the returned set for literal testing
-
- private static final Function<Triple, Node> getObject = new Function<Triple, Node>()
- {
- @Override
- public Node apply(Triple t)
- {
- return t.getObject();
- }
- };
-
- @ContractTest
- public void testQuadRemove()
- {
- Graph g = producer.newInstance();
- txnBegin(g);
- assertEquals(0, g.size());
- txnRollback(g);
- Triple s = triple("x rdf:subject s");
- Triple p = triple("x rdf:predicate p");
- Triple o = triple("x rdf:object o");
- Triple t = triple("x rdf:type rdf:Statement");
- txnBegin(g);
- g.add(s);
- g.add(p);
- g.add(o);
- g.add(t);
- txnCommit(g);
- txnBegin(g);
- assertEquals(4, g.size());
- txnRollback(g);
- txnBegin(g);
- g.delete(s);
- g.delete(p);
- g.delete(o);
- g.delete(t);
- txnCommit(g);
- txnBegin(g);
- assertEquals(0, g.size());
- txnRollback(g);
- }
-
- @ContractTest
- public void testSizeAfterRemove()
- {
- Graph g = graphWith(producer.newInstance(), "x p y");
- try
- {
- txnBegin(g);
- ExtendedIterator<Triple> it = g.find(triple("x ?? ??"));
- txnRollback(g);
- it.removeNext();
- txnBegin(g);
- assertEquals(0, g.size());
- txnRollback(g);
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
- }
-
- @ContractTest
- public void testBrokenIndexes()
- {
- Graph g = graphWith(producer.newInstance(), "x R y; x S z");
- try
- {
- txnBegin(g);
- ExtendedIterator<Triple> it = g.find(Node.ANY, Node.ANY, Node.ANY);
- txnRollback(g);
- it.removeNext();
- it.removeNext();
- txnBegin(g);
- assertFalse(g.find(node("x"), Node.ANY, Node.ANY).hasNext());
- assertFalse(g.find(Node.ANY, node("R"), Node.ANY).hasNext());
- assertFalse(g.find(Node.ANY, Node.ANY, node("y")).hasNext());
- txnRollback(g);
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
- }
-
- @ContractTest
- public void testBrokenSubject()
- {
- Graph g = graphWith(producer.newInstance(), "x brokenSubject y");
- try
- {
- txnBegin(g);
- ExtendedIterator<Triple> it = g.find(node("x"), Node.ANY, Node.ANY);
- txnRollback(g);
- it.removeNext();
- txnBegin(g);
- assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
- txnRollback(g);
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
- }
-
- @ContractTest
- public void testBrokenPredicate()
- {
- Graph g = graphWith(producer.newInstance(), "x brokenPredicate y");
- try
- {
- txnBegin(g);
- ExtendedIterator<Triple> it = g.find(Node.ANY,
- node("brokenPredicate"), Node.ANY);
- txnRollback(g);
- it.removeNext();
- txnBegin(g);
- assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
- txnRollback(g);
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
- }
-
- @ContractTest
- public void testBrokenObject()
- {
- Graph g = graphWith(producer.newInstance(), "x brokenObject y");
-
- try
- {
- txnBegin(g);
- ExtendedIterator<Triple> it = g.find(Node.ANY, Node.ANY, node("y"));
- txnRollback(g);
- it.removeNext();
- txnBegin(g);
- assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
- txnRollback(g);
-
- } catch (UnsupportedOperationException e)
- {
- // No Iterator.remove
- }
-
- }
-
-}
diff --git a/jena-core/src/test/java/org/apache/jena/graph/compose/test/TestMultiUnion.java b/jena-core/src/test/java/org/apache/jena/graph/compose/test/TestMultiUnion.java
index ef8b3669a1..50d13c3565 100755
--- a/jena-core/src/test/java/org/apache/jena/graph/compose/test/TestMultiUnion.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/compose/test/TestMultiUnion.java
@@ -47,131 +47,129 @@ public class TestMultiUnion extends AbstractTestGraph
public TestMultiUnion( String s ) {
super( s );
}
-
+
// External signature methods
//////////////////////////////////
public static TestSuite suite()
- { return new TestSuite( TestMultiUnion.class ); }
-
+ { return new TestSuite( TestMultiUnion.class ); }
+
@Override
public Graph getNewGraph()
{
Graph gBase = graphWith( "" ), g1 = graphWith( "" );
- return new MultiUnion( new Graph[] {gBase, g1} );
+ return new MultiUnion( new Graph[] {gBase, g1} );
}
+
public void testEmptyGraph() {
Graph m = new MultiUnion();
- Graph g0 = graphWith( "x p y");
-
assertEquals( "Empty model should have size zero", 0, m.size() );
- assertFalse( "Empty model should not contain another graph", m.dependsOn( g0 ) );
}
-
+
public void testGraphSize1() {
Graph g0 = graphWith( "x p y" );
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
Graph g2 = graphWith( "x p y; z p a" ); // intersects with g1
-
+
Graph m01 = new MultiUnion( new Graph[] {g0, g1} );
Graph m10 = new MultiUnion( new Graph[] {g1, g0} );
Graph m12 = new MultiUnion( new Graph[] {g1, g2} );
Graph m21 = new MultiUnion( new Graph[] {g2, g1} );
Graph m02 = new MultiUnion( new Graph[] {g0, g2} );
Graph m20 = new MultiUnion( new Graph[] {g2, g0} );
-
+
Graph m00 = new MultiUnion( new Graph[] {g0, g0} );
-
+
int s0 = g0.size();
int s1 = g1.size();
int s2 = g2.size();
-
+
assertEquals( "Size of union of g0 and g1 not correct", s0+s1, m01.size() );
assertEquals( "Size of union of g1 and g0 not correct", s0+s1, m10.size() );
-
+
assertEquals( "Size of union of g1 and g2 not correct", s1+s2, m12.size() );
assertEquals( "Size of union of g2 and g1 not correct", s1+s2, m21.size() );
assertEquals( "Size of union of g0 and g2 not correct", s0+s2 - 1, m02.size() );
assertEquals( "Size of union of g2 and g0 not correct", s0+s2 - 1, m20.size() );
-
+
assertEquals( "Size of union of g0 with itself not correct", s0, m00.size() );
}
-
-
+
+
public void testGraphSize2() {
Graph g0 = graphWith( "x p y" );
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
Graph g2 = graphWith( "x p y; z p a" ); // intersects with g1
-
+
Graph m01 = new MultiUnion( iterateOver( g0, g1 ) );
Graph m10 = new MultiUnion( iterateOver( g1, g0 ) );
Graph m12 = new MultiUnion( iterateOver( g1, g2 ) );
Graph m21 = new MultiUnion( iterateOver( g2, g1 ) );
Graph m02 = new MultiUnion( iterateOver( g0, g2 ) );
Graph m20 = new MultiUnion( iterateOver( g2, g0 ) );
-
+
Graph m00 = new MultiUnion( iterateOver( g0, g0 ) );
-
+
int s0 = g0.size();
int s1 = g1.size();
int s2 = g2.size();
-
+
assertEquals( "Size of union of g0 and g1 not correct", s0+s1, m01.size() );
assertEquals( "Size of union of g1 and g0 not correct", s0+s1, m10.size() );
-
+
assertEquals( "Size of union of g1 and g2 not correct", s1+s2, m12.size() );
assertEquals( "Size of union of g2 and g1 not correct", s1+s2, m21.size() );
assertEquals( "Size of union of g0 and g2 not correct", s0+s2 - 1, m02.size() );
assertEquals( "Size of union of g2 and g0 not correct", s0+s2 - 1, m20.size() );
-
+
assertEquals( "Size of union of g0 with itself not correct", s0, m00.size() );
}
-
-
+
+
public void testGraphAddSize() {
Graph g0 = graphWith( "x p y" );
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
Graph g2 = graphWith( "x p y; z p a" ); // intersects with g1
-
+
int s0 = g0.size();
int s1 = g1.size();
int s2 = g2.size();
-
+
MultiUnion m0 = new MultiUnion( new Graph[] {g0} );
-
+
assertEquals( "Size of union of g0 not correct", s0, m0.size() );
m0.addGraph( g1 );
assertEquals( "Size of union of g1 and g0 not correct", s0+s1, m0.size() );
-
+
m0.addGraph( g2 );
assertEquals( "Size of union of g0, g1 and g2 not correct", s0+s1+s2 -1, m0.size() );
-
+
m0.removeGraph( g1 );
assertEquals( "Size of union of g0 and g2 not correct", s0+s2 -1, m0.size() );
-
+
m0.removeGraph( g0 );
assertEquals( "Size of union of g2 not correct", s2, m0.size() );
-
+
// remove again
m0.removeGraph( g0 );
assertEquals( "Size of union of g2 not correct", s2, m0.size() );
-
+
m0.removeGraph( g2 );
assertEquals( "Size of empty union not correct", 0, m0.size() );
-
+
}
-
-
+
+
public void testAdd() {
Graph g0 = graphWith( "x p y" );
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
Graph g2 = graphWith( "x p y; z p a" ); // intersects with g1
-
+
MultiUnion m = new MultiUnion( new Graph[] {g0, g1} );
-
+
int s0 = g0.size();
int s1 = g1.size();
int s2 = g2.size();
@@ -179,25 +177,25 @@ public class TestMultiUnion extends AbstractTestGraph
// add a triple to the union
m.add( triple( "a q b" ) );
-
+
assertEquals( "m.size should have increased by one", m0 + 1, m.size() );
assertEquals( "g0.size should have increased by one", s0 + 1, g0.size() );
assertEquals( "g1 size should be constant", s1, g1.size() );
-
+
// change the designated receiver and try again
m.setBaseGraph( g1 );
-
+
s0 = g0.size();
s1 = g1.size();
s2 = g2.size();
m0 = m.size();
-
+
m.add( triple( "a1 q b1" ));
assertEquals( "m.size should have increased by one", m0 + 1, m.size() );
assertEquals( "g0 size should be constant", s0, g0.size() );
assertEquals( "g1.size should have increased by one", s1 + 1, g1.size() );
-
+
// check that we can't make g2 the designated updater
boolean expected = false;
try {
@@ -208,16 +206,16 @@ public class TestMultiUnion extends AbstractTestGraph
}
assertTrue( "Should not have been able to make g2 the updater", expected );
}
-
-
+
+
public void testDelete() {
Graph g0 = graphWith( "x p y" );
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
-
+
MultiUnion m = new MultiUnion( new Graph[] {g0, g1} );
-
+
checkDeleteSizes( 1, 2, 3, g0, g1, m );
-
+
m.delete( triple( "x p y") );
checkDeleteSizes( 0, 2, 2, g0, g1, m );
@@ -232,44 +230,44 @@ public class TestMultiUnion extends AbstractTestGraph
m.delete( triple( "z p zz") );
checkDeleteSizes( 0, 0, 0, g0, g1, m );
}
-
-
+
+
public void testContains() {
Graph g0 = graphWith( "x p y" );
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
-
+
MultiUnion m = new MultiUnion( new Graph[] {g0, g1} );
-
- assertTrue( "m should contain triple", m.contains( triple( "x p y ")));
- assertTrue( "m should contain triple", m.contains( triple( "x p z ")));
- assertTrue( "m should contain triple", m.contains( triple( "z p zz ")));
-
- assertFalse( "m should not contain triple", m.contains( triple( "zz p z ")));
+
+ assertTrue( "m should contain triple", m.contains( triple( "x p y ")));
+ assertTrue( "m should contain triple", m.contains( triple( "x p z ")));
+ assertTrue( "m should contain triple", m.contains( triple( "z p zz ")));
+
+ assertFalse( "m should not contain triple", m.contains( triple( "zz p z ")));
}
-
-
+
+
/* Test using a model to wrap a multi union */
public void testModel() {
Graph g0 = graphWith( "x p y" );
MultiUnion u = new MultiUnion( new Graph[] {g0} );
-
+
Model m = ModelFactory.createModelForGraph( u );
-
+
assertEquals( "Model size not correct", 1, m.size() );
-
+
Graph g1 = graphWith( "x p z; z p zz" ); // disjoint with g0
- u.addGraph( g1 );
-
+ u.addGraph( g1 );
+
assertEquals( "Model size not correct", 3, m.size() );
-
+
// adds one more statement to the model
m.read( getFileName("ontology/list0.rdf") );
assertEquals( "Model size not correct", 4, m.size() );
-
+
// debug m.write( System.out );
}
-
-
+
+
// Internal implementation methods
//////////////////////////////////
@@ -278,7 +276,7 @@ public class TestMultiUnion extends AbstractTestGraph
assertEquals( "Delete check: g1 size", s1, g1.size() );
assertEquals( "Delete check: m size", m0, m.size() );
}
-
+
protected <T> Iterator<T> iterateOver( T x0 ) {
List<T> l = new ArrayList<>();
l.add( x0 );
@@ -297,9 +295,9 @@ public class TestMultiUnion extends AbstractTestGraph
l.add( x2 );
return l.iterator();
}
-
-
-
+
+
+
//==============================================================================
// Inner class definitions
//==============================================================================
diff --git a/jena-core/src/test/java/org/apache/jena/graph/impl/CollectionGraph_CS.java b/jena-core/src/test/java/org/apache/jena/graph/impl/CollectionGraph_CS.java
deleted file mode 100644
index f9e123c358..0000000000
--- a/jena-core/src/test/java/org/apache/jena/graph/impl/CollectionGraph_CS.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.graph.impl;
-
-import static org.apache.jena.testing_framework.GraphHelper.memGraph;
-
-import java.util.HashSet;
-
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.testing_framework.AbstractGraphProducer;
-import org.junit.runner.RunWith;
-import org.xenei.junit.contract.Contract;
-import org.xenei.junit.contract.ContractImpl;
-import org.xenei.junit.contract.ContractSuite;
-import org.xenei.junit.contract.IProducer;
-
-@SuppressWarnings("removal")
-@RunWith(ContractSuite.class)
-@ContractImpl(CollectionGraph.class)
-public class CollectionGraph_CS {
-
- protected IProducer<CollectionGraph> graphProducer;
-
- public CollectionGraph_CS() {
- graphProducer = new AbstractGraphProducer<CollectionGraph>() {
-
- @Override
- protected CollectionGraph createNewGraph() {
- return new CollectionGraph( new HashSet<Triple>() );
- }
-
- @Override
- public Graph[] getDependsOn(Graph d) {
- return null;
- }
-
- @Override
- public Graph[] getNotDependsOn(Graph g) {
- return new Graph[] { memGraph() };
- }
-
- };
- }
-
- @Contract.Inject
- public final IProducer<CollectionGraph> getCollectionTestProducer() {
- return graphProducer;
- }
-
-}
diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/FRuleEngineIFactoryTest.java b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/FRuleEngineIFactoryTest.java
index 29630f82ea..51b219aee9 100644
--- a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/FRuleEngineIFactoryTest.java
+++ b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/FRuleEngineIFactoryTest.java
@@ -127,6 +127,7 @@ public class FRuleEngineIFactoryTest extends TestCase {
@Override
public Iterator<Derivation> getDerivation(Triple triple) { return null; }
+ @SuppressWarnings("removal")
@Override
public boolean dependsOn(Graph other) { return false; }
diff --git a/jena-examples/src/main/java/arq/examples/riot/ExRIOT5_StreamRDFCollect.java b/jena-examples/src/main/java/arq/examples/riot/ExRIOT5_StreamRDFCollect.java
index 97b1ecf39b..df76cd4054 100644
--- a/jena-examples/src/main/java/arq/examples/riot/ExRIOT5_StreamRDFCollect.java
+++ b/jena-examples/src/main/java/arq/examples/riot/ExRIOT5_StreamRDFCollect.java
@@ -28,8 +28,6 @@ import org.apache.jena.riot.lang.CollectorStreamRDF;
* Suitable for single-threaded parsing, for use with small data or distributed
* computing frameworks (e.g. Hadoop) where the overhead of creating many threads
* is significant.
- *
- * @see CollectorStreamBase
*/
public class ExRIOT5_StreamRDFCollect {
diff --git a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderExampleTests.java b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderExampleTests.java
index 2834e6ea15..b53b3818f7 100644
--- a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderExampleTests.java
+++ b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderExampleTests.java
@@ -24,20 +24,12 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.jena.datatypes.xsd.XSDDatatype;
-import org.apache.jena.graph.Graph;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.graph.Triple;
-import org.apache.jena.graph.impl.CollectionGraph;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.DatasetFactory;
-import org.apache.jena.rdf.model.Literal;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Property;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.ResourceFactory;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.sparql.vocabulary.FOAF;
import org.apache.jena.update.UpdateAction;
import org.apache.jena.update.UpdateRequest;
@@ -59,13 +51,11 @@ public class UpdateBuilderExampleTests {
private static final String NS_prefix = "http://example.org/ns#";
private List<Triple> triples;
- private Graph g;
private Model m;
public UpdateBuilderExampleTests() {
triples = new ArrayList<Triple>();
- g = new CollectionGraph(triples);
- m = ModelFactory.createModelForGraph(g);
+ m = ModelFactory.createDefaultModel();
}
@Before
diff --git a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderTest.java b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderTest.java
index 6856651b2a..fcdfb9de39 100644
--- a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderTest.java
+++ b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderTest.java
@@ -24,17 +24,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.apache.jena.graph.Graph;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.graph.Triple;
-import org.apache.jena.graph.impl.CollectionGraph;
-import org.apache.jena.rdf.model.Literal;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Property;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.ResourceFactory;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.sparql.core.Quad;
import org.apache.jena.sparql.core.Var;
import org.apache.jena.sparql.modify.request.UpdateDataDelete;
@@ -66,7 +59,7 @@ public class UpdateBuilderTest {
builder.addWhere( s, "ex:predicat2", "?o" );
builder.build();
}
-
+
@Test
public void testInsert_SPO() {
UpdateBuilder builder = new UpdateBuilder();
@@ -495,34 +488,34 @@ public class UpdateBuilderTest {
/*
* Example 1: Adding some triples to a graph
-
+
This snippet describes two RDF triples to be inserted into the default graph of the Graph Store.
-
+
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA
{
<http://example/book1> dc:title "A new book" ;
dc:creator "A.N.Other" .
}
-
+
Data before:
-
+
# Default graph
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ns: <http://example.org/ns#> .
-
+
<http://example/book1> ns:price 42 .
-
+
Data after:
-
+
# Default graph
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ns: <http://example.org/ns#> .
-
+
<http://example/book1> ns:price 42 .
<http://example/book1> dc:title "A new book" .
<http://example/book1> dc:creator "A.N.Other" .
-
+
*/
@Test
public void example1() {
@@ -534,8 +527,7 @@ public class UpdateBuilderTest {
List<Triple> triples = new ArrayList<Triple>();
triples.add(Triple.create(n, priceN, priceV));
- Graph g = new CollectionGraph(triples);
- Model m = ModelFactory.createModelForGraph(g);
+ Model m = ModelFactory.createDefaultModel();
m.setNsPrefix("dc", DC_11.NS);
m.setNsPrefix("ns", "http://example.org/ns#");
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
index 8b530c0304..7551baa124 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
@@ -170,6 +170,7 @@ public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph {
* @throws AuthenticationRequiredException if user is not authenticated and is
* required to be.
*/
+ @SuppressWarnings("removal")
@Override
public boolean dependsOn(final Graph other) throws ReadDeniedException, AuthenticationRequiredException {
if (checkSoftRead()) {
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementTermImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementTermImpl.java
index fac6f7afc4..9712b50af5 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementTermImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementTermImpl.java
@@ -29,8 +29,8 @@ public class SecuredStatementTermImpl extends SecuredRDFNodeImpl implements Secu
/**
* get a SecuredStatement
*
- * @param securedModel The secured model that provides the security context
- * @param stmt The statement to secure.
+ * @param securedModel The secured model that provides the security context
+ * @param stmtTerm The statement term to secure.
* @return the SecuredStatement
*/
public static SecuredStatementTerm getInstance(final SecuredModel securedModel, final StatementTerm stmtTerm) {
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/graph/MemGraphTest.java b/jena-permissions/src/test/java/org/apache/jena/permissions/graph/MemGraphTest.java
index 41fdb44c28..5b38d26432 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/graph/MemGraphTest.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/graph/MemGraphTest.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -139,6 +139,7 @@ public class MemGraphTest {
}
}
+ @SuppressWarnings("removal")
@Test
public void testDependsOn() throws Exception {
try {