TF-Query and Kleene Star #71
Replies: 10 comments 11 replies
-
This construct violates a few assumptions that the implementation of TF-Query makes. Suppose we have a query like this
then the results are 4-tuples, in which each member of a result tuple corresponds with a Moreover, when TF-Query runs a query, it first builds a graph of qnodes, where each qnode corresponds with an element in the query. It then analyses the graph, and constrains the result space, and uses the graph to stitch results together. With the Kleene star, we can no longer build such a q-graph, or we have to modify the meaning of the q-graph. |
Beta Was this translation helpful? Give feedback.
-
What we can do is: allow a result tuple to contain a tuple of sub results, but only for q-nodes with a Kleene-star. Then the outer number of results in each tuple is still constant. We do have to modify the functions |
Beta Was this translation helpful? Give feedback.
-
Then the interpretation: When we stitch results together, based on q-nodes, what we do is: we start with a q-node and find a match for that in the text. Say we find text node t1 that matches q-node q1. Then we go from q1 to a certain q2 along a q-edge. A q-edge corresponds to a relational constraint, such as "word contained in clause". So, say that qe1 is the q-edge between q1 and q2, and say that qe1 corresponds to the relation r1 between text nodes. So, we look for a text-node t2 that matches q2, and for which it holds that t1 stands in relationship r1 to t2, or for short: r1(t1, t2). This is how it works now. |
Beta Was this translation helpful? Give feedback.
-
Now suppose we have a qnode qn that corresponds to an item with a Kleene star, say If this is the only node, it is easy to find matches: We start with any t1 that fits qn, and then examine whether we can find a t2 that fits the bill to, and for which t1 <: t2 (adjacent), If we have qn-qe-qm in our query graph, and qe corresponds to relation r, and we have a sequence T1 = (t1, ..., tk) matching qn, then we have to find a tm matching qm, such that tk-r-tm. I.e.: for outgoing edges the relation most hold between the last element of a matching sequence of qn, and a match for qm. Likewise, for incoming edges qm-qe-qn, the relation most hold between the match for qm and the first element of the match for qn. If both qn and qm correspond to Kleene-starred qnodes, it is also clear. |
Beta Was this translation helpful? Give feedback.
-
So far so good. It seems if we generalize our notion of q-nodes, so that they represent sequences of text nodes, we can deal with the Kleene-star on single objects in our queries. But even then, MQL is a step ahead. In MQL you can say
i.e. you can not only star single atoms but whole groups. |
Beta Was this translation helpful? Give feedback.
-
Now, how could we implement the corresponding TF-Query?
So far, we do not even have the syntax |
Beta Was this translation helpful? Give feedback.
-
Again, two problems: what do the result tuples look like, and how do we model groups in terms of q-nodes and q-edges? Results: the result of a group is a tuple of the results of the individual group members. So a result of
is a tuple But a result of
is a tuple |
Beta Was this translation helpful? Give feedback.
-
And the result of
looks like
|
Beta Was this translation helpful? Give feedback.
-
As to the graph: we need the concept of a cluster of q-nodes, which represents a group in the query. Such a cluster is itself a q-node, and its matches are sequences of matches of the q-nodes that make up the cluster. So, now q-nodes can be atomic q-nodes or trees of q-nodes. And matches of q-nodes are tuples that are in fact trees of text-nodes. Probably, we are getting very close to the notion of sheaf of @emg ! I think this is implementable in TF-Query, but it will take a fair amount of very careful work. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
TF-Query is inspired by MQL queries, as implemented in Emdros.
One thing that is currently lacking in TF-Query is the Kleene Star.
In MQL you can say for example:
meaning: match a clause with domain=N, then at least one and up to 50 clauses with domain=Q, and then a clause with domain=N again.
This is not possible in TF-Query.
Can we make this possible?
Beta Was this translation helpful? Give feedback.
All reactions