Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 37B07200BC2 for ; Thu, 17 Nov 2016 15:48:26 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 36767160AFF; Thu, 17 Nov 2016 14:48:26 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E0E79160B0B for ; Thu, 17 Nov 2016 15:48:23 +0100 (CET) Received: (qmail 4343 invoked by uid 500); 17 Nov 2016 14:48:23 -0000 Mailing-List: contact commits-help@commonsrdf.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commonsrdf.incubator.apache.org Delivered-To: mailing list commits@commonsrdf.incubator.apache.org Received: (qmail 4334 invoked by uid 99); 17 Nov 2016 14:48:23 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2016 14:48:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 81B76C0414 for ; Thu, 17 Nov 2016 14:48:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.198 X-Spam-Level: X-Spam-Status: No, score=-1.198 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id IfNlw8lMFD4P for ; Thu, 17 Nov 2016 14:48:17 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 160F15FD66 for ; Thu, 17 Nov 2016 14:48:16 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 43BE6E8EA7 for ; Thu, 17 Nov 2016 14:48:14 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id EC15E3A3AC0 for ; Thu, 17 Nov 2016 14:48:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1001279 [12/16] - in /websites/production/commonsrdf/content/commons-rdf-api: ./ apidocs/ apidocs/org/apache/commons/rdf/api/ apidocs/org/apache/commons/rdf/api/class-use/ apidocs/org/apache/commons/rdf/experimental/ apidocs/org/apache/com... Date: Thu, 17 Nov 2016 14:48:12 -0000 To: commits@commonsrdf.incubator.apache.org From: stain@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161117144813.EC15E3A3AC0@svn01-us-west.apache.org> archived-at: Thu, 17 Nov 2016 14:48:26 -0000 Modified: websites/production/commonsrdf/content/commons-rdf-api/xref-test/org/apache/commons/rdf/api/AbstractDatasetTest.html ============================================================================== --- websites/production/commonsrdf/content/commons-rdf-api/xref-test/org/apache/commons/rdf/api/AbstractDatasetTest.html (original) +++ websites/production/commonsrdf/content/commons-rdf-api/xref-test/org/apache/commons/rdf/api/AbstractDatasetTest.html Thu Nov 17 14:48:10 2016 @@ -137,8 +137,8 @@ 129 @Test 130 public void iterate() throws Exception { 131 Assume.assumeTrue(dataset.size() > 0); -132 List<Quad> quads = new ArrayList<>(); -133 for (Quad t : dataset.iterate()) { +132 final List<Quad> quads = new ArrayList<>(); +133 for (final Quad t : dataset.iterate()) { 134 quads.add(t); 135 } 136 assertEquals(dataset.size(), quads.size()); @@ -146,12 +146,12 @@ 138 //assertTrue(quads.contains(bobNameQuad)); 139 // java.util.List won't do any BlankNode mapping, so 140 // instead bobNameQuad of let's check for an IRI-centric quad -141 Quad q = factory.createQuad(graph1, alice, name, aliceName); +141 final Quad q = factory.createQuad(graph1, alice, name, aliceName); 142 quads.contains(q); 143 144 // aborted iteration -145 Iterable<Quad> iterate = dataset.iterate(); -146 Iterator<Quad> it = iterate.iterator(); +145 final Iterable<Quad> iterate = dataset.iterate(); +146 final Iterator<Quad> it = iterate.iterator(); 147 148 assertTrue(it.hasNext()); 149 it.next(); @@ -160,8 +160,8 @@ 152 // second iteration - should start from fresh and 153 // get the same count 154 long count = 0; -155 Iterable<Quad> iterable = dataset.iterate(); -156 for (@SuppressWarnings("unused") +155 final Iterable<Quad> iterable = dataset.iterate(); +156 for (@SuppressWarnings("unused") final 157 Quad t : iterable) { 158 count++; 159 } @@ -171,7 +171,7 @@ 163 /** 164 * Special quad closing for RDF4J. 165 */ -166 private void closeIterable(Iterable<Quad> iterate) throws Exception { +166 private void closeIterable(final Iterable<Quad> iterate) throws Exception { 167 if (iterate instanceof AutoCloseable) { 168 ((AutoCloseable) iterate).close(); 169 } @@ -179,18 +179,18 @@ 171 172 @Test 173 public void iterateFilter() throws Exception { -174 List<RDFTerm> friends = new ArrayList<>(); -175 IRI alice = factory.createIRI("http://example.com/alice"); -176 IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); -177 for (Quad t : dataset.iterate(null, alice, knows, null)) { +174 final List<RDFTerm> friends = new ArrayList<>(); +175 final IRI alice = factory.createIRI("http://example.com/alice"); +176 final IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); +177 for (final Quad t : dataset.iterate(null, alice, knows, null)) { 178 friends.add(t.getObject()); 179 } 180 assertEquals(1, friends.size()); 181 assertEquals(bob, friends.get(0)); 182 183 // .. can we iterate over zero hits? -184 Iterable<Quad> iterate = dataset.iterate(Optional.of(graph2), bob, knows, alice); -185 for (Quad unexpected : iterate) { +184 final Iterable<Quad> iterate = dataset.iterate(Optional.of(graph2), bob, knows, alice); +185 for (final Quad unexpected : iterate) { 186 fail("Unexpected quad " + unexpected); 187 } 188 // closeIterable(iterate); @@ -203,26 +203,26 @@ 195 assertTrue(dataset.contains(Optional.of(graph1), alice, knows, bob)); 196 197 try (Stream<? extends Quad> stream = dataset.stream()) { -198 Optional<? extends Quad> first = stream.skip(4).findFirst(); +198 final Optional<? extends Quad> first = stream.skip(4).findFirst(); 199 Assume.assumeTrue(first.isPresent()); -200 Quad existingQuad = first.get(); +200 final Quad existingQuad = first.get(); 201 assertTrue(dataset.contains(existingQuad)); 202 } 203 -204 Quad nonExistingQuad = factory.createQuad(graph2, bob, knows, alice); +204 final Quad nonExistingQuad = factory.createQuad(graph2, bob, knows, alice); 205 assertFalse(dataset.contains(nonExistingQuad)); 206 207 // An existing quad -208 Quad quad = factory.createQuad(graph1, alice, knows, bob); +208 final Quad quad = factory.createQuad(graph1, alice, knows, bob); 209 // FIXME: Should not this always be true? 210 assertTrue(dataset.contains(quad)); 211 } 212 213 @Test 214 public void remove() throws Exception { -215 long fullSize = dataset.size(); +215 final long fullSize = dataset.size(); 216 dataset.remove(Optional.of(graph1), alice, knows, bob); -217 long shrunkSize = dataset.size(); +217 final long shrunkSize = dataset.size(); 218 assertEquals(1, fullSize - shrunkSize); 219 220 dataset.remove(Optional.of(graph1), alice, knows, bob); @@ -241,7 +241,7 @@ 233 234 Quad otherQuad; 235 try (Stream<? extends Quad> stream = dataset.stream()) { -236 Optional<? extends Quad> anyQuad = stream.findAny(); +236 final Optional<? extends Quad> anyQuad = stream.findAny(); 237 Assume.assumeTrue(anyQuad.isPresent()); 238 otherQuad = anyQuad.get(); 239 } @@ -289,7 +289,7 @@ 281 public void getQuadsQuery() throws Exception { 282 283 try (Stream<? extends Quad> stream = dataset.stream(Optional.of(graph1), alice, null, null)) { -284 long aliceCount = stream.count(); +284 final long aliceCount = stream.count(); 285 assertTrue(aliceCount > 0); 286 Assume.assumeNotNull(aliceName); 287 assertEquals(3, aliceCount); @@ -308,11 +308,11 @@ 300 @Test 301 public void addBlankNodesFromMultipleDatasets() { 302 // Create two separate Dataset instances -303 Dataset g1 = createDataset1(); -304 Dataset g2 = createDataset2(); +303 final Dataset g1 = createDataset1(); +304 final Dataset g2 = createDataset2(); 305 306 // and add them to a new Dataset g3 -307 Dataset g3 = factory.createDataset(); +307 final Dataset g3 = factory.createDataset(); 308 addAllQuads(g1, g3); 309 addAllQuads(g2, g3); 310 @@ -327,22 +327,22 @@ 319 // HashMap!) 320 321 // look up BlankNodes by name -322 IRI name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); +322 final IRI name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); 323 try (Stream<? extends Quad> stream = g3.stream(null, null, name, null)) { 324 stream.parallel().forEach(t -> whoIsWho.put(t.getObject().ntriplesString(), t.getSubject())); 325 } 326 327 assertEquals(4, whoIsWho.size()); 328 // and contains 4 unique values -329 assertEquals(4, new HashSet<BlankNodeOrIRI>(whoIsWho.values()).size()); +329 assertEquals(4, new HashSet<>(whoIsWho.values()).size()); 330 -331 BlankNodeOrIRI b1Alice = whoIsWho.get("\"Alice\""); +331 final BlankNodeOrIRI b1Alice = whoIsWho.get("\"Alice\""); 332 assertNotNull(b1Alice); -333 BlankNodeOrIRI b2Bob = whoIsWho.get("\"Bob\""); +333 final BlankNodeOrIRI b2Bob = whoIsWho.get("\"Bob\""); 334 assertNotNull(b2Bob); -335 BlankNodeOrIRI b1Charlie = whoIsWho.get("\"Charlie\""); +335 final BlankNodeOrIRI b1Charlie = whoIsWho.get("\"Charlie\""); 336 assertNotNull(b1Charlie); -337 BlankNodeOrIRI b2Dave = whoIsWho.get("\"Dave\""); +337 final BlankNodeOrIRI b2Dave = whoIsWho.get("\"Dave\""); 338 assertNotNull(b2Dave); 339 340 // All blank nodes should differ @@ -355,7 +355,7 @@ 347 348 // And we should be able to query with them again 349 // as we got them back from g3 -350 IRI hasChild = factory.createIRI("http://example.com/hasChild"); +350 final IRI hasChild = factory.createIRI("http://example.com/hasChild"); 351 // FIXME: Check graph2 BlankNode in these ..? 352 assertTrue(g3.contains(null, b1Alice, hasChild, b2Bob)); 353 assertTrue(g3.contains(null, b2Dave, hasChild, b1Charlie)); @@ -372,7 +372,7 @@ 364 assertFalse(g3.contains(null, b1Charlie, hasChild, null)); 365 } 366 -367 private void notEquals(BlankNodeOrIRI node1, BlankNodeOrIRI node2) { +367 private void notEquals(final BlankNodeOrIRI node1, final BlankNodeOrIRI node2) { 368 assertFalse(node1.equals(node2)); 369 // in which case we should be able to assume 370 // (as they are in the same dataset) @@ -390,7 +390,7 @@ 382 * @param target 383 * Target Dataset where quads will be added 384 */ -385 private void addAllQuads(Dataset source, Dataset target) { +385 private void addAllQuads(final Dataset source, final Dataset target) { 386 387 // unordered() as we don't need to preserve quad order 388 // sequential() as we don't (currently) require target Dataset to be @@ -406,17 +406,17 @@ 398 * uniqueReference 399 */ 400 private Dataset createDataset1() { -401 RDF factory1 = createFactory(); +401 final RDF factory1 = createFactory(); 402 -403 IRI name = factory1.createIRI("http://xmlns.com/foaf/0.1/name"); -404 Dataset g1 = factory1.createDataset(); -405 BlankNode b1 = createOwnBlankNode("b1", "0240eaaa-d33e-4fc0-a4f1-169d6ced3680"); +403 final IRI name = factory1.createIRI("http://xmlns.com/foaf/0.1/name"); +404 final Dataset g1 = factory1.createDataset(); +405 final BlankNode b1 = createOwnBlankNode("b1", "0240eaaa-d33e-4fc0-a4f1-169d6ced3680"); 406 g1.add(b1, b1, name, factory1.createLiteral("Alice")); 407 -408 BlankNode b2 = createOwnBlankNode("b2", "9de7db45-0ce7-4b0f-a1ce-c9680ffcfd9f"); +408 final BlankNode b2 = createOwnBlankNode("b2", "9de7db45-0ce7-4b0f-a1ce-c9680ffcfd9f"); 409 g1.add(b2, b2, name, factory1.createLiteral("Bob")); 410 -411 IRI hasChild = factory1.createIRI("http://example.com/hasChild"); +411 final IRI hasChild = factory1.createIRI("http://example.com/hasChild"); 412 g1.add(null, b1, hasChild, b2); 413 414 return g1; @@ -430,7 +430,7 @@ 422 * @param name 423 * @return 424 */ -425 private BlankNode createOwnBlankNode(String name, String uuid) { +425 private BlankNode createOwnBlankNode(final String name, final String uuid) { 426 return new BlankNode() { 427 @Override 428 public String ntriplesString() { @@ -448,29 +448,29 @@ 440 } 441 442 @Override -443 public boolean equals(Object obj) { +443 public boolean equals(final Object obj) { 444 if (!(obj instanceof BlankNode)) { 445 return false; 446 } -447 BlankNode other = (BlankNode) obj; +447 final BlankNode other = (BlankNode) obj; 448 return uuid.equals(other.uniqueReference()); 449 } 450 }; 451 } 452 453 private Dataset createDataset2() { -454 RDF factory2 = createFactory(); -455 IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); +454 final RDF factory2 = createFactory(); +455 final IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); 456 -457 Dataset g2 = factory2.createDataset(); +457 final Dataset g2 = factory2.createDataset(); 458 -459 BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); +459 final BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); 460 g2.add(b1, b1, name, factory2.createLiteral("Charlie")); 461 -462 BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); +462 final BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); 463 g2.add(b2, b2, name, factory2.createLiteral("Dave")); 464 -465 IRI hasChild = factory2.createIRI("http://example.com/hasChild"); +465 final IRI hasChild = factory2.createIRI("http://example.com/hasChild"); 466 // NOTE: Opposite direction of loadDataset1 467 g2.add(b2, b2, hasChild, b1); 468 return g2; @@ -484,11 +484,11 @@ 476 */ 477 @Test 478 public void getGraphNames() throws Exception { -479 Set<BlankNodeOrIRI> names = dataset.getGraphNames().collect(Collectors.toSet()); +479 final Set<BlankNodeOrIRI> names = dataset.getGraphNames().collect(Collectors.toSet()); 480 assertTrue("Can't find graph name " + graph1, names.contains(graph1)); 481 assertTrue("Found no quads in graph1", dataset.contains(Optional.of(graph1), null, null, null)); 482 -483 Optional<BlankNodeOrIRI> graphName2 = dataset.getGraphNames().filter(BlankNode.class::isInstance).findAny(); +483 final Optional<BlankNodeOrIRI> graphName2 = dataset.getGraphNames().filter(BlankNode.class::isInstance).findAny(); 484 assertTrue("Could not find graph2-like BlankNode", graphName2.isPresent()); 485 assertTrue("Found no quads in graph2", dataset.contains(graphName2, null, null, null)); 486 @@ -499,7 +499,7 @@ 491 492 @Test 493 public void getGraph() throws Exception { -494 Graph defaultGraph = dataset.getGraph(); +494 final Graph defaultGraph = dataset.getGraph(); 495 // TODO: Can we assume the default graph was empty before our new triples? 496 assertEquals(2, defaultGraph.size()); 497 assertTrue(defaultGraph.contains(alice, isPrimaryTopicOf, graph1)); @@ -511,7 +511,7 @@ 503 @Test 504 public void getGraphNull() throws Exception { 505 // Default graph should be present -506 Graph defaultGraph = dataset.getGraph(null).get(); +506 final Graph defaultGraph = dataset.getGraph(null).get(); 507 // TODO: Can we assume the default graph was empty before our new triples? 508 assertEquals(2, defaultGraph.size()); 509 assertTrue(defaultGraph.contains(alice, isPrimaryTopicOf, graph1)); @@ -523,7 +523,7 @@ 515 @Test 516 public void getGraph1() throws Exception { 517 // graph1 should be present -518 Graph g1 = dataset.getGraph(graph1).get(); +518 final Graph g1 = dataset.getGraph(graph1).get(); 519 assertEquals(4, g1.size()); 520 521 assertTrue(g1.contains(alice, name, aliceName)); @@ -536,12 +536,12 @@ 528 public void getGraph2() throws Exception { 529 // graph2 should be present, even if is named by a BlankNode 530 // We'll look up the potentially mapped graph2 blanknode -531 BlankNodeOrIRI graph2Name = (BlankNodeOrIRI) dataset.stream(Optional.empty(), bob, isPrimaryTopicOf, null) +531 final BlankNodeOrIRI graph2Name = (BlankNodeOrIRI) dataset.stream(Optional.empty(), bob, isPrimaryTopicOf, null) 532 .map(Quad::getObject).findAny().get(); 533 -534 Graph g2 = dataset.getGraph(graph2Name).get(); +534 final Graph g2 = dataset.getGraph(graph2Name).get(); 535 assertEquals(4, g2.size()); -536 Triple bobNameTriple = bobNameQuad.asTriple(); +536 final Triple bobNameTriple = bobNameQuad.asTriple(); 537 assertTrue(g2.contains(bobNameTriple)); 538 assertTrue(g2.contains(bob, member, bnode1)); 539 assertTrue(g2.contains(bob, member, bnode2)); @@ -604,4 +604,4 @@
- + \ No newline at end of file Modified: websites/production/commonsrdf/content/commons-rdf-api/xref-test/org/apache/commons/rdf/api/AbstractGraphTest.html ============================================================================== --- websites/production/commonsrdf/content/commons-rdf-api/xref-test/org/apache/commons/rdf/api/AbstractGraphTest.html (original) +++ websites/production/commonsrdf/content/commons-rdf-api/xref-test/org/apache/commons/rdf/api/AbstractGraphTest.html Thu Nov 17 14:48:10 2016 @@ -98,7 +98,7 @@ 90 try { 91 bnode1 = factory.createBlankNode("org1"); 92 bnode2 = factory.createBlankNode("org2"); -93 } catch (UnsupportedOperationException ex) { +93 } catch (final UnsupportedOperationException ex) { 94 // leave as null 95 } 96 @@ -107,7 +107,7 @@ 99 companyName = factory.createLiteral("A company"); 100 aliceName = factory.createLiteral("Alice"); 101 bobName = factory.createLiteral("Bob", "en-US"); -102 } catch (UnsupportedOperationException ex) { +102 } catch (final UnsupportedOperationException ex) { 103 // leave as null 104 } 105 @@ -123,7 +123,7 @@ 115 if (bobName != null) { 116 try { 117 bobNameTriple = factory.createTriple(bob, name, bobName); -118 } catch (UnsupportedOperationException ex) { +118 } catch (final UnsupportedOperationException ex) { 119 // leave as null 120 } 121 if (bobNameTriple != null) { @@ -153,8 +153,8 @@ 145 146 Assume.assumeTrue(graph.size() > 0); 147 -148 List<Triple> triples = new ArrayList<>(); -149 for (Triple t : graph.iterate()) { +148 final List<Triple> triples = new ArrayList<>(); +149 for (final Triple t : graph.iterate()) { 150 triples.add(t); 151 } 152 assertEquals(graph.size(), triples.size()); @@ -163,8 +163,8 @@ 155 } 156 157 // aborted iteration -158 Iterable<Triple> iterate = graph.iterate(); -159 Iterator<Triple> it = iterate.iterator(); +158 final Iterable<Triple> iterate = graph.iterate(); +159 final Iterator<Triple> it = iterate.iterator(); 160 161 assertTrue(it.hasNext()); 162 it.next(); @@ -173,8 +173,8 @@ 165 // second iteration - should start from fresh and 166 // get the same count 167 long count = 0; -168 Iterable<Triple> iterable = graph.iterate(); -169 for (@SuppressWarnings("unused") +168 final Iterable<Triple> iterable = graph.iterate(); +169 for (@SuppressWarnings("unused") final 170 Triple t : iterable) { 171 count++; 172 } @@ -184,7 +184,7 @@ 176 /** 177 * Special triple closing for RDF4J. 178 */ -179 private void closeIterable(Iterable<Triple> iterate) throws Exception { +179 private void closeIterable(final Iterable<Triple> iterate) throws Exception { 180 if (iterate instanceof AutoCloseable) { 181 ((AutoCloseable) iterate).close(); 182 } @@ -192,18 +192,18 @@ 184 185 @Test 186 public void iterateFilter() throws Exception { -187 List<RDFTerm> friends = new ArrayList<>(); -188 IRI alice = factory.createIRI("http://example.com/alice"); -189 IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); -190 for (Triple t : graph.iterate(alice, knows, null)) { +187 final List<RDFTerm> friends = new ArrayList<>(); +188 final IRI alice = factory.createIRI("http://example.com/alice"); +189 final IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); +190 for (final Triple t : graph.iterate(alice, knows, null)) { 191 friends.add(t.getObject()); 192 } 193 assertEquals(1, friends.size()); 194 assertEquals(bob, friends.get(0)); 195 196 // .. can we iterate over zero hits? -197 Iterable<Triple> iterate = graph.iterate(bob, knows, alice); -198 for (Triple unexpected : iterate) { +197 final Iterable<Triple> iterate = graph.iterate(bob, knows, alice); +198 for (final Triple unexpected : iterate) { 199 fail("Unexpected triple " + unexpected); 200 } 201 // closeIterable(iterate); @@ -216,19 +216,19 @@ 208 assertTrue(graph.contains(alice, knows, bob)); 209 210 try (Stream<? extends Triple> stream = graph.stream()) { -211 Optional<? extends Triple> first = stream.skip(4).findFirst(); +211 final Optional<? extends Triple> first = stream.skip(4).findFirst(); 212 Assume.assumeTrue(first.isPresent()); -213 Triple existingTriple = first.get(); +213 final Triple existingTriple = first.get(); 214 assertTrue(graph.contains(existingTriple)); 215 } 216 -217 Triple nonExistingTriple = factory.createTriple(bob, knows, alice); +217 final Triple nonExistingTriple = factory.createTriple(bob, knows, alice); 218 assertFalse(graph.contains(nonExistingTriple)); 219 220 Triple triple = null; 221 try { 222 triple = factory.createTriple(alice, knows, bob); -223 } catch (UnsupportedOperationException ex) { +223 } catch (final UnsupportedOperationException ex) { 224 } 225 if (triple != null) { 226 // FIXME: Should not this always be true? @@ -238,9 +238,9 @@ 230 231 @Test 232 public void remove() throws Exception { -233 long fullSize = graph.size(); +233 final long fullSize = graph.size(); 234 graph.remove(alice, knows, bob); -235 long shrunkSize = graph.size(); +235 final long shrunkSize = graph.size(); 236 assertEquals(1, fullSize - shrunkSize); 237 238 graph.remove(alice, knows, bob); @@ -259,7 +259,7 @@ 251 252 Triple otherTriple; 253 try (Stream<? extends Triple> stream = graph.stream()) { -254 Optional<? extends Triple> anyTriple = stream.findAny(); +254 final Optional<? extends Triple> anyTriple = stream.findAny(); 255 Assume.assumeTrue(anyTriple.isPresent()); 256 otherTriple = anyTriple.get(); 257 } @@ -306,7 +306,7 @@ 298 public void getTriplesQuery() throws Exception { 299 300 try (Stream<? extends Triple> stream = graph.stream(alice, null, null)) { -301 long aliceCount = stream.count(); +301 final long aliceCount = stream.count(); 302 assertTrue(aliceCount > 0); 303 Assume.assumeNotNull(aliceName); 304 assertEquals(3, aliceCount); @@ -327,11 +327,11 @@ 319 320 try { 321 // Create two separate Graph instances -322 Graph g1 = createGraph1(); -323 Graph g2 = createGraph2(); +322 final Graph g1 = createGraph1(); +323 final Graph g2 = createGraph2(); 324 325 // and add them to a new Graph g3 -326 Graph g3 = factory.createGraph(); +326 final Graph g3 = factory.createGraph(); 327 addAllTriples(g1, g3); 328 addAllTriples(g2, g3); 329 @@ -346,22 +346,22 @@ 338 // HashMap!) 339 340 // look up BlankNodes by name -341 IRI name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); +341 final IRI name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); 342 try (Stream<? extends Triple> stream = g3.stream(null, name, null)) { 343 stream.parallel().forEach(t -> whoIsWho.put(t.getObject().ntriplesString(), t.getSubject())); 344 } 345 346 assertEquals(4, whoIsWho.size()); 347 // and contains 4 unique values -348 assertEquals(4, new HashSet<BlankNodeOrIRI>(whoIsWho.values()).size()); +348 assertEquals(4, new HashSet<>(whoIsWho.values()).size()); 349 -350 BlankNodeOrIRI b1Alice = whoIsWho.get("\"Alice\""); +350 final BlankNodeOrIRI b1Alice = whoIsWho.get("\"Alice\""); 351 assertNotNull(b1Alice); -352 BlankNodeOrIRI b2Bob = whoIsWho.get("\"Bob\""); +352 final BlankNodeOrIRI b2Bob = whoIsWho.get("\"Bob\""); 353 assertNotNull(b2Bob); -354 BlankNodeOrIRI b1Charlie = whoIsWho.get("\"Charlie\""); +354 final BlankNodeOrIRI b1Charlie = whoIsWho.get("\"Charlie\""); 355 assertNotNull(b1Charlie); -356 BlankNodeOrIRI b2Dave = whoIsWho.get("\"Dave\""); +356 final BlankNodeOrIRI b2Dave = whoIsWho.get("\"Dave\""); 357 assertNotNull(b2Dave); 358 359 // All blank nodes should differ @@ -374,7 +374,7 @@ 366 367 // And we should be able to query with them again 368 // as we got them back from g3 -369 IRI hasChild = factory.createIRI("http://example.com/hasChild"); +369 final IRI hasChild = factory.createIRI("http://example.com/hasChild"); 370 assertTrue(g3.contains(b1Alice, hasChild, b2Bob)); 371 assertTrue(g3.contains(b2Dave, hasChild, b1Charlie)); 372 // But not @@ -388,12 +388,12 @@ 380 // and these don't have any children (as far as we know) 381 assertFalse(g3.contains(b2Bob, hasChild, null)); 382 assertFalse(g3.contains(b1Charlie, hasChild, null)); -383 } catch (UnsupportedOperationException ex) { +383 } catch (final UnsupportedOperationException ex) { 384 Assume.assumeNoException(ex); 385 } 386 } 387 -388 private void notEquals(BlankNodeOrIRI node1, BlankNodeOrIRI node2) { +388 private void notEquals(final BlankNodeOrIRI node1, final BlankNodeOrIRI node2) { 389 assertFalse(node1.equals(node2)); 390 // in which case we should be able to assume 391 // (as they are in the same graph) @@ -411,7 +411,7 @@ 403 * @param target 404 * Target Graph where triples will be added 405 */ -406 private void addAllTriples(Graph source, Graph target) { +406 private void addAllTriples(final Graph source, final Graph target) { 407 408 // unordered() as we don't need to preserve triple order 409 // sequential() as we don't (currently) require target Graph to be @@ -427,17 +427,17 @@ 419 * uniqueReference 420 */ 421 private Graph createGraph1() { -422 RDF factory1 = createFactory(); +422 final RDF factory1 = createFactory(); 423 -424 IRI name = factory1.createIRI("http://xmlns.com/foaf/0.1/name"); -425 Graph g1 = factory1.createGraph(); -426 BlankNode b1 = createOwnBlankNode("b1", "0240eaaa-d33e-4fc0-a4f1-169d6ced3680"); +424 final IRI name = factory1.createIRI("http://xmlns.com/foaf/0.1/name"); +425 final Graph g1 = factory1.createGraph(); +426 final BlankNode b1 = createOwnBlankNode("b1", "0240eaaa-d33e-4fc0-a4f1-169d6ced3680"); 427 g1.add(b1, name, factory1.createLiteral("Alice")); 428 -429 BlankNode b2 = createOwnBlankNode("b2", "9de7db45-0ce7-4b0f-a1ce-c9680ffcfd9f"); +429 final BlankNode b2 = createOwnBlankNode("b2", "9de7db45-0ce7-4b0f-a1ce-c9680ffcfd9f"); 430 g1.add(b2, name, factory1.createLiteral("Bob")); 431 -432 IRI hasChild = factory1.createIRI("http://example.com/hasChild"); +432 final IRI hasChild = factory1.createIRI("http://example.com/hasChild"); 433 g1.add(b1, hasChild, b2); 434 435 return g1; @@ -451,7 +451,7 @@ 443 * @param name 444 * @return 445 */ -446 private BlankNode createOwnBlankNode(String name, String uuid) { +446 private BlankNode createOwnBlankNode(final String name, final String uuid) { 447 return new BlankNode() { 448 @Override 449 public String ntriplesString() { @@ -469,29 +469,29 @@ 461 } 462 463 @Override -464 public boolean equals(Object obj) { +464 public boolean equals(final Object obj) { 465 if (!(obj instanceof BlankNode)) { 466 return false; 467 } -468 BlankNode other = (BlankNode) obj; +468 final BlankNode other = (BlankNode) obj; 469 return uuid.equals(other.uniqueReference()); 470 } 471 }; 472 } 473 474 private Graph createGraph2() { -475 RDF factory2 = createFactory(); -476 IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); +475 final RDF factory2 = createFactory(); +476 final IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); 477 -478 Graph g2 = factory2.createGraph(); +478 final Graph g2 = factory2.createGraph(); 479 -480 BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); +480 final BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); 481 g2.add(b1, name, factory2.createLiteral("Charlie")); 482 -483 BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); +483 final BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); 484 g2.add(b2, name, factory2.createLiteral("Dave")); 485 -486 IRI hasChild = factory2.createIRI("http://example.com/hasChild"); +486 final IRI hasChild = factory2.createIRI("http://example.com/hasChild"); 487 // NOTE: Opposite direction of loadGraph1 488 g2.add(b2, hasChild, b1); 489 return g2; @@ -550,4 +550,4 @@
- + \ No newline at end of file