org.neo4j.graphdb.NotFoundException Java Examples
The following examples show how to use
org.neo4j.graphdb.NotFoundException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Traversals.java From EvilCoder with MIT License | 5 votes |
public static Node getStatementForASTNode(Node node) { Node n = node; Node parent = node; while (true) { try { Object property = n.getProperty(NodeKeys.IS_CFG_NODE); return n; } catch (NotFoundException ex) { } Iterable<Relationship> rels = n .getRelationships(Direction.INCOMING); for (Relationship rel : rels) { parent = rel.getStartNode(); break; } if (n == parent) return null; n = parent; } }
Example #2
Source File: Neo4jApiTransformationRepairPosLength.java From trainbenchmark with Eclipse Public License 1.0 | 5 votes |
@Override public void activate(final Collection<Neo4jPosLengthMatch> matches) { for (final Neo4jPosLengthMatch match : matches) { final Node segment = match.getSegment(); try { final Number lengthNumber = (Number) segment.getProperty(ModelConstants.LENGTH); final int length = Neo4jHelper.numberToInt(lengthNumber); segment.setProperty(ModelConstants.LENGTH, -length + 1); } catch (final NotFoundException e) { // do nothing (node has been removed) } } }
Example #3
Source File: Neo4jCypherTransformationRepairPosLength.java From trainbenchmark with Eclipse Public License 1.0 | 5 votes |
@Override public void activate(final Collection<Neo4jPosLengthMatch> matches) throws IOException { for (final Neo4jPosLengthMatch match : matches) { try { final Map<String, Object> parameters = ImmutableMap.of( // QueryConstants.VAR_SEGMENT, match.getSegment() // ); driver.runTransformation(transformationDefinition, parameters); } catch (final NotFoundException e) { // do nothing (node has been removed) } } }
Example #4
Source File: Neo4jLiveTest.java From tutorials with MIT License | 5 votes |
@Test public void testUpdate() { graphDb.beginTx(); graphDb.execute("CREATE (baeldung:Company {name:\"Baeldung\"}) " + "-[:owns]-> (tesla:Car {make: 'tesla', model: 'modelX'})" + "RETURN baeldung, tesla"); Result result = graphDb.execute("MATCH (car:Car)" + "WHERE car.make='tesla'" + " SET car.milage=120" + " SET car :Car:Electro" + " SET car.model=NULL" + " RETURN car"); Map<String, Object> firstResult = result.next(); Node car = (Node) firstResult.get("car"); Assert.assertEquals(car.getProperty("milage"), 120L); Assert.assertEquals(car.getLabels(), Arrays.asList(Label.label("Car"), Label.label("Electro"))); try { car.getProperty("model"); Assert.fail(); } catch (NotFoundException e) { // expected } }