PMLTQ
view release on metacpan or search on metacpan
doc/pmltq_tutorial_web_client.html view on Meta::CPAN
refer to the selectors in the subquery).</p><p>A subquery constraint is verified as follows: for each match of the
selectors in the current and outer scope, all matches of the subquery are
located (these may coincide with nodes matched by the selectors in the
outer scope). The number of distinct nodes matched by the leading selector
of the subquery are counted and this number is compared with the
restrictions on number of occurrences. The constraint is satisfied if and
only if these restrictions are met.</p><p>A constraint can also be a boolean combination of other constraints;
a nested node selector occurring in a boolean combination with other
nested node selectors or constraints is considered to be a subquery with
at least one occurrence.</p><p>A PML-TQ query can be visualized as a graph consisting of one or
more trees whose nodes are the selectors connected by edges according to
the nesting of selectors and subqueries. In this sense we may sometimes
refer to selectors as <em class="firstterm">query nodes</em> and to the query
as <em class="firstterm">query graph</em> or <em class="firstterm">query tree</em>
(a technical root can be added above all the trees so that a forest
becomes a single tree). The edges can be labeled or colored to represent
different relationships between nodes. References to named selectors can
be represented by an additional layer of links (edges) in the graph that
may go across the basic tree structure of the query tree.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tutorial"></a>Tutorial</h2></div></div></div><p>The purpose of this tuto...
queries from the PML-TQ WEB-based client, searching treebanks hosted at <a class="ulink" href="http://lindat.cz" target="_top">the Lindat/Clarin web pages</a>.</p><p>As our examples, we use queries over the Prague Dependency Treebank 3.0;
conceptually similar queries can be applied to most other treebanks,
although the node types and attributes will be probably different.</p><p>The tutorial gradually passes from very simple to complex queries
and demonstrates various common syntactic constructions of the PML-TQ
language.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="web-interface-getting-started"></a>Getting started</h3></div></div></div><p>The PML-TQ provides a client interface in the form
of a web application that can be accessed by any web browser capable of
combining JavaScript, CSS, and SVG (<a class="ulink" href="http://www.w3.org/Graphics/SVG/" target="_top">Scalable Vector Graphics</a>),
such as Firefox, Google Chrome, Opera browser, and Safari.</p><p>Unlike the TrEd interface, this interface does not require any
installation, but lacks some features such as graphical query builder
and graphical representation of the query (the queries must be entered
in the text form), and of course does not support querying local files.
</p><p>To access the PML-TQ servers hosted at Lindat/Clarin servers,
go to <a class="ulink" href="http://lindat.cz" target="_top">lindat.cz</a> and in the
top menu, click onÂ
<span class="inlinemediaobject"><img src="images/callouts/TreeQuery.png" height="25" alt="TreeQuery"></span>. A starting PML-TQ
web page will be displayed (see
<a class="xref" href="#fig-screenshot-web-lindat-main" title="Figure 1. The PML-TQ web-service at Lindat/Clarin web pages">Figure 1, âThe PML-TQ web-service at Lindat/Clarin web pagesâ</a>).</p><div class="figure"><a name="fig-screenshot...
of featured treebanks. Clicking on any of the listed treebanks will
connect you directly to the server for the given treebank.</p><p>A list of all available treebanks can be accessed by clicking onÂ
<span class="inlinemediaobject"><img src="images/callouts/BrowseTreebanks.png" height="25" alt="Browse Treebanks"></span>, as demonstrated in <a class="xref" href="#fig-screenshot-web-lindat-browse-treebanks" title="Figure 2. The list of avai...
language and other tags. By clicking on a single treebank from the (filtered) list below, you will get connected to the search
server for the respective treebank. For example, if you select the Prague Dependency Treebank 3.0 (PDT 3.0), you will get to
the following web page (<a class="xref" href="#fig-screenshot-web-lindat-pdt30-help" title="Figure 3. The help page for the PDT 3.0 treebank">Figure 3, âThe help page for the PDT 3.0 treebankâ</a>):</p><div class="figure"><a name="fig-...
wish to read through this lengthy tutorial. To proceed to the page where you can actually enter
a search query, click on <span class="guibutton">
<span class="inlinemediaobject"><img src="images/callouts/button-query.png" height="19" alt="Query"></span></span>. </p><p>The following web page will be displayed (<a class="xref" href="#fig-screenshot-web-lindat-pdt30-start" title="Figure 4....
nodes of the type <code class="literal">t-node</code> (tectogrammatical nodes in
PDTÂ 3.0) whose attribute <code class="literal">functor</code> equals to
<code class="literal">PRED</code> (Predicate). In the web client, the query can be created in two
ways:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Method 1: Click onÂ
<span class="inlinemediaobject"><img src="images/callouts/toolbar-NodeTypes.png" height="25" alt="Node Types"></span> in the toolbar; a list of available nodes for PDTÂ 3.0 is displayed:
</p><div class="figure"><a name="fig-screenshot-web-lindat-pdt30-nodetypes"></a><p class="title"><b>Figure 5. A part of the list of available node types for PDT 3.0</b></p><div class="figure-contents"><div class="mediaobject" align="center"><i...
Choose <code class="literal">t-node</code>. The string <code class="literal">t-node</code> will be copied to the text area below the toolbar.
</p><p>
Properties of a node follow its type, enclosed in square brackets: type <code class="literal">[</code> and choose
a t-node attribute <code class="literal">functor</code>
from menu <span class="inlinemediaobject"><img src="images/callouts/toolbar-Attributes.png" height="25" alt="Attributes"></span> in the toolbar. Next, select operator <code class="literal">=</code> from the <code class="literal">Comparison</co...
in the <span class="inlinemediaobject"><img src="images/callouts/toolbar-Operators.png" height="25" alt="Operators"></span> menu in the toolbar, and type <code class="literal">"PRED"</code>. Finish by closing the definition of the t-no...
<a class="xref" href="#fig-screenshot-web-lindat-pdt30-query-PRED" title="Figure 6. A simple query searching for Predicates in PDT 3.0">Figure 6, âA simple query searching for Predicates in PDT 3.0â</a> shows how the query should look li...
</p><div class="figure"><a name="fig-screenshot-web-lindat-pdt30-query-PRED"></a><p class="title"><b>Figure 6. A simple query searching for Predicates in PDT 3.0</b></p><div class="figure-contents"><div class="mediaobject" align="center"><img ...
</p></li><li class="listitem"><p>Method 2: In the query text area, start typing <code class="literal">t-</code>. The popup menu with possible node types will be offered:
</p><div class="figure"><a name="fig-screenshot-web-lindat-pdt30-node-type-hints-t-layer-cut"></a><p class="title"><b>Figure 7. List of available node types for PDT 3.0 containing the string <code class="literal">t-</code></b></p><div class="f...
Choose <code class="literal">t-node</code> and continue typing the query, i.e. <code class="literal">[ fu</code>. After you start typing the name of the attribute,
another popup window with possible attributes is offered:
</p><div class="figure"><a name="fig-screenshot-web-lindat-pdt30-attribute-hints-functor-cut"></a><p class="title"><b>Figure 8. List of available attribute names in PDT 3.0 containing the string <code class="literal">fu</code></b></p><div clas...
Choose <code class="literal">functor</code> and finish typing the rest of the query, i.e. <code class="literal">="functor"]</code>.
</p><p>
The resulting query should be the same as in <a class="xref" href="#fig-screenshot-web-lindat-pdt30-query-PRED" title="Figure 6. A simple query searching for Predicates in PDT 3.0">Figure 6, âA simple query searching for Predicates in PDT ...
</p><pre class="programlisting">t-node [ functor="PRED" ]</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-KVJI" target="_top">try the query</a></span></p><p>
</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Throughout the tutorial, you can use the button <span class="keysym">try the query</span> placed
below examples to go directly to the web client and try the example. Such permanent links
to queries in the web client can be created by clicking on <span class="inlinemediaobject"><img src="images/callouts/PermanentLink.png" height="25" alt="Permanent Link"></span> on the right side below the query text area.</p></div></div><di...
To execute the query, press  <span class="inlinemediaobject"><img src="images/callouts/ExecuteQuery.png" height="25" alt="Execute Query"></span> below the query text area. The query gets processed by the server and the result
is displayed. <a class="xref" href="#fig-screenshot-web-lindat-pdt30-query-PRED" title="Figure 6. A simple query searching for Predicates in PDT 3.0">Figure 6, âA simple query searching for Predicates in PDT 3.0â</a> shows the ...
</p><div class="figure"><a name="fig-screenshot-web-lindat-pdt30-query-PRED-result"></a><p class="title"><b>Figure 9. A result tree for the query searching for Predicates in PDT 3.0</b></p><div class="figure-contents"><div class="mediaobject" ...
The corresponding sentence is displayed just above the tree. Try clicking on the individual words of the sentence and see the animation marking the corresponding nodes in the tree.
</p><p>Buttons <span class="inlinemediaobject"><img src="images/callouts/ResultPrevious.png" height="25" alt="Previous"></span> and <span class="inlinemediaobject"><img src="images/callouts/ResultNext.png" height="25" alt="Next"></span> can be us...
change the number of the current result (<span class="inlinemediaobject"><img src="images/callouts/ResultNumber.png" height="25" alt="1 of 100"></span>) to a desired number (make sure that the focus is in
the result number field) and â in the list of matching nodes â click on <span class="inlinemediaobject"><img src="images/callouts/MatchingNode1.png" height="25" alt="1 t-node"></span>. The corresponding matching node in the given re...
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>By default, the search engine returns up to 100 matches (in no
particular order), which should be more than sufficient for viewing a
few matching examples. This limit can be changed on the right side above the query text area (Â <span class="inlinemediaobject"><img src="images/callouts/ResultLimit.png" height="25" alt="Result Limit"></span>), but raising this limit may slo...
the search. We shall later see how to compute the number of all
matches, using output filters.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idm270"></a>A query with two nodes</h3></div></div></div><p>We shall now make the query more complex by adding anot...
it. We shall ask for a t-node with functor "PRED" (Predicate) that has a child with
functor "PAT" (Patient).</p><p>
To add a node to an existing one in the query, you need to specify
a type of relation of the new node to the existing one. The list of
available relations can be accessed through <span class="inlinemediaobject"><img src="images/callouts/toolbar-Relations.png" height="25" alt="Relations"></span> in the toolbar (see <a class="xref" href="#fig-screenshot-web-lindat-pdt30-relation...
</p><div class="figure"><a name="fig-screenshot-web-lindat-pdt30-relations-menu-cut"></a><p class="title"><b>Figure 10. A part of the list of available standard relations between nodes in PML-TQ</b></p><div class="figure-contents"><div class="m...
The default value is <code class="literal">child</code>, so the following two queries
are equivalent:
</p><pre class="programlisting">t-node [ functor="PRED", t-node [ functor="PAT" ] ]</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-OMAE" target="_top">try the query</a></span></p><p>
or
</p><pre class="programlisting">t-node [ functor="PRED", child t-node [ functor="PAT" ] ]</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-DJFE" target="_top">try the query</a></span></p><p>
These forms of the query use nesting of node selectors. The query can also be expressed without nesting, using names,
either as
</p><pre class="programlisting">t-node $a := [ functor="PRED", child $b ];
t-node $b := [ functor="PAT" ];</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-5JL9" target="_top">try the query</a></span></p><p>
or
</p><pre class="programlisting">t-node $a := [ functor="PRED" ];
t-node $b := [ functor="PAT", parent $a ];</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-HNYG" target="_top">try the query</a></span></p><p>
naming the two nodes
<code class="literal">$a</code> and <code class="literal">$b</code> and either indicating
that <code class="literal">$a</code> has a child $b or that <code class="literal">$b</code>
has a parent $a.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idm306"></a>Disjunctions, regular expressions and set enumerations</h3></div></div></div><p>We now extend our query to cover t-nodes not ...
functor <code class="literal">PAT</code> (Patient) but also <code class="literal">ADDR</code> (Addressee).
This can be done in three different ways:</p><p>Using a disjunction:
</p><pre class="programlisting">t-node [ functor="PRED", t-node [ functor="PAT" or functor="ADDR" ] ]</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-0ZPS" target="_top">try the query</a></span>
</p><p>Using a regular expression:
</p><pre class="programlisting">t-node [ functor="PRED", t-node [ functor ~ "^(PAT|ADDR)$" ] ]</pre><p>
<span class="keysym"><a class="ulink" href="http://hdl.handle.net/11346/PMLTQ-AAZA" target="_top">try the query</a></span></p><p>Symbol <code class="literal">~</code> (tilde) denotes a binary relation between
two values that is true if and only if the value on the left interpreted
as string matches the value on the right interpreted as regular
( run in 2.586 seconds using v1.01-cache-2.11-cpan-364913b4093 )