Java Code Examples for org.neo4j.driver.v1.types.Path#end()

The following examples show how to use org.neo4j.driver.v1.types.Path#end() . 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: City2City.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
private void setBuildingSegmentAttributesPanels(Long segment) {
	Path path = connector.executeRead(
		"MATCH p = (parent)-[:CONTAINS]->(s)-[:VISUALIZES]->(e) WHERE ID(s) = " + segment + " RETURN p").next().get(
		"p").asPath();
	Node relatedEntity = path.end();
	long parent = path.start().id();
	List<Node> childsM = connector.executeRead(
		"MATCH (s)-[:CONTAINS]->(child)-[r:VISUALIZES]->(e:Method) WHERE ID(s) = " + parent +
			" AND (e:Field OR e:Method)" + " AND NOT (e)<-[:DECLARES]-(:Enum) RETURN e").stream().map(s -> s.get("e").asNode()).collect(Collectors.toList());
	List<Node> childsA = connector.executeRead(
			"MATCH (s)-[:CONTAINS]->(child)-[r:VISUALIZES]->(e:Field) WHERE ID(s) = " + parent +
				" AND NOT (e)<-[:DECLARES]-(:Enum) RETURN e").stream().map(s -> s.get("e").asNode()).collect(Collectors.toList());
	int areaUnit;
	if (classElementsMode == ClassElementsModes.ATTRIBUTES_ONLY) {
		areaUnit = childsM.size();
	} else {
		areaUnit = childsA.size();
	}
	double width;
	double length;
	if (areaUnit <= 1) {
		width = widthMin;
		length = widthMin;
	} else {
		width = widthMin * areaUnit;
		length = widthMin * areaUnit;
	}
	int index = 0;
	int effectiveLineCount = relatedEntity.get("effectiveLineCount").asInt(0);
	while (index < panelHeightTresholdNos.length &&
		effectiveLineCount >= panelHeightTresholdNos[index]) {
		index = index + 1;
	}
	double height = panelHeightUnit * (index + 1);
	connector.executeWrite(
		cypherSetBuildingSegmentAttributes(segment, width, length, height,
			CityUtils.setBuildingSegmentColor(relatedEntity)));
}
 
Example 2
Source File: City2City.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
private void setBuildingSegmentAttributesBricks(Long segment) {
	Path path = connector.executeRead(
		"MATCH p = (parent)-[:CONTAINS]->(s)-[:VISUALIZES]->(e) WHERE ID(s) = " + segment + " RETURN p").next().get(
		"p").asPath();
	Node relatedEntity = path.end();
	connector.executeWrite(
		cypherSetBuildingSegmentAttributes(segment, brickSize, brickSize, brickSize,
			CityUtils.setBuildingSegmentColor(relatedEntity)));
	CityUtils.setBuildingSegmentColor(relatedEntity);
}