@Override public Evaluation evaluate(Path path) { if (path.length() < length) { return Evaluation.EXCLUDE_AND_CONTINUE; } Node lastNode = path.endNode(); if (!lastNode.hasLabel(Labels.AirportDay)) { return Evaluation.EXCLUDE_AND_CONTINUE; } else if (destinations.contains(((String) lastNode.getProperty("key")).substring(0, 3))) { return Evaluation.INCLUDE_AND_PRUNE; } return Evaluation.EXCLUDE_AND_PRUNE; }
@Override public Vertex v(final Object id) { this.tx().readWrite(); if (null == id) throw Graph.Exceptions.elementNotFound(Vertex.class, id); try { final Node node = this.baseGraph.getNodeById(evaluateToLong(id)); if (!node.hasLabel(Neo4jVertexProperty.VERTEX_PROPERTY_LABEL)) return new Neo4jVertex(node, this); } catch (final NotFoundException e) { throw Graph.Exceptions.elementNotFound(Vertex.class, id); } catch (final NumberFormatException e) { throw Graph.Exceptions.elementNotFound(Vertex.class, id); } catch (final NotInTransactionException e) { throw Graph.Exceptions.elementNotFound(Vertex.class, id); } throw Graph.Exceptions.elementNotFound(Vertex.class, id); }
/** * Reading a node command might leave a node record which referred to labels in one or more * dynamic records as marked as heavy even if that node already had references to dynamic records, * changed in a transaction, but had no labels on that node changed within that same transaction. * Now defensively only marks as heavy if there were one or more dynamic records provided when * providing the record object with the label field value. This would give the opportuniy to load * the dynamic records the next time that record would be ensured heavy. */ @Test public void shouldRecoverNodeWithDynamicLabelRecords() throws Exception { // GIVEN database = new TestGraphDatabaseFactory().setFileSystem(fs).newImpermanentDatabase(); Node node; Label[] labels = new Label[] { label("a"), label("b"), label("c"), label("d"), label("e"), label("f"), label("g"), label("h"), label("i"), label("j"), label("k") }; try (Transaction tx = database.beginTx()) { node = database.createNode(labels); tx.success(); } // WHEN try (Transaction tx = database.beginTx()) { node.setProperty("prop", "value"); tx.success(); } EphemeralFileSystemAbstraction snapshot = fs.snapshot(); database.shutdown(); database = new TestGraphDatabaseFactory().setFileSystem(snapshot).newImpermanentDatabase(); // THEN try (Transaction tx = database.beginTx()) { node = database.getNodeById(node.getId()); for (Label label : labels) { assertTrue(node.hasLabel(label)); } } }
@Override public boolean include(Node node) { return !(node.hasLabel(DynamicLabel.label("ChangeSet"))); }
@Override public boolean include(Node node) { return node.hasLabel(DynamicLabel.label("Blue")); }