Return to navigation page

Three ways to submit a read-only query:

Cypher query

:

For the query
MATCH (n:derivation {id:'THEREARENODERIVATIONS'}) RETURN n
the results are
Example queries:
purpose Cypher query comment
list all distinct node labels # MATCH (n) RETURN DISTINCT labels(n) what is the schema for nodes?
list all distinct edge labels # MATCH (a)-[r]->(b) RETURN DISTINCT type(r) what is the schema for edges?
list the node count for each label # MATCH (n) RETURN DISTINCT labels(n), count(*) how many nodes of each type?
list all nodes # MATCH (n) RETURN n
list all edges # MATCH (n)-[r]->(m) RETURN r
list all nodes and edges # MATCH (n)-[r]->(m) RETURN n,r,m
list derivations # MATCH (n:derivation) RETURN n See also table of derivations
list inference rules # MATCH (n:inference_rule) RETURN n See also table of inference rules
list steps # MATCH (n:step) RETURN n
list expressions # MATCH (n:expression) RETURN n See also table of expressions
list scalar symbols # MATCH (n:scalar) RETURN n See also table of scalar symbols
list vector symbols # MATCH (n:vector) RETURN n See also table of vector symbols
list matrix symbols # MATCH (n:matrix) RETURN n See also table of matrix symbols
list operations # MATCH (n:operation) RETURN n See also table of operations
list relations # MATCH (n:relation) RETURN n See also table of relations
list constant values with units # MATCH (n:value_with_units) RETURN n See also table of scalar symbols
list steps for a derivation # MATCH (n:step), (m:derivation) WHERE m.id='THEREARENODERIVATIONS' RETURN n See also review_derivation THEREARENODERIVATIONS
list every node that a step connects to # MATCH (s:step)-[r]->(e) WHERE s.id='THEREARENOSTEPS' RETURN e all input expressions, feeds, and output expressions
list inference rule used in a specific step # MATCH (i:inference_rule), (s:step) WHERE s.id='THEREARENOSTEPS' RETURN i
list expressions connected to a specific inference rule # MATCH (n:expression), (m:inference_rule) WHERE m.id='THEREARENOINFERENCERULES' RETURN n
show properties for a specific derivation # MATCH (d:derivation) WHERE d.id = 'THEREARENODERIVATIONS' RETURN d
or
MATCH (n:derivation {id:'THEREARENODERIVATIONS'}) RETURN n
show properties for a specific expression # MATCH (n:expression) WHERE n.id='0203024440' RETURN n
list expressions that have a name # MATCH (n:expression) WHERE n.name_latex <> '' RETURN n query assumes the name_latex always exists on the nodes being considered. If the property might be missing, n.name_latex would be null, and null <> '' would evaluate to true.
list expressions that have a name # MATCH (n:expression) WHERE exists(n.name_latex) AND n.name_latex <> '' RETURN n check for existence of name_latex
an inference rule is in which derivations? # MATCH (d:derivation),(s:step),(i:inference_rule) WHERE i.id='THEREARENOINFERENCERULES' RETURN DISTINCT d
MATCH (m:scalar) WHERE (any(prop in keys(m) WHERE m[prop] =~ '.*ddd.*')) RETURN m replace 'ddd' with your desired text
shortest path length between two inference rules # MATCH p = shortestPath((n:inference_rule)-[*..]-(m:inference_rule)) WHERE n.id = '8208125' AND m.id = '7208176' RETURN length(p) replace ID values with your desired nodes
shortest path between two inference rules # MATCH p = shortestPath((n:inference_rule)-[*..]-(m:inference_rule)) WHERE n.id = 'THEREARENOINFERENCERULES' AND m.id = '7208176' RETURN p replace ID values with your desired nodes

cheatsheet

The following fail because they try to write:

purpose Cypher query
delete all nodes MATCH (n) DETACH DELETE n

timing of Neo4j queries: