<div dir="ltr">I am considering the problem of representing search results in a graph database. (Define such a database as a collection N of nodes and E of labeled edges, where a labeled edge consists of a triplet (l, n1, n2), where l is some kind of label and n1 and n2 are members of N.)<br><br>I think a type something like the following would be useful:<br>  data Search = <br>    Fan { origin :: Node<br>          , label :: Label<br>          , members :: [Node]<br>        }<br>    | And Search Search<br>    | Or Search Search<br>    | Not Search<br>In a Fan with origin o, members would be the set of Nodes p such that (label, o, p) is an edge. A Search is ultimately built out of Fans.<br><br>I've seen this kind of thing before, and I believe it will lead me to some substantial problems that other people have already solved. What should I study?<br></div>