neo4j ¿cómo devolver todas las etiquetas de nodo con Cypher?
No puedo encontrar cómo devolver las etiquetas de un nodo con Cypher.
¿Alguien conoce la sintaxis de esta operación?
7 answers
Hay una función labels(node) que puede devolver todas las etiquetas de un nodo.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-23 12:10:31
Para obtener todas las etiquetas de nodo distintas:
MATCH (n) RETURN distinct labels(n)
Para obtener el número de nodos para cada etiqueta:
MATCH (n) RETURN distinct labels(n), count(*)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-14 22:49:45
Si desea todas las etiquetas individuales (no las combinaciones) siempre puede ampliar las respuestas:
MATCH (n)
WITH DISTINCT labels(n) AS labels
UNWIND labels AS label
RETURN DISTINCT label
ORDER BY label
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-14 10:38:07
Neo4j 3.0 ha introducido el procedimiento db.labels()
que devuelve todas las etiquetas disponibles en la base de datos. Uso:
call db.labels();
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-18 12:45:18
START n=node(*) RETURN labels(n)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-02 16:34:32
Si está utilizando la API de Java, puede obtener rápidamente un iterador de todos los Label
s en la base de datos de la siguiente manera:
GraphDatabaseService db = (new GraphDatabaseFactory()).newEmbeddedDatabase(pathToDatabase);
ResourceIterable<Label> labs = GlobalGraphOperations.at(db).getAllLabels();
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-29 20:10:34
Si desea obtener las etiquetas de un nodo especificado, use labels(node)
; Si solo desea obtener todas las etiquetas de nodo en neo4j, use esta función en su lugar: call db.labels;
, nunca use esta consulta: MATCH n RETURN DISTINCT LABELS(n)
. Hará un escaneo completo de la tabla, que es muy, muy lento..
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-09 03:25:50