Some canges in the tutorial section
diff --git a/templates/collections.html.ep b/templates/collections.html.ep
index 3f73e96..42ac9b3 100644
--- a/templates/collections.html.ep
+++ b/templates/collections.html.ep
@@ -2,7 +2,7 @@
<ul>
% foreach my $vc (@{resource_info('collection')}) {
<li class="active" title="<%= $vc->{description} // '' %>"><h3><%= $vc->{name} %></h3>
-% my $stats = $vc->{stats};
+% my $stats = $vc->{statistics};
<dl class="info">
<dt>Documents</dt> <dd><%= commify $stats->{documents} %></dd>
<dt>Paragraphs</dt> <dd><%= commify $stats->{paragraphs} %></dd>
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 492acdf..09af4f4 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -7,15 +7,24 @@
% my $search_route;
% unless (current_route 'tutorial') {
<div id="tutorial">
-% my $tut_page = url_for(session('tutorial') || 'tutorial');
- <a href="<%= $tut_page %>"
- target="_blank"><i title="Open in new tab"
- class="fa fa-external-link-square"></i></a>
+%# my $tut_page = url_for(session('tutorial') || 'tutorial');
+%# <a href="<%= $tut_page %>"
+%# target="_blank"><i title="Open in new tab"
+%# class="fa fa-external-link-square"></i></a>
+%#
+%# <a href="javascript:window.open(getTutorialPage())"
+%# target="_blank"><i title="Open in new tab"
+%# class="fa fa-external-link-square"></i></a>
+%= javascript begin
+document.write('<a href="' + getTutorialPage().replace(/\?embedded=1/, '') + '" ');
+document.write('target="_blank"><i title="Open in new tab" ');
+document.write('class="fa fa-external-link-square"></i></a>');
+% end
<i onclick="closeTutorial()"
title="close"
class="fa fa-toggle-up"></i>
- <iframe src="about:blank"
- data-src="<%= $tut_page->query([embedded => 1]) %>"></iframe>
+ <iframe src="about:blank"></iframe>
+%# data-src="<%= $tut_page->query([embedded => 1]) %>"></iframe>
</div>
% if (current_route eq 'match') {
% $search_route = url_for('search_corpus');
diff --git a/templates/partial/header.html.ep b/templates/partial/header.html.ep
index 850e77b..2422819 100644
--- a/templates/partial/header.html.ep
+++ b/templates/partial/header.html.ep
@@ -3,5 +3,5 @@
%= asset 'korap.css'
%= asset 'korap.js'
<meta charset="utf-8" />
- <meta name="viewport" content="width=device-width;initial-scale=1.0;" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=false, user-scalable=no" />
</head>
diff --git a/templates/partial/javascript.html.ep b/templates/partial/javascript.html.ep
index 81c7519..422a29e 100644
--- a/templates/partial/javascript.html.ep
+++ b/templates/partial/javascript.html.ep
@@ -65,8 +65,11 @@
var tut = $("#tutorial");
tut.addClass("active");
var iframe = tut.children("iframe");
+/*
var src = iframe.attr("data-src");
iframe.attr("src", src);
+*/
+ iframe.attr("src", getTutorialPage());
};
function closeTutorial (o) {
diff --git a/templates/tutorial.html.ep b/templates/tutorial.html.ep
deleted file mode 100644
index c2f7c8a..0000000
--- a/templates/tutorial.html.ep
+++ /dev/null
@@ -1,93 +0,0 @@
-% content main => begin
-
-%# Store the id of an active section in the session, so the system is able to directly scroll to the relevant section
-%# This should be stored when clicking on a specific query
-%# but the remembered section contains the id - not the query
-
-<h2>KorAP-Tutorial</h2>
-
-<!--
-<p>Links to Blog, FAQ, About, Contact ...</p>
-<ul>
- <li>Introduction to KorAP</li>
- <li>How to use Poliqarp+ QL?</li>
- <li>How to use Cosmas-II QL?</li>
- <li>How to use CQL?</li>
- <li>API</li>
- <li>Search</li>
-</ul>
--->
-
-<section name="intro">
-<h3>Example Queries</h3>
-%# <p>This is a Tutorial to KorAP. It may be maintained separately (as a Wiki?) and has some nice features - like embedded example queries - just click on the queries below:</p>
-
-<p><strong>Poliqarp</strong>: Find all occurrences of the lemma "baum" as annotated by the default foundry.</p>
-%= korap_tut_query poliqarp => '[base=baum]'
-
-<p><strong>Cosmas-II</strong>: Find all occurrences of the words "der" and "Baum", in case they are in a maximum distance of 5 tokens. The order is not relevant.</p>
-%= korap_tut_query cosmas2 => 'der /w5 Baum'
-
-
-<p><strong>Poliqarp+</strong>: Find all nominal phrases as annotated using Connexor, that contain an adverb as annotated by OpenNLP.</p>
-%= korap_tut_query poliqarp => 'contains(<cnx/c=np>,[opennlp/p=ADV])'
-
-<p><strong>Poliqarp+</strong>: Find all sentences as annotated by the base foundry that start with a sequence of one token in present tense as annotated by Connexor and the lemma "der" annotated by the default foundry. Highlight both terms of the sequence.</p>
-%= korap_tut_query poliqarp => 'startswith(<s>, {1:[cnx/m=PRES]}{2:[base=der]})'
-
-
-%# <p>And here is a short cheat sheet for foundries and layers</p>
-</section>
-
-<section name="cheatsheet">
- <h3>Cheatsheet</h3>
- <ul>
- <li><strong>base</strong>
- <ul>
- <li>Supports two types of spans: <strong><s></strong> for sentences and <strong><p></strong> for paragraphs - this will likely change in the next index version. These spans lack prefix information!</li>
- </ul>
- </li>
- <li><strong>cnx</strong>
- <ul>
- <li><strong>l</strong> (Token:Lemma): All lemmas are written in lower case. Composita are split, e.g. the token "Leitfähigkeit" is matched by the lemmas "leit" and "fähigkeit" - not by the lemma "leitfähigkeit"</li>
- <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
- <li><strong>syn</strong> (Token:Syntactical information): Includes token based information like @PREMOD, @NH, @MAIN ...</li>
- <li><strong>m</strong> (Token:Morphosyntactical information): Includes information about tense ("PRES" ...), mode ("IND&qut;), number ("PL" ...) etc.</li>
- <li><strong>c</strong> (Span:Phrases): Only nominal phrases are available and all nominal phrases are written in lower case ("np")</li>
- </ul>
- </li>
- <li><strong>corenlp</strong>
- <ul>
- <li><strong>ne_hgc_175m_600</strong> (Token:Named Entity): Contains named entities like "I-PER", "I-ORG" etc. </li>
- <li><strong>ne_dewac_175_175m_600</strong> (Token:Named Entity): see above</li>
- </ul>
- </li>
- <li><strong>tt</strong>
- <ul>
- <li><strong>l</strong> (Token:Lemma): All non-noun lemmas are written in lower case, nouns are written upper case. Composita stay intact (e.g. "Normalbedingung")</li>
- <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
- </ul>
- </li>
- <li><strong>mate</strong>
- <ul>
- <li><strong>l</strong> (Token:Lemma): All lemmas are written in lower case. Composita stay intact (e.g. "buchstabenbezeichnung")</li>
- <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
- <li><strong>m</strong> (Token:Morphosyntactical information): Includes information about tense ("tense:pres" ...), mode ("mood:ind&qut;), number ("number:pl" ...), gender ("gender:masc" etc.</li>
- </ul>
- </li>
- <li><strong>opennlp</strong>
- <ul>
- <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
- </ul>
- </li>
- <li><strong>xip</strong>
- <ul>
- <li><strong>l</strong> (Token:Lemma): All non-noun lemmas are written in lower case, nouns are written upper case. Composita are split, e.g. the token "Leitfähigkeit" is matched by the lemmas "leiten" and "Fähigkeit" - and by a merged and pretty useless "leitenfähigkeit" (This is going to change)</li>
- <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
- <li><strong>c</strong> (Span:Phrases): Some phrases to create sentences, all upper case ("NP", "NPA", "NOUN", "VERB", "PREP", "AP" ...)</li>
- </ul>
- </li>
- </ul>
-</section>
-
-% end
diff --git a/templates/tutorial/foundries.html.ep b/templates/tutorial/foundries.html.ep
index 8e2b5cc..4c6427d 100644
--- a/templates/tutorial/foundries.html.ep
+++ b/templates/tutorial/foundries.html.ep
@@ -1 +1,73 @@
-default foundries
+% content main => begin
+
+<h2>KorAP-Tutorial: Foundries and Layers</h2>
+
+<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
+
+<p>KorAP provides access to multiple levels of annotations originating from multiple resources, so called <i>foundries</i>.</p>
+
+<section name="cheatsheet">
+ <ul>
+ <li><strong>base</strong>
+ <ul>
+ <li>Supports two types of spans: <strong><s></strong> for sentences and <strong><p></strong> for paragraphs - this will likely change in the next index version. These spans lack prefix information!</li>
+ </ul>
+ </li>
+ <li><strong>cnx</strong>
+ <ul>
+ <li><strong>l</strong> (Token:Lemma): All lemmas are written in lower case. Composita are split, e.g. the token "Leitfähigkeit" is matched by the lemmas "leit" and "fähigkeit" - not by the lemma "leitfähigkeit"</li>
+ <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
+ <li><strong>syn</strong> (Token:Syntactical information): Includes token based information like @PREMOD, @NH, @MAIN ...</li>
+ <li><strong>m</strong> (Token:Morphosyntactical information): Includes information about tense ("PRES" ...), mode ("IND&qut;), number ("PL" ...) etc.</li>
+ <li><strong>c</strong> (Span:Phrases): Only nominal phrases are available and all nominal phrases are written in lower case ("np")</li>
+ </ul>
+ </li>
+ <li><strong>corenlp</strong>
+ <ul>
+ <li><strong>ne_hgc_175m_600</strong> (Token:Named Entity): Contains named entities like "I-PER", "I-ORG" etc. </li>
+ <li><strong>ne_dewac_175_175m_600</strong> (Token:Named Entity): see above</li>
+ </ul>
+ </li>
+ <li><strong>tt</strong>
+ <ul>
+ <li><strong>l</strong> (Token:Lemma): All non-noun lemmas are written in lower case, nouns are written upper case. Composita stay intact (e.g. "Normalbedingung")</li>
+ <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
+ </ul>
+ </li>
+ <li><strong>mate</strong>
+ <ul>
+ <li><strong>l</strong> (Token:Lemma): All lemmas are written in lower case. Composita stay intact (e.g. "buchstabenbezeichnung")</li>
+ <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
+ <li><strong>m</strong> (Token:Morphosyntactical information): Includes information about tense ("tense:pres" ...), mode ("mood:ind&qut;), number ("number:pl" ...), gender ("gender:masc" etc.</li>
+ </ul>
+ </li>
+ <li><strong>opennlp</strong>
+ <ul>
+ <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
+ </ul>
+ </li>
+ <li><strong>xip</strong>
+ <ul>
+ <li><strong>l</strong> (Token:Lemma): All non-noun lemmas are written in lower case, nouns are written upper case. Composita are split, e.g. the token "Leitfähigkeit" is matched by the lemmas "leiten" and "Fähigkeit" - and by a merged and pretty useless "leitenfähigkeit" (This is going to change)</li>
+ <li><strong>p</strong> (Token:Part of Speech): All pos infos are written in capital letters and are based on STTS</li>
+ <li><strong>c</strong> (Span:Phrases): Some phrases to create sentences, all upper case ("NP", "NPA", "NOUN", "VERB", "PREP", "AP" ...)</li>
+ </ul>
+ </li>
+ </ul>
+</section>
+
+<h3>Default Foundries</h3>
+
+<p>For queries on specific layers without given foundries, KorAP provides default foundries, that can be overwritten by user configurations. The default foundries apply to the following layers:</p>
+
+<ul>
+ <li><strong>orth</strong>: opennlp </li>
+ <li><strong>lemma</strong>: opennlp </li>
+ <li><strong>pos</strong>: mate</li>
+</ul>
+
+<blockquote>
+ <p>In the Lucene backend, the <strong>orth</strong> layer can be bound to a specific foundry, as only one tokenization is supported.</p>
+</blockquote>
+
+% end
diff --git a/templates/tutorial/index.html.ep b/templates/tutorial/index.html.ep
new file mode 100644
index 0000000..ca8f1ea
--- /dev/null
+++ b/templates/tutorial/index.html.ep
@@ -0,0 +1,42 @@
+% content main => begin
+
+%# Store the id of an active section in the session, so the system is able to directly scroll to the relevant section
+%# This should be stored when clicking on a specific query
+%# but the remembered section contains the id - not the query
+
+<h2>KorAP-Tutorial</h2>
+
+<p><%= korap_tut_link_to 'Poliqarp+-Tutorial', '/tutorial/poliqarp-plus' %> <%= korap_tut_link_to 'Foundry Overview', '/tutorial/foundries' %> <%= korap_tut_link_to 'Regular Expressions', '/tutorial/regular-expressions' %></p>
+
+<!--
+<p>Links to Blog, FAQ, About, Contact ...</p>
+<ul>
+ <li>Introduction to KorAP</li>
+ <li>How to use Poliqarp+ QL?</li>
+ <li>How to use Cosmas-II QL?</li>
+ <li>How to use CQL?</li>
+ <li>API</li>
+ <li>Search</li>
+</ul>
+-->
+
+<section id="tut-intro">
+
+<h3>Example Queries</h3>
+%# <p>This is a Tutorial to KorAP. It may be maintained separately (as a Wiki?) and has some nice features - like embedded example queries - just click on the queries below:</p>
+
+<p><strong>Poliqarp</strong>: Find all occurrences of the lemma "baum" as annotated by the default foundry.</p>
+%= korap_tut_query poliqarp => '[base=baum]'
+
+<p><strong>Cosmas-II</strong>: Find all occurrences of the words "der" and "Baum", in case they are in a maximum distance of 5 tokens. The order is not relevant.</p>
+%= korap_tut_query cosmas2 => 'der /w5 Baum'
+
+<p><strong>Poliqarp+</strong>: Find all nominal phrases as annotated using Connexor, that contain an adverb as annotated by OpenNLP.</p>
+%= korap_tut_query poliqarp => 'contains(<cnx/c=np>,[opennlp/p=ADV])'
+
+<p><strong>Poliqarp+</strong>: Find all sentences as annotated by the base foundry that start with a sequence of one token in present tense as annotated by Connexor and the lemma "der" annotated by the default foundry. Highlight both terms of the sequence.</p>
+%= korap_tut_query poliqarp => 'startswith(<s>, {1:[cnx/m=PRES]}{2:[base=der]})'
+
+</section>
+
+% end
diff --git a/templates/tutorial/poliqarp-plus.html.ep b/templates/tutorial/poliqarp-plus.html.ep
index e310769..d8340a7 100644
--- a/templates/tutorial/poliqarp-plus.html.ep
+++ b/templates/tutorial/poliqarp-plus.html.ep
@@ -2,7 +2,11 @@
<h2>KorAP-Tutorial: Poliqarp+</h2>
-<section name="segments">
+<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
+
+<p>The following tutorial introduces all features provided by our version of the Poliqarp Query Language and some KorAP specific extensions.</p>
+
+<section id="tut-segments">
<h3>Simple Segments</h3>
<p>The atomic elements of Poliqarp queries are segments. Most of the time segments represent words and can be simply queried:</p>
@@ -21,10 +25,10 @@
<p>The query above will find all occurrences of <code>laufen</code> irrespective of the capitalization of letters, so <code>wir laufen</code> will be find as well as <code>das Laufen</code> and even <code>"GEH LAUFEN!"</code>.
</section>
-<section name="regexp">
+<section id="tut-regexp">
<h3>Regular Expressions</h3>
-<p>Segments can also be queried using <%= link_to 'tut-regex', 'regular expressions' %> - by surrounding the segment with double quotes.</p>
+<p>Segments can also be queried using <%= korap_tut_link_to 'regular expressions', '/tutorial/regular-expressions' %> - by surrounding the segment with double quotes.</p>
%= korap_tut_query poliqarp => '"l(au|ie)fen"'
@@ -42,8 +46,8 @@
<p>The above query will find all occurrences of segments including the string <code>trenn</code> case insensitive, like "Trennung", "unzertrennlich", or "Wettrennen".</p>
-<blockquote>
- <p>These kinds of queries are extremely slow!</p>
+<blockquote class="warning">
+ <p>Beware: These kinds of queries (with prepended <code>.*</code> expressions) are extremely slow!</p>
</blockquote>
<p>You can again apply the <code>/i</code> flag to search case insensitive.</p>
@@ -52,10 +56,10 @@
</section>
-<section name="complex">
+<section id="tut-complex">
<h3>Complex Segments</h3>
-<p>Complex segments are expressed in square brackets and contain additional information on the resource of the term under scrutiny by prividing key/value pairs, separated by a <code>=</code> symbol.</p>
+<p>Complex segments are expressed in square brackets and contain additional information on the resource of the term under scrutiny by providing key/value pairs, separated by a <code>=</code> symbol.</p>
<p>The KorAP implementation of Poliqarp provides three special segment keys: <code>orth</code> for surface forms, <code>base</code> for lemmata, and <code>pos</code> for Part-of-Speech. The following complex query finds all surface forms of <code>Baum</code>.</p>
@@ -71,37 +75,48 @@
%= korap_tut_query poliqarp => '[orth="l(au|ie)fen"/xi]', cutoff => 1
-<p>Another special key is <code>base</code>, refering to the lemma annotation of the <%= link_to 'tut-foundries', 'default foundry' %>. The following query finds all occurrences of segments annotated as the lemma <code>Baum</code> by the default foundry.</p>
+<p>Another special key is <code>base</code>, refering to the lemma annotation of the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>. The following query finds all occurrences of segments annotated as the lemma <code>Baum</code> by the default foundry.</p>
-%= korap_tut_query poliqarp => '[base=Baum]'
+%= korap_tut_query poliqarp => '[base=baum]'
-<p>The third special key is <code>pos</code>, refering to the part-of-speech annotation of the <%= link_to 'tut-foundries', 'default foundry' %>. The following query finds all attributive adjectives:</p>
+<p>The third special key is <code>pos</code>, refering to the part-of-speech annotation of the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>. The following query finds all attributive adjectives:</p>
%= korap_tut_query poliqarp => '[pos=ADJA]'
-<p>Complex segments requesting further token annotations can have keys following the <code>foundry/layer</code> notation. For example to find all occurrences of <span style="color: red">plural words in the mate foundry, you can search using the following query:</span></p>
+<p>Complex segments requesting further token annotations can have keys following the <code>foundry/layer</code> notation. For example to find all occurrences of plural words in the mate foundry, you can search using the following query:</p>
%= korap_tut_query poliqarp => '[mate/m=number:pl]'
+<blockquote class="warning">
+ <p>There is currently a bug in the serialization of this query.</p>
+ <p><strong>The following stuff in the tutorial is not yet tested.</strong></p>
+</blockquote>
+
</section>
-<section name="spans">
+<section id="tut-spans">
<h3>Span Segments</h3>
%= korap_tut_query poliqarp => '<s>'
</section>
-<section name="paradigmatic-operators">
+<section id="tut-paradigmatic-operators">
<h3>Paradigmatic Operators</h3>
-%= korap_tut_query poliqarp => '[orth=bäume & base=bäumen]'
+%= korap_tut_query poliqarp => '[orth=laufe/i & base=lauf]'
-%= korap_tut_query poliqarp => '[orth=bäume & base!=bäumen]'
+%= korap_tut_query poliqarp => '[orth=laufe/i & base!=lauf]'
+
+<blockquote class="warning">
+ <p>There is a bug in the Lucene backend regarding the negation of matches</p>
+</blockquote>
<p>The following query is equivalent</p>
%= korap_tut_query poliqarp => '[orth=bäume & !base=bäumen]'
+<p>Some more ...</p>
+
%= korap_tut_query poliqarp => '[base=laufen | base=gehen]'
%= korap_tut_query poliqarp => '[(base=laufen | base=gehen) & tt/pos=VVFIN]'
@@ -110,7 +125,7 @@
</section>
-<section name="syntagmatic-operators">
+<section id="tut-syntagmatic-operators">
<h3>Syntagmatic Operators</h3>
<h4>Sequences</h4>
@@ -131,21 +146,20 @@
<h4>Position Operators</h4>
-contains()
-startsWith()
-endsWith()
+<p>contains()</p>
+<p>startsWith()</p>
+<p>endsWith()</p>
+<p>overlaps()</p>
<blockquote>
- The KorAP implementation of Poliqarp also support the postfix <code>within</code> operator, that works similar to the <code>contains()</code>, but is not nestable.
+ <p>The KorAP implementation of Poliqarp also support the postfix <code>within</code> operator, that works similar to the <code>contains()</code>, but is not nestable.</p>
</blockquote>
<h4>Class Operators</h4>
-{}
-focus()
-
-
-
+<p>{}</p>
+<p>focus()</p>
+<p>...</p>
</section>
diff --git a/templates/tutorial/regular-expressions.html.ep b/templates/tutorial/regular-expressions.html.ep
index 1cce875..3f15598 100644
--- a/templates/tutorial/regular-expressions.html.ep
+++ b/templates/tutorial/regular-expressions.html.ep
@@ -1,10 +1,18 @@
-% contain main => begin
+% content main => begin
+
<h2>KorAP-Tutorial: Regular Expressions</h2>
-The support for regular expressions in KorAP may be backend dependend. Below you can find the description for the respective backends.</p>
+<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
-<section name="lucene">
+<p>The support for regular expressions in KorAP may be backend dependend. Below you can find the description for the respective backends.</p>
+
+<section id="tut-lucene">
<h3>Lucene</h3>
+
+<blockquote>
+ <p>Description still missing.</p>
+</blockquote>
+
</section>
% end