本文整理了Java中org.neo4j.driver.v1.types.Node.labels()
方法的一些代码示例,展示了Node.labels()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.labels()
方法的具体详情如下:
包路径:org.neo4j.driver.v1.types.Node
类名称:Node
方法名:labels
[英]Return all labels.
[中]返回所有标签。
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
private Object toNode(Object value, boolean virtual, Map<Long, Object> nodesCache) {
Value internalValue = ((InternalEntity) value).asValue();
Node node = internalValue.asNode();
if (virtual) {
List<Label> labels = new ArrayList<>();
node.labels().forEach(l -> labels.add(Label.label(l)));
VirtualNode virtualNode = new VirtualNode(node.id(), labels.toArray(new Label[0]), node.asMap(), db);
nodesCache.put(node.id(), virtualNode);
return virtualNode;
} else
return Util.map("entityType", internalValue.type().name(), "labels", node.labels(), "id", node.id(), "properties", node.asMap());
}
代码示例来源:origin: neo4j/neo4j-ogm
public List<String> labels(Object value) {
Node node = (Node) value;
List<String> labels = new ArrayList<>();
for (String label : node.labels()) {
labels.add(label);
}
return labels;
}
代码示例来源:origin: org.neo4j/neo4j-ogm-bolt-driver
public List<String> labels(Object value) {
Node node = (Node) value;
List<String> labels = new ArrayList<>();
for (String label : node.labels()) {
labels.add(label);
}
return labels;
}
代码示例来源:origin: neo4j/cypher-shell
@Nonnull static String collectNodeLabels(@Nonnull Node node) {
StringBuilder sb = new StringBuilder();
node.labels().forEach(label -> sb.append(COLON).append(escape(label)));
return sb.toString();
}
代码示例来源:origin: net.iot-solutions.graphdb/jcypher
@Override
public List<GrLabel> getNodeLabels(long nodeId, int rowIndex) {
List<GrLabel> labels = new ArrayList<GrLabel>();
if (rowIndex >= 0) {
Node nd = (Node) getPropertiesObject(nodeId, rowIndex, ElemType.NODE);
for (String lab : nd.labels()) {
GrLabel label = GrAccess.createLabel(lab);
GrAccess.setState(label, SyncState.SYNC);
labels.add(label);
}
}
return labels;
}
代码示例来源:origin: Wolfgang-Schuetzelhofer/jcypher
@Override
public List<GrLabel> getNodeLabels(long nodeId, int rowIndex) {
List<GrLabel> labels = new ArrayList<GrLabel>();
if (rowIndex >= 0) {
Node nd = (Node) getPropertiesObject(nodeId, rowIndex, ElemType.NODE);
for (String lab : nd.labels()) {
GrLabel label = GrAccess.createLabel(lab);
GrAccess.setState(label, SyncState.SYNC);
labels.add(label);
}
}
return labels;
}
代码示例来源:origin: neueda/jetbrains-plugin-graph-database-support
public Neo4jBoltNode(Node value) {
this.id = String.valueOf(value.id());
this.types = Iterables.asList(value.labels());
this.propertyContainer = new Neo4jBoltPropertyContainer(value.asMap());
}
代码示例来源:origin: neo4j/cypher-shell
@Test
public void prettyPrintNode() throws Exception {
// given
BoltResult result = mock(BoltResult.class);
Record record = mock(Record.class);
Value value = mock(Value.class);
Node node = mock(Node.class);
HashMap<String, Object> propertiesAsMap = new HashMap<>();
propertiesAsMap.put("prop1", "prop1_value");
propertiesAsMap.put("prop2", "prop2_value");
when(value.type()).thenReturn(InternalTypeSystem.TYPE_SYSTEM.NODE());
when(value.asNode()).thenReturn(node);
when(node.labels()).thenReturn(asList("label1", "label2"));
when(node.asMap(anyObject())).thenReturn(unmodifiableMap(propertiesAsMap));
when(record.keys()).thenReturn(asList("col1", "col2"));
when(record.values()).thenReturn(asList(value));
when(result.getRecords()).thenReturn(asList(record));
when(result.getSummary()).thenReturn(mock(ResultSummary.class));
// when
String actual = plainPrinter.format(result);
// then
assertThat(actual, is("col1, col2\n" +
"(:label1:label2 {prop2: prop2_value, prop1: prop1_value})"));
}
代码示例来源:origin: neo4j/cypher-shell
when(start.labels()).thenReturn(asList("start"));
when(start.id()).thenReturn(1l);
when(end.labels()).thenReturn(asList("end"));
when(end.id()).thenReturn(2l);
代码示例来源:origin: neo4j/cypher-shell
when(node.labels()).thenReturn(asList("label `1", "label2"));
when(node.asMap(anyObject())).thenReturn(unmodifiableMap(nodeProp));
代码示例来源:origin: neo4j/cypher-shell
when(start.labels()).thenReturn(asList("start"));
when(start.id()).thenReturn(1l);
when(second.labels()).thenReturn(asList("second"));
when(second.id()).thenReturn(2l);
when(third.labels()).thenReturn(asList("third"));
when(third.id()).thenReturn(3l);
when(end.labels()).thenReturn(asList("end"));
when(end.id()).thenReturn(4l);
代码示例来源:origin: neo4j/cypher-shell
HashMap<String, Object> startProperties = new HashMap<>();
startProperties.put("prop1", "prop1_value");
when(start.labels()).thenReturn(asList("start"));
when(start.id()).thenReturn(1l);
when(middle.labels()).thenReturn(asList("middle"));
when(middle.id()).thenReturn(2l);
HashMap<String, Object> endProperties = new HashMap<>();
endProperties.put("prop2", "prop2_value");
when(end.labels()).thenReturn(asList("end"));
when(end.id()).thenReturn(3l);
代码示例来源:origin: neo4j/cypher-shell
when(n1.id()).thenReturn(1L);
List<String> labels = asList("L1");
when(n1.labels()).thenReturn(labels);
when(n1.asMap(anyObject())).thenReturn(Collections.emptyMap());
when(n2.labels()).thenReturn(asList("L2"));
when(n2.asMap(anyObject())).thenReturn(Collections.emptyMap());
when(n3.labels()).thenReturn(asList("L3"));
when(n3.asMap(anyObject())).thenReturn(Collections.emptyMap());
内容来源于网络,如有侵权,请联系作者删除!