Java Code Examples for org.neo4j.driver.v1.types.Node#get()

The following examples show how to use org.neo4j.driver.v1.types.Node#get() . 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: City2AFrame.java    From Getaviz with Apache License 2.0 6 votes vote down vote up
private String toDistrict(Node district, Node position) {
	Node entity = connector.getVisualizedEntity(district.id());
	return "<a-box id=\"" + entity.get("hash").asString() + "\"" +
			"\n" +
			"\t position=\"" + position.get("x") + " " + position.get("y") + " " + position.get("z") + "\"" +
			"\n" +
			"\t width=\"" + district.get("width") + "\"" +
			"\n" +
			"\t height=\"" + district.get("height") + "\"" +
			"\n" +
			"\t depth=\"" + district.get("length") + "\"" +
			"\n" +
			"\t color=\"" + district.get("color").asString() + "\">" +
			"\n" +
			"</a-box>" +
			"\n";
}
 
Example 2
Source File: City2AFrame.java    From Getaviz with Apache License 2.0 6 votes vote down vote up
private String toBuilding(Node building, Node position) {
	Node entity = connector.getVisualizedEntity(building.id());
	return "<a-box id=\"" + entity.get("hash").asString() + "\"" +
			"\t\t position=\"" + position.get("x") + " " + position.get("y") + " " + position.get("z") + "\"" +
			"\n" +
			"\t\t width=\"" + building.get("width") + "\"" +
			"\n" +
			"\t\t height=\"" + building.get("height") + "\"" +
			"\n" +
			"\t\t depth=\"" + building.get("length") + "\"" +
			"\n" +
			"\t\t color=\"" + building.get("color").asString() + "\">" +
			"\n" +
			"</a-box>" +
			"\n";
}
 
Example 3
Source File: City2AFrame.java    From Getaviz with Apache License 2.0 6 votes vote down vote up
private String toFloor(Node floor, Node position) {
	Node entity = connector.getVisualizedEntity(floor.id());
	return "<a-box id=\"" + entity.get("hash").asString() + "\"" +
			"\n" +
			buildPosition(position) +
			"\n" +
			"\t width=\"" + floor.get("width") + "\"" +
			"\n" +
			"\t height=\"" + floor.get("height") + "\"" +
			"\n" +
			"\t depth=\"" + floor.get("length") + "\"" +
			"\n" +
			"\t color=\"" + floor.get("color").asString() + "\">" +
			"\n" +
			"</a-box>" +
			"\n";
}
 
Example 4
Source File: City2AFrame.java    From Getaviz with Apache License 2.0 6 votes vote down vote up
private String toChimney(Node chimney, Node position) {
	Node entity = connector.getVisualizedEntity(chimney.id());
	return "<a-box id=\"" + entity.get("hash").asString() + "\"" +
			"\n" +
			buildPosition(position) +
			"\n" +
			"\t width=\"" + chimney.get("width") + "\"" +
			"\n" +
			"\t height=\"" + chimney.get("height") + "\"" +
			"\n" +
			"\t depth=\"" + chimney.get("length") + "\"" +
			"\n" +
			"\t color=\"" + chimney.get("color").asString() + "\">" +
			"\n" +
			"</a-box>" +
			"\n";
}
 
Example 5
Source File: CEnhancement.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
private void enhanceNode(Record record) {
	Node node = record.get("e").asNode();
	Node declaringParent = record.get("p").asNode();

	fileNameTranslationUnit = connector.executeRead("MATCH (t:TranslationUnit)-[:DECLARES*]->(e) WHERE ID(e) = " + node.id() + " RETURN t.fileName").single().get("t.fileName").asString();

	// this was included to exclude C elements declared outside the translation unit (usage of #include)
	// but this does not work with the current jqassistant setup, since the files gets downloaded and thereby the filename is changed which is crucial
	//if (fileNameChild.equals(fileNameTranslationUnit)) {
	//If variable/constant is part of a struct, union or enum it could have the same name as another variable/constant therefore add parent name to name.
	String fqn = "";
	if ((node.hasLabel(Labels.Variable.name()) || node.hasLabel(Labels.EnumConstant.name())) && declaringParent != null
			&& (declaringParent.hasLabel(Labels.Struct.name()) || declaringParent.hasLabel(Labels.Union.name()) || declaringParent.hasLabel(Labels.Enum.name()))) {
		fqn = fileNameTranslationUnit + "_" + declaringParent.get("name") + "_" + node.get("name");
	} else if (node.get("fqn").isNull()) {
		fqn = fileNameTranslationUnit + "_" + node.get("name");
	}

	if (node.get("hash").isNull()) {
		String hash = createHash(node.get("fqn").toString());
		connector.executeWrite(
				"MATCH (n) WHERE ID(n) = " + node.id() + " SET n.hash = '" + hash + "', n.fqn = '" + fqn + "'");
	} else {
		connector.executeWrite(
				"MATCH (n) WHERE ID(n) = " + node.id() + " SET n.fqn = '" + fqn + "'");
	}
}
 
Example 6
Source File: JavaEnhancement.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
private void enhanceNode(Record record) {
	Node node = record.get("n").asNode();
	Value fqnValue = node.get("fqn");
	String fqn = fqnValue.asString();
	if (fqnValue.isNull()) {
		Node container = connector.executeRead(
			"MATCH (n)<-[:DECLARES]-(container) " +
			"WHERE ID(n) = " + node.id() + " " +
			"RETURN container"
		).single().get("container").asNode();
		String containerFqn = container.get("fqn").asString();
		String name = node.get("name").asString();
		String signature = node.get("signature").asString();
		int index = signature.indexOf(" ") + 1;
		if (node.hasLabel("Method")) {
			int indexOfBracket = signature.indexOf("(");
			if (name.isEmpty()) {
				name = signature.substring(index, indexOfBracket);
			}
			fqn = containerFqn + "." + signature.substring(index);
		} else {
			if (name.isEmpty()) {
				name = signature.substring(index);
			}
			fqn = containerFqn + "." + name;
		}
		connector.executeWrite(
	"MATCH (n) WHERE ID(n) = " + node.id() + " SET n.name = '" + name + "', n.fqn = '" + fqn + "'");
	}
	connector.executeWrite(
"MATCH (n) WHERE ID(n) = " + node.id() + " SET n.hash = '" + createHash(fqn) + "'"
	);
}
 
Example 7
Source File: City2AFrame.java    From Getaviz with Apache License 2.0 4 votes vote down vote up
private String buildPosition(Node position) {
	return "\t position=\"" + position.get("x") + " " + position.get("y") + " " + position.get("z") + "\"";
}