JeffreyBenjaminBrown / digraphs-with-text

BSD 3-Clause "New" or "Revised" License
66 stars 5 forks source link

Search for "/it" #3

Closed JeffreyBenjaminBrown closed 6 years ago

JeffreyBenjaminBrown commented 7 years ago

The idea

Already, the query /any #needs love could return

the puppy #needs love
the flower #needs love

Instead of those full expressions, the query /it #needs love should simply return "the puppy" and "the flower".

Nesting

/it should be nestable in inner QRels. For instance, given the data

the taco truck #uses gas ##because eletricity #(is not) available

the query /it #uses gas ##because electricity #(is not) available would return the taco truck.

Multiple /it variables in one QNode

QNode should be able to contain more than one /it variable. For instance, continuing the above example, /it #uses gas ##because electricity #(is not) /it would return the taco truck and available.

Requirements

type PathInRel = [RelRole]

In the query the taco truck #uses gas ##because /it #(is not) available, the path to /it would be [Mbr 2, Mbr 1]: It is the first member of the #(is not) relationship, and to get to that, you've got to first take the second member of the #because relationship. (In this case you could think of it as taking a right at because and then a left at is not, but in general, not all relationships are binary.)

pathsToIts :: QNode -> Set PathInRel