:SELECT term.*, descendent_term.*, graph_path.* :FROM term INNER JOIN graph_path ON (term.id = graph_path.term1_id) INNER JOIN term AS descendent_term ON (graph_path.term2_id = descendent_term.id) :WHERE [term.acc => &term_acc&] [term.name => &term_name&] [descendent_term.acc => &descendent_term_acc&] [descendent_term.name => &descendent_term_name&] [graph_path.distance => &distance& ] [ (distance > 0) ] :ORDER BY graph_path.distance,descendent_term.name :USE NESTING (set(term(descendent_term(graph_path)))) // schema: go desc: given a GO term, this will fetch all descendent_terms; OR, given a descendent_term will fetch parent terms example_input: term_acc => SELECT DISTINCT term.acc FROM term INNER JOIN graph_path ON (term.id = graph_path.term1_id) ORDER BY term.acc DESC example_input: term_name => SELECT DISTINCT term.name FROM term INNER JOIN graph_path ON (term.id = graph_path.term1_id) WHERE name like '%binding%' ORDER BY term.name DESC example_input: descendent_term_acc => SELECT DISTINCT term.acc FROM term INNER JOIN graph_path ON (term.id = graph_path.term2_id) ORDER BY term.acc DESC example_input: descendent_term_name => SELECT DISTINCT term.name FROM term INNER JOIN graph_path ON (term.id = graph_path.term2_id) WHERE name like '%binding%' ORDER BY term.name DESC example_input: reltype_name => SELECT DISTINCT term.name FROM term INNER JOIN graph_path ON (term.id = graph_path.relationship_type_id) ORDER BY term.name DESC example_input: distance => 1, 2, 3