Renamed to Kalamar and updated Virtual Collection Chooser
diff --git a/Changes b/Changes
index cd450cc..b4bf775 100755
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@
- Removed Mr Crabs - introduced Karl
- Support semantic markup for KWIC
- Fixed Click-bug in hint-menu
+ - Renamed "KorAP" classes to "Kalamar"
0.12 2015-01-28
- Fixed alignment bug
diff --git a/Makefile.PL b/Makefile.PL
index 790ed1d..0fa8bc5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,9 +5,9 @@
use ExtUtils::MakeMaker;
WriteMakefile(
- VERSION_FROM => 'lib/Korap.pm',
- ABSTRACT => 'Test Frontend for the KorAP API',
- NAME => 'Korap',
+ VERSION_FROM => 'lib/Kalamar.pm',
+ ABSTRACT => 'Mojolicious based Frontend for KorAP',
+ NAME => 'Kalamar',
AUTHOR => 'Nils Diewald',
BUILD_REQUIRES => {
'Test::More' => 0
diff --git a/korap.conf b/kalamar.conf
similarity index 89%
rename from korap.conf
rename to kalamar.conf
index 1ee30f4..4f9d827 100644
--- a/korap.conf
+++ b/kalamar.conf
@@ -1,5 +1,5 @@
{
- KorAP => {
+ Kalamar => {
# 'api-0.1' => 'http://10.0.10.13:8888/api/v0.1/'
'api-0.1' => 'http://10.0.10.13:7070/api/v0.1/'
},
@@ -10,7 +10,7 @@
JSON => 1
},
Search => {
- engine => 'Korap::API',
+ engine => 'Kalamar::API',
api => 'http://10.0.10.13:7070/api/v0.1/'
},
CHI => {
@@ -25,11 +25,11 @@
cache_size => '12m'
}
},
- Oro => {
- users => {
- file => app->home .'/db/users.sqlite'
- },
- },
+# Oro => {
+# users => {
+# file => app->home .'/db/users.sqlite'
+# },
+# },
hypnotoad => {
listen => ['http://*:6666', 'http://*:5555'],
workers => 5,
diff --git a/lib/Korap.pm b/lib/Kalamar.pm
similarity index 73%
rename from lib/Korap.pm
rename to lib/Kalamar.pm
index e60357c..f6deba7 100644
--- a/lib/Korap.pm
+++ b/lib/Kalamar.pm
@@ -1,21 +1,23 @@
-package Korap;
+package Kalamar;
use Mojo::Base 'Mojolicious';
use Mojo::ByteStream 'b';
our $VERSION = '0.13';
-# Start dev with
-# morbo -w lib -w templates -w public/sass -w public/js -w public/css script/korap
-# morbo -m test -w lib -w templates -w public/sass -w public/js -w public/css script/korap
-
# Start the application and register all routes and plugins
sub startup {
my $self = shift;
- $self->defaults(layout => 'default');
+ # Set default totle
+ $self->defaults(
+ layout => 'default',
+ title => 'KorAP - Korpusanalyseplattform der nächsten Generation'
+ );
# Set secret for signed cookies
- $self->secrets(['fmhsfjgfchgsdbfgshfxztsbt32477eb45veu4vubrghfgghbtv']);
+ $self->secrets([
+ b($self->home . '/kalamar.secret')->slurp->split("\n")
+ ]);
# Add additional plugin path
push(@{$self->plugins->namespaces}, __PACKAGE__ . '::Plugin');
@@ -27,20 +29,21 @@
Notifications
Number::Commify
Search
- KorapHelpers
- KorapTagHelpers
- /) {
+ KalamarHelpers
+ KalamarTagHelpers/) {
$self->plugin($_);
};
-# $self->plugin(AssetPack => { minify => 1 });
+ # $self->plugin(AssetPack => { minify => 1 });
$self->plugin('AssetPack');
$self->plugin('AssetPack::LibSass');
$self->plugin('MailException' => $self->config('MailException'));
# Add assets for AssetPack
$self->asset(
- 'korap.css' => (
+ 'kalamar.css' => (
+
+ # Sass files
'/sass/style.scss',
'/sass/sidebar.scss',
'/sass/tutorial.scss',
@@ -49,16 +52,18 @@
'/sass/matchinfo.scss',
'/sass/pagination.scss',
'/sass/kwic-4.0.scss',
+ '/sass/alertify.scss',
+
+ # CSS files
'/css/media.css',
'/css/font-awesome.min.css',
'/css/highlight.css',
- '/sass/alertify.scss',
$self->notifications->styles
)
);
$self->asset(
- 'korap.js' => (
+ 'kalamar.js' => (
# '/js/d3.v3.min.js',
# '/js/dagre-d3.min.js',
# '/js/dagre-d3.js',
@@ -72,12 +77,12 @@
)
);
- $self->helper(
- date_format => sub {
- my ($c, $date) = @_;
- return $date;
- }
- );
+ # $self->helper(
+ # date_format => sub {
+ # my ($c, $date) = @_;
+ # return $date;
+ # }
+ # );
# Routes
my $r = $self->routes;
@@ -88,7 +93,9 @@
# Get match information
my $corpus = $r->route('/corpus/:corpus_id');
my $doc = $corpus->route('/#doc_id');
- my $match = $doc->route('/:match_id')->to('search#match_info')->name('match');
+ my $match = $doc->route('/:match_id')
+ ->to('search#match_info')
+ ->name('match');
# Tutorial data
$r->get('/tutorial')->to('tutorial#page', tutorial => 'index');
diff --git a/lib/Korap/API.pm b/lib/Kalamar/API.pm
similarity index 99%
rename from lib/Korap/API.pm
rename to lib/Kalamar/API.pm
index 9392f4d..8cc1d41 100644
--- a/lib/Korap/API.pm
+++ b/lib/Kalamar/API.pm
@@ -1,4 +1,4 @@
-package Korap::API;
+package Kalamar::API;
use Mojo::Base 'Mojolicious::Plugin';
use Scalar::Util qw/blessed weaken/;
use strict;
diff --git a/lib/Korap/Controller/Search.pm b/lib/Kalamar/Controller/Search.pm
similarity index 98%
rename from lib/Korap/Controller/Search.pm
rename to lib/Kalamar/Controller/Search.pm
index a4ba64b..33185b9 100644
--- a/lib/Korap/Controller/Search.pm
+++ b/lib/Kalamar/Controller/Search.pm
@@ -1,4 +1,4 @@
-package Korap::Controller::Search;
+package Kalamar::Controller::Search;
use Mojo::Base 'Mojolicious::Controller';
# Add X-Forwarded-For to user agent call everywhere
diff --git a/lib/Korap/Controller/Tutorial.pm b/lib/Kalamar/Controller/Tutorial.pm
similarity index 92%
rename from lib/Korap/Controller/Tutorial.pm
rename to lib/Kalamar/Controller/Tutorial.pm
index 186439d..db86998 100644
--- a/lib/Korap/Controller/Tutorial.pm
+++ b/lib/Kalamar/Controller/Tutorial.pm
@@ -1,4 +1,4 @@
-package Korap::Controller::Tutorial;
+package Kalamar::Controller::Tutorial;
use Mojo::Base 'Mojolicious::Controller';
# Todo: Set title as defaults
diff --git a/lib/Kalamar/Plugin/KalamarHelpers.pm b/lib/Kalamar/Plugin/KalamarHelpers.pm
new file mode 100644
index 0000000..08ff41f
--- /dev/null
+++ b/lib/Kalamar/Plugin/KalamarHelpers.pm
@@ -0,0 +1,25 @@
+package Kalamar::Plugin::KalamarHelpers;
+use Mojo::Base 'Mojolicious::Plugin';
+
+sub register {
+ my ($plugin, $mojo) = @_;
+
+ $mojo->helper(
+ kalamar_test_port => sub {
+ my $c = shift;
+ if (defined $c->stash('kalamar.test_port')) {
+ return $c->stash('kalamar.test_port');
+ };
+
+ if ($c->req->url->to_abs->port == 6666 ||
+ $c->app->mode =~ m/^development|test$/) {
+ $c->stash('kalamar.test_port' => 1);
+ return 1;
+ };
+
+ $c->stash('kalamar.test_port' => 0);
+ return 0;
+ });
+};
+
+1;
diff --git a/lib/Korap/Plugin/KorapTagHelpers.pm b/lib/Kalamar/Plugin/KalamarTagHelpers.pm
similarity index 94%
rename from lib/Korap/Plugin/KorapTagHelpers.pm
rename to lib/Kalamar/Plugin/KalamarTagHelpers.pm
index 6753ad5..6041b9c 100644
--- a/lib/Korap/Plugin/KorapTagHelpers.pm
+++ b/lib/Kalamar/Plugin/KalamarTagHelpers.pm
@@ -1,4 +1,4 @@
-package Korap::Plugin::KorapTagHelpers;
+package Kalamar::Plugin::KalamarTagHelpers;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON 'decode_json';
use Mojo::JSON::Pointer;
@@ -10,7 +10,7 @@
# Create helper for queries in the tutorial
$mojo->helper(
- korap_tut_query => sub {
+ kalamar_tut_query => sub {
my ($c, $ql, $q, %param) = @_;
my $onclick = 'top.useQuery(this)';
@@ -27,7 +27,7 @@
# Tutorial wasn't embedded - but opened for testing
# elsif ($c->param('testing') &&
-# $c->korap_test_port &&
+# $c->kalamar_test_port &&
# $param{tests}) {
#
# Currently disabled
@@ -105,7 +105,7 @@
#
# # Emit hook to possible subscribers
# # This is used for self-testing
-# # $plugin->emit_hook(korap_tut_query => (
+# # $plugin->emit_hook(kalamar_tut_query => (
# # query_language => $ql,
# # query => $q,
# # %param
@@ -142,7 +142,7 @@
# Create links in the tutorial that make sure the current position is preserved,
# in case the tutorial was opened embedded
$mojo->helper(
- korap_tut_link_to => sub {
+ kalamar_tut_link_to => sub {
my $c = shift;
my $title = shift;
my $link = shift;
diff --git a/lib/Korap/Plugin/KorapHelpers.pm b/lib/Korap/Plugin/KorapHelpers.pm
deleted file mode 100644
index 45cf3cb..0000000
--- a/lib/Korap/Plugin/KorapHelpers.pm
+++ /dev/null
@@ -1,25 +0,0 @@
-package Korap::Plugin::KorapHelpers;
-use Mojo::Base 'Mojolicious::Plugin';
-
-sub register {
- my ($plugin, $mojo) = @_;
-
- $mojo->helper(
- korap_test_port => sub {
- my $c = shift;
- if (defined $c->stash('korap.test_port')) {
- return $c->stash('korap.test_port');
- };
-
- if ($c->req->url->to_abs->port == 6666 ||
- $c->app->mode =~ m/^development|test$/) {
- $c->stash('korap.test_port' => 1);
- return 1;
- };
-
- $c->stash('korap.test_port' => 0);
- return 0;
- });
-};
-
-1;
diff --git a/public/css/vc.css b/public/css/vc.css
index 377f19a..e05c3cb 100644
--- a/public/css/vc.css
+++ b/public/css/vc.css
@@ -31,23 +31,28 @@
}
.vc .rewritten .rewrite {
- color: red;
- font-weight: bold;
- background-color: yellow;
- width: 1.5em;
- height: 1.2em;
- margin-left: 2px;
- border-radius: 8pt;
+ margin-left: 4pt;
display: inline-block;
+ color: #ffa500;
+}
+
+.vc .rewritten .rewrite:after {
+ font-family: FontAwesome;
+ font-style: normal;
+ font-weight: normal;
+ content: "\f040"; // "\f14b";
+ text-decoration: underline;
}
.vc .rewritten .rewrite span {
display: none;
}
+/*
.vc .rewritten .rewrite:hover span {
display: block;
}
+*/
.vc .docGroup .docGroup {
display: block;
diff --git a/public/js/demo/vc.html b/public/js/demo/vc.html
index 9254d68..ea4a53c 100644
--- a/public/js/demo/vc.html
+++ b/public/js/demo/vc.html
@@ -3,6 +3,7 @@
<head>
<title>Virtual Collection demo</title>
<meta charset="utf-8" />
+ <script src="../src/menu.js"></script>
<script src="../src/vc.js"></script>
<link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
<style type="text/css" rel="stylesheet">
@@ -16,46 +17,47 @@
</head>
<body>
<div id="vc"></div>
+ <div id="menu"></div>
<script>
var json = {
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:and",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
},
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq",
"rewrites" : [
{
- "@type": "korap:rewrite",
+ "@type": "koral:rewrite",
"src" : "policy",
"operation" : "operation:injection",
}
@@ -66,7 +68,7 @@
]
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Untertitel",
"value":"huhu",
"match":"match:eq"
@@ -87,6 +89,19 @@
document.getElementById("query").innerHTML = vc.root().toQuery();
};
+ var menu = KorAP.FieldMenu.create([
+ ['Titel', 'title', 'string'],
+ ['Untertitel', 'subTitle', 'string'],
+ ['Veröffentlichungsdatum', 'pubDate', 'date']
+ ]);
+ menu.limit(4);
+ menu.show();
+
+ document.getElementById('menu').appendChild(menu.element());
+
+ menu.focus();
+
+
</script>
<hr />
diff --git a/public/js/runner/vc.html b/public/js/runner/vc.html
index e010587..f0e8179 100644
--- a/public/js/runner/vc.html
+++ b/public/js/runner/vc.html
@@ -8,6 +8,7 @@
<script src="../lib/jasmine-2.1.1/jasmine.js"></script>
<script src="../lib/jasmine-2.1.1/jasmine-html.js"></script>
<script src="../lib/jasmine-2.1.1/boot.js"></script>
+ <script src="../src/menu.js"></script>
<script src="../src/vc.js"></script>
<script src="../spec/vcSpec.js"></script>
</head>
diff --git a/public/js/spec/hintSpec.js b/public/js/spec/hintSpec.js
index 80807ff..a7232d4 100644
--- a/public/js/spec/hintSpec.js
+++ b/public/js/spec/hintSpec.js
@@ -705,4 +705,81 @@
var hint = KorAP.Hint.create();
});
});
+
+
+describe('KorAP.ContextAnalyzer', function () {
+
+ it('should be initializable', function () {
+ var analyzer = KorAP.ContextAnalyzer.create(")");
+ expect(analyzer).toBe(undefined);
+
+ analyzer = KorAP.ContextAnalyzer.create(".+?");
+ expect(analyzer).not.toBe(undefined);
+
+ });
+
+ it('should check correctly', function () {
+ analyzer = KorAP.ContextAnalyzer.create(KorAP.context);
+ expect(analyzer.test("cnx/]cnx/c=")).toEqual("cnx/c=");
+ expect(analyzer.test("cnx/c=")).toEqual("cnx/c=");
+ expect(analyzer.test("cnx/c=np mate/m=mood:")).toEqual("mate/m=mood:");
+ expect(analyzer.test("impcnx/")).toEqual("impcnx/");
+ expect(analyzer.test("cnx/c=npcnx/")).toEqual("npcnx/");
+ expect(analyzer.test("mate/m=degree:pos corenlp/ne_dewac_175m_600="))
+ .toEqual("corenlp/ne_dewac_175m_600=");
+ });
+});
+
+describe('KorAP.InputField', function () {
+ var input;
+
+ beforeAll(function () {
+ input = document.createElement("input");
+ input.setAttribute("type", "text");
+ input.setAttribute("value", "abcdefghijklmno");
+ input.style.position = 'absolute';
+ input.style.top = "20px";
+ input.style.left = "30px";
+ input.focus();
+ input.selectionStart = 5;
+ });
+
+ afterAll(function () {
+ document.getElementsByTagName("body")[0].removeChild(input);
+ document.getElementsByTagName("body")[0].removeChild(
+ document.getElementById("searchMirror")
+ );
+ });
+
+ it('should be initializable', function () {
+ // Supports: context, searchField
+ var inputField = KorAP.InputField.create(input);
+ expect(inputField._element).not.toBe(undefined);
+ });
+
+ it('should have text', function () {
+ var inputField = KorAP.InputField.create(input);
+
+ expect(inputField.value).toEqual("abcdefghijklmno");
+ expect(inputField.element.selectionStart).toEqual(5);
+ expect(inputField.split()[0]).toEqual("abcde");
+ expect(inputField.split()[1]).toEqual("fghijklmno");
+
+ inputField.insert("xyz");
+ expect(inputField.split()[0]).toEqual("abcdexyz");
+ expect(inputField.split()[1]).toEqual("fghijklmno");
+
+ });
+
+ it('should be correctly positioned', function () {
+ var inputField = KorAP.InputField.create(input);
+ document.getElementsByTagName("body")[0].appendChild(input);
+ inputField.reposition();
+ expect(inputField.mirror.style.left).toEqual("30px");
+ expect(inputField.mirror.style.top.match(/^(\d+)px$/)[1]).toBeGreaterThan(20);
+ });
+});
+
+
+
*/
diff --git a/public/js/spec/menuSpec.js b/public/js/spec/menuSpec.js
index 98f6e72..cc569a8 100644
--- a/public/js/spec/menuSpec.js
+++ b/public/js/spec/menuSpec.js
@@ -1,3 +1,4 @@
+// The OwnMenu item
KorAP.OwnMenuItem = {
create : function (params) {
return Object.create(KorAP.MenuItem).upgradeTo(KorAP.OwnMenuItem)._init(params);
@@ -19,36 +20,8 @@
}
};
-KorAP.ComplexMenuItem = {
- create : function (params) {
- return Object.create(KorAP.MenuItem)
- .upgradeTo(KorAP.ComplexMenuItem)
- ._init(params);
- },
- content : function (content) {
- if (arguments.length === 1) {
- this._content = content;
- };
- return this._content;
- },
- _init : function (params) {
- if (params[0] === undefined)
- throw new Error("Missing parameters");
- var r = document.createElement('div');
- for (var i = 1; i <= params.length; i++) {
- var h = document.createElement('h' + i);
- h.appendChild(document.createTextNode(params[i-1]));
- r.appendChild(h);
- };
-
- this._content = r;
- this._lcField = ' ' + this.content().textContent.toLowerCase();
-
- return this;
- }
-};
-
+// The OwnMenu
KorAP.OwnMenu = {
create : function (params) {
return Object.create(KorAP.Menu)
@@ -58,17 +31,7 @@
};
-// Support for hint
-KorAP.HintMenu = {
- create : function (context, params) {
- var obj = Object.create(KorAP.Menu)
- .upgradeTo(KorAP.HintMenu)
- ._init(KorAP.HintMenuItem, params);
- obj._context = context;
- return obj;
- }
-};
-
+// HintMenuItem
KorAP.HintMenuItem = {
create : function (params) {
return Object.create(KorAP.MenuItem)
@@ -131,6 +94,50 @@
};
+// HintMenu
+KorAP.HintMenu = {
+ create : function (context, params) {
+ var obj = Object.create(KorAP.Menu)
+ .upgradeTo(KorAP.HintMenu)
+ ._init(KorAP.HintMenuItem, params);
+ obj._context = context;
+ return obj;
+ }
+};
+
+
+// The ComplexMenuItem
+KorAP.ComplexMenuItem = {
+ create : function (params) {
+ return Object.create(KorAP.MenuItem)
+ .upgradeTo(KorAP.ComplexMenuItem)
+ ._init(params);
+ },
+ content : function (content) {
+ if (arguments.length === 1) {
+ this._content = content;
+ };
+ return this._content;
+ },
+ _init : function (params) {
+ if (params[0] === undefined)
+ throw new Error("Missing parameters");
+
+ var r = document.createElement('div');
+ for (var i = 1; i <= params.length; i++) {
+ var h = document.createElement('h' + i);
+ h.appendChild(document.createTextNode(params[i-1]));
+ r.appendChild(h);
+ };
+
+ this._content = r;
+ this._lcField = ' ' + this.content().textContent.toLowerCase();
+
+ return this;
+ }
+};
+
+
describe('KorAP.MenuItem', function () {
it('should be initializable', function () {
@@ -305,6 +312,14 @@
describe('KorAP.Menu', function () {
+ var list = [
+ ["Constituency", "c=", "Example 1"],
+ ["Lemma", "l="],
+ ["Morphology", "m=", "Example 2"],
+ ["Part-of-Speech", "p="],
+ ["Syntax", "syn="]
+ ];
+
it('should be initializable', function () {
var list = [
["Constituency"],
@@ -342,13 +357,6 @@
});
it('should be visible', function () {
- var list = [
- ["Constituency", "c=", "Example 1"],
- ["Lemma", "l="],
- ["Morphology", "m=", "Example 2"],
- ["Part-of-Speech", "p="],
- ["Syntax", "syn="]
- ];
var menu = KorAP.HintMenu.create("cnx/", list);
expect(menu.delete()).toBe(undefined);
menu.limit(3);
@@ -368,14 +376,6 @@
});
it('should be filterable', function () {
- var list = [
- ["Constituency", "c=", "Example 1"],
- ["Lemma", "l="],
- ["Morphology", "m=", "Example 2"],
- ["Part-of-Speech", "p="],
- ["Syntax", "syn="]
- ];
-
var menu = KorAP.HintMenu.create("cnx/", list);
menu.limit(3);
@@ -421,14 +421,6 @@
it('should be nextable', function () {
- var list = [
- ["Constituency", "c=", "Example 1"],
- ["Lemma", "l="],
- ["Morphology", "m=", "Example 2"],
- ["Part-of-Speech", "p="],
- ["Syntax", "syn="]
- ];
-
var menu = KorAP.HintMenu.create("cnx/", list);
// Show only 3 items
@@ -464,332 +456,249 @@
expect(menu.element().childNodes[3]).toBe(undefined);
// Activate next (3)
+ // scroll!
menu.next();
-// expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Lemma</strong>");
+
expect(menu.shownItem(0).active()).toBe(false);
-// expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
-// expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(2).active()).toBe(true);
expect(menu.element().childNodes[3]).toBe(undefined);
- });
-});
-
-
-/*
-describe('KorAP.Menu', function () {
-
-
// Activate next (4)
menu.next();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate next (5) - ROLL
menu.next();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Active next (6)
menu.next();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
-
+ expect(menu.element().childNodes[3]).toBe(undefined);
});
-
it('should be prevable', function () {
- var menu = KorAP.Menu.create("cnx/", list);
+ var menu = KorAP.HintMenu.create("cnx/", list);
- KorAP.limit = 3;
+ menu.limit(3);
expect(menu.show()).toBe(undefined);
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (1) - roll to bottom
menu.prev();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (2)
menu.prev();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (3)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Morphology");
+ expect(menu.shownItem(0).name()).toEqual("Morphology");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
+ expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Syntax");
+ expect(menu.shownItem(2).name()).toEqual("Syntax");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (4)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Lemma");
+ expect(menu.shownItem(0).name()).toEqual("Lemma");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Part-of-Speech");
+ expect(menu.shownItem(2).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (5)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Constituency");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Lemma");
+ expect(menu.shownItem(1).name()).toEqual("Lemma");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Morphology");
+ expect(menu.shownItem(2).name()).toEqual("Morphology");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Lemma");
+ expect(menu.shownItem(1).name()).toEqual("Lemma");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.shownItem(2).name).toEqual("Morphology");
+ expect(menu.shownItem(2).name()).toEqual("Morphology");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (6)
menu.prev();
// Activate prev (7)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Morphology");
+ expect(menu.shownItem(0).name()).toEqual("Morphology");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
+ expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Syntax");
+ expect(menu.shownItem(2).name()).toEqual("Syntax");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
});
- it('should be navigatable and filterable (prefix = "o")', function () {
- var menu = KorAP.Menu.create("cnx/", list);
- KorAP.limit = 2;
+ it('should be navigatable and filterable (prefix = "o")', function () {
+ var menu = KorAP.HintMenu.create("cnx/", list);
+ menu.limit(2);
expect(menu.show("o")).toBe(undefined);
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
-
// Next (2)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Morphology");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(0).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-<em>o</em>f-Speech</strong>");
+ expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (3)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
});
+
it('should be navigatable and filterable (prefix = "ex", "e")', function () {
- var menu = KorAP.Menu.create("cnx/", list);
+ var menu = KorAP.HintMenu.create("cnx/", list);
- KorAP.limit = 2;
-
+ menu.limit(2);
expect(menu.show("ex")).toBe(undefined);
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (2)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Reset limit
- KorAP.limit = 5;
+ menu.limit(5);
// Change show
expect(menu.show("e")).toBe(undefined);
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (2)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
});
});
-
-describe('KorAP.ContextAnalyzer', function () {
-
- it('should be initializable', function () {
- var analyzer = KorAP.ContextAnalyzer.create(")");
- expect(analyzer).toBe(undefined);
-
- analyzer = KorAP.ContextAnalyzer.create(".+?");
- expect(analyzer).not.toBe(undefined);
-
- });
-
- it('should check correctly', function () {
- analyzer = KorAP.ContextAnalyzer.create(KorAP.context);
- expect(analyzer.test("cnx/]cnx/c=")).toEqual("cnx/c=");
- expect(analyzer.test("cnx/c=")).toEqual("cnx/c=");
- expect(analyzer.test("cnx/c=np mate/m=mood:")).toEqual("mate/m=mood:");
- expect(analyzer.test("impcnx/")).toEqual("impcnx/");
- expect(analyzer.test("cnx/c=npcnx/")).toEqual("npcnx/");
- expect(analyzer.test("mate/m=degree:pos corenlp/ne_dewac_175m_600="))
- .toEqual("corenlp/ne_dewac_175m_600=");
- });
-});
-
-describe('KorAP.InputField', function () {
- var input;
-
- beforeAll(function () {
- input = document.createElement("input");
- input.setAttribute("type", "text");
- input.setAttribute("value", "abcdefghijklmno");
- input.style.position = 'absolute';
- input.style.top = "20px";
- input.style.left = "30px";
- input.focus();
- input.selectionStart = 5;
- });
-
- afterAll(function () {
- document.getElementsByTagName("body")[0].removeChild(input);
- document.getElementsByTagName("body")[0].removeChild(
- document.getElementById("searchMirror")
- );
- });
-
- it('should be initializable', function () {
- // Supports: context, searchField
- var inputField = KorAP.InputField.create(input);
- expect(inputField._element).not.toBe(undefined);
- });
-
- it('should have text', function () {
- var inputField = KorAP.InputField.create(input);
-
- expect(inputField.value).toEqual("abcdefghijklmno");
- expect(inputField.element.selectionStart).toEqual(5);
- expect(inputField.split()[0]).toEqual("abcde");
- expect(inputField.split()[1]).toEqual("fghijklmno");
-
- inputField.insert("xyz");
- expect(inputField.split()[0]).toEqual("abcdexyz");
- expect(inputField.split()[1]).toEqual("fghijklmno");
-
- });
-
- it('should be correctly positioned', function () {
- var inputField = KorAP.InputField.create(input);
- document.getElementsByTagName("body")[0].appendChild(input);
- inputField.reposition();
- expect(inputField.mirror.style.left).toEqual("30px");
- expect(inputField.mirror.style.top.match(/^(\d+)px$/)[1]).toBeGreaterThan(20);
- });
-});
-*/
diff --git a/public/js/spec/vcSpec.js b/public/js/spec/vcSpec.js
index 49e9275..1a24fb6 100644
--- a/public/js/spec/vcSpec.js
+++ b/public/js/spec/vcSpec.js
@@ -35,37 +35,37 @@
};
var demoFactory = buildFactory(KorAP.VirtualCollection, {
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:and",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
},
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
@@ -75,7 +75,7 @@
]
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Untertitel",
"value":"huhu",
"match":"match:eq"
@@ -90,7 +90,7 @@
var stringFactory = buildFactory(KorAP.Doc, {
"key" : "author",
"value" : "Max Birkendale",
- "@type" : "korap:doc"
+ "@type" : "koral:doc"
});
// Create example factories
@@ -99,7 +99,7 @@
"type" : "type:date",
"match" : "match:eq",
"value" : "2014-11-05",
- "@type" : "korap:doc"
+ "@type" : "koral:doc"
});
// Create example factories
@@ -107,7 +107,7 @@
"key" : "title",
"type" : "type:regex",
"value" : "[^b]ee.+?",
- "@type" : "korap:doc"
+ "@type" : "koral:doc"
});
it('should be initializable', function () {
@@ -251,7 +251,7 @@
// Serialize string
doc = stringFactory.create();
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:string",
"key" : "author",
"value" : "Max Birkendale",
@@ -261,7 +261,7 @@
// Serialize regex
doc = regexFactory.create();
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:regex",
"value" : "[^b]ee.+?",
"match" : "match:eq",
@@ -272,7 +272,7 @@
match: "match:ne"
});
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:regex",
"value" : "[^b]ee.+?",
"match" : "match:ne",
@@ -281,7 +281,7 @@
doc = dateFactory.create();
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:date",
"value" : "2014-11-05",
"match" : "match:eq",
@@ -292,7 +292,7 @@
value : "2014"
});
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:date",
"value" : "2014",
"match" : "match:eq",
@@ -339,7 +339,7 @@
var docFactory = buildFactory(
KorAP.Doc,
{
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"match":"match:eq",
"key" : "author",
"value" : "Max Birkendale"
@@ -348,7 +348,7 @@
var docGroupFactory = buildFactory(
KorAP.DocGroup, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
docFactory.create().toJson(),
@@ -455,18 +455,18 @@
var docGroup = docGroupFactory.create();
expect(docGroup.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -481,36 +481,36 @@
expect(docGroup.toQuery()).toEqual('author = "Max Birkendale" & pubDate in 2014-12-05');
docGroup = docGroupFactory.create({
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:or",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'foo',
"match": 'match:ne',
"value": '[a]?bar',
@@ -545,7 +545,7 @@
expect(docGroup.operation()).toEqual('or');
docGroup.append({
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -577,7 +577,7 @@
expect(docGroup.operation()).toEqual('or');
docGroup.append({
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -643,7 +643,7 @@
describe('KorAP.Doc element', function () {
it('should be initializable', function () {
var docElement = KorAP.Doc.create(undefined, {
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -660,7 +660,7 @@
expect(docE.children[2].getAttribute('data-type')).toEqual('string');
expect(docElement.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -672,18 +672,18 @@
it('should be initializable', function () {
var docGroup = KorAP.DocGroup.create(undefined, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -721,29 +721,29 @@
it('should be deserializable with nested groups', function () {
var docGroup = KorAP.DocGroup.create(undefined, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:or",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
@@ -787,18 +787,18 @@
describe('KorAP.VirtualCollection', function () {
var simpleGroupFactory = buildFactory(KorAP.DocGroup, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -808,29 +808,29 @@
});
var nestedGroupFactory = buildFactory(KorAP.VirtualCollection, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:or",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
@@ -842,25 +842,25 @@
});
var flatGroupFactory = buildFactory(KorAP.VirtualCollection, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'foo',
"match": 'match:eq',
"value": 'bar',
@@ -880,7 +880,7 @@
it('should be based on a doc', function () {
var vc = KorAP.VirtualCollection.render({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -1115,37 +1115,37 @@
it('should flatten on import', function () {
var vc = KorAP.VirtualCollection.create().render({
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
},
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
@@ -1155,7 +1155,7 @@
]
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Untertitel",
"value":"huhu",
"match":"match:eq"
@@ -1211,27 +1211,27 @@
describe('KorAP._delete (event)', function () {
var complexVCFactory = buildFactory(KorAP.VirtualCollection,{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:docGroup',
+ "@type" : 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'title',
'value' : 'Hello World!'
},
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1242,7 +1242,7 @@
it('should clean on root docs', function () {
var vc = KorAP.VirtualCollection.render({
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -1261,18 +1261,18 @@
it ('should remove on nested docs', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1291,18 +1291,18 @@
it ('should clean on doc groups', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1364,43 +1364,43 @@
it ('should remove on nested doc groups (list flattening)', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
},
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:docGroup',
+ "@type" : 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'title',
'value' : 'Hello World!'
},
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'yeah',
'value' : 'juhu'
}
@@ -1443,27 +1443,27 @@
describe('KorAP._add (event)', function () {
var complexVCFactory = buildFactory(KorAP.VirtualCollection,{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:docGroup',
+ "@type" : 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'title',
'value' : 'Hello World!'
},
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1475,18 +1475,18 @@
it ('should add new unspecified doc with "and"', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1520,18 +1520,18 @@
it ('should add new unspecified doc with "or"', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1710,18 +1710,18 @@
it ('should wrap on root', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1744,7 +1744,7 @@
it ('should add on root (case "and")', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -1766,7 +1766,7 @@
it ('should add on root (case "or")', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -1787,36 +1787,36 @@
it ('should support multiple sub groups per group', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'title',
"value": 't1',
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'title',
'value' : 't2'
}
]
},
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'title',
"value": 't3',
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'title',
'value' : 't4'
}
@@ -1844,7 +1844,7 @@
it('should be initializable', function () {
var rewrite = KorAP.Rewrite.create({
- "@type" : "korap:rewrite",
+ "@type" : "koral:rewrite",
"operation" : "operation:modification",
"src" : "querySerializer",
"scope" : "tree"
@@ -1855,7 +1855,7 @@
it('should be deserialized by docs', function () {
var doc = KorAP.Doc.create(undefined,
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -1866,13 +1866,13 @@
doc = KorAP.Doc.create(undefined,
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq",
"rewrites" : [
{
- "@type" : "korap:rewrite",
+ "@type" : "koral:rewrite",
"operation" : "operation:modification",
"src" : "querySerializer",
"scope" : "tree"
@@ -1888,3 +1888,11 @@
});
*/
});
+/*
+describe('KorAP.DocKey', function () {
+ it('should be initializable', function () {
+ var docKey = KorAP.DocKey.create();
+ expect(docKey.toString()).toEqual('...');
+ });
+});
+*/
diff --git a/public/js/src/menu.js b/public/js/src/menu.js
index b251000..f0dd15d 100644
--- a/public/js/src/menu.js
+++ b/public/js/src/menu.js
@@ -1,5 +1,11 @@
var KorAP = KorAP || {};
+/**
+ * Create scrollable drop-down menus.
+ *
+ * @author Nils Diewald
+ */
+
(function (KorAP) {
"use strict";
@@ -25,39 +31,63 @@
return Object.create(KorAP.Menu)._init(params);
},
+ focus : function () {
+ this._element.focus();
+ },
+
+ // Initialize list
_init : function (itemClass, params) {
// this._element.addEventListener("click", chooseHint, false);
this._itemClass = itemClass;
this._element = document.createElement("ul");
this._element.style.opacity = 0;
+/*
+ this._listener = document.createElement('input');
+ this._listener.setAttribute('type', 'text');
+// this._listener.style.display = "none";
+*/
+ this._element.addEventListener(
+ "keydown",
+ function (e) {
+ console.log('+++');
+ },
+ false
+ );
+
this.active = false;
this._items = new Array();
var i;
+
+ // Initialize item list based on parameters
for (i in params) {
var obj = itemClass.create(params[i]);
- this._items.push(
- obj
- );
+ this._items.push(obj);
};
this._limit = KorAP.menuLimit;
this._position = 0; // position in the active list
this._active = -1; // active item in the item list
-
this._reset();
return this;
},
+ /**
+ * Get the instantiated HTML element
+ */
element : function () {
return this._element;
},
+ /**
+ * Get the creator object for items
+ */
itemClass : function () {
return this._itemClass;
},
/**
- * Get and set numerical value for limit
+ * Get and set numerical value for limit,
+ * i.e. the number of items visible.
*/
limit : function (limit) {
if (arguments.length === 1)
@@ -69,7 +99,7 @@
* Upgrade this object to another object,
* while private data stays intact.
*
- * @param {Object] An object with properties.
+ * @param {Object} An object with properties.
*/
upgradeTo : function (props) {
for (var prop in props) {
@@ -78,6 +108,7 @@
return this;
},
+ // Reset chosen item and prefix
_reset : function () {
this._offset = 0;
this._pos = 0;
@@ -96,30 +127,30 @@
if (!this._initList())
return;
- // show based on offset
+ // show based on initial offset
this._showItems(0);
// Set the first element to active
+ // Todo: Or the last element chosen
this.liveItem(0).active(true);
this._position = 0;
this._active = this._list[0];
+ this._element.style.opacity = 1;
+
// Add classes for rolling menus
this._boundary(true);
},
- /**
- * Get a specific item from the complete list
- *
- * @param {number} index of the list item
- */
- item : function (index) {
- return this._items[index]
+ hide : function () {
+ this._element.style.opacity = 0;
},
+ // Initialize the list
_initList : function () {
+ // Create a new list
if (this._list === undefined) {
this._list = [];
}
@@ -131,20 +162,27 @@
// Offset is initially zero
this._offset = 0;
+ // There is no prefix set
if (this.prefix().length <= 0) {
for (var i = 0; i < this._items.length; i++)
this._list.push(i);
return true;
};
+ // There is a prefix set, so filter the list
var pos;
var paddedPrefix = " " + this.prefix();
+ // Iterate over all items and choose preferred matching items
+ // i.e. the matching happens at the word start
for (pos = 0; pos < this._items.length; pos++) {
if ((this.item(pos).lcField().indexOf(paddedPrefix)) >= 0)
this._list.push(pos);
};
+ // The list is empty - so lower your expectations
+ // Iterate over all items and choose matching items
+ // i.e. the matching happens anywhere in the word
if (this._list.length == 0) {
for (pos = 0; pos < this._items.length; pos++) {
if ((this.item(pos).lcField().indexOf(this.prefix())) >= 0)
@@ -152,7 +190,7 @@
};
};
- // Filter was successful
+ // Filter was successful - yeah!
return this._list.length > 0 ? true : false;
},
@@ -164,12 +202,13 @@
/**
* Get the prefix for filtering,
- * e.g. "ve"" for "verb"
+ * e.g. "ve" for "verb"
*/
prefix : function () {
return this._prefix || '';
},
+ // Append Items that should be shown
_showItems : function (offset) {
this.delete();
@@ -194,12 +233,16 @@
*/
delete : function () {
var child;
+
+ // Iterate over all visible items
for (var i = 0; i <= this.limit(); i++) {
+ // there is a visible element - unhighlight!
if (child = this.shownItem(i))
child.lowlight();
};
+ // Remove all children
while (child = this._element.firstChild)
this._element.removeChild(child);
},
@@ -218,10 +261,38 @@
},
+ // Prepend item to the shown list based on index
+ _prepend : function (i) {
+ var item = this.item(i);
+
+ // Highlight based on prefix
+ if (this.prefix().length > 0)
+ item.highlight(this.prefix());
+
+ var e = this.element();
+ // Append element
+ e.insertBefore(
+ item.element(),
+ e.firstChild
+ );
+ },
+
+
+ /**
+ * Get a specific item from the complete list
+ *
+ * @param {number} index of the list item
+ */
+ item : function (index) {
+ return this._items[index]
+ },
+
+
/**
* Get a specific item from the filtered list
*
* @param {number} index of the list item
+ * in the filtered list
*/
liveItem : function (index) {
if (this._list === undefined)
@@ -231,15 +302,12 @@
return this._items[this._list[index]];
},
- length : function () {
- return this._items.length;
- },
-
/**
* Get a specific item from the visible list
*
* @param {number} index of the list item
+ * in the visible list
*/
shownItem : function (index) {
if (index >= this.limit())
@@ -248,8 +316,16 @@
},
- /*
- * Make the next item in the menu active
+ /**
+ * Get the length of the full list
+ */
+ length : function () {
+ return this._items.length;
+ },
+
+
+ /**
+ * Make the next item in the filtered menu active
*/
next : function () {
// No active element set
@@ -270,7 +346,7 @@
}
// The next element is outside the view - roll down
- else if (this._position >= (this.limit + this._offset)) {
+ else if (this._position >= (this.limit() + this._offset)) {
this._removeFirst();
this._offset++;
this._append(this._list[this._position]);
@@ -282,8 +358,8 @@
/*
* Make the previous item in the menu active
*/
-/*
prev : function () {
+ // No active element set
if (this._position == -1)
return;
@@ -294,9 +370,9 @@
// The previous element is undefined - roll to bottom
if (newItem === undefined) {
- this._position = this.liveLength - 1;
+ this._offset = this.liveLength() - this.limit();
+ this._position = this.liveLength() - 1;
newItem = this.liveItem(this._position);
- this._offset = this.liveLength - this.limit;
this._showItems(this._offset);
}
@@ -306,85 +382,33 @@
this._offset--;
this._prepend(this._list[this._position]);
};
+
newItem.active(true);
},
-*/
- /**
- * Get the context of the menue,
- * e.g. "tt/" for the tree tagger menu
- */
-/*
- get context () {
- return this._context;
- },
-*/
-/*
- get liveLength () {
- if (this._list === undefined)
- this._initList();
- return this._list.length;
- },
-*/
-/*
- chooseHint : function (e) {
- var element = e.target;
- while (element.nodeName == "STRONG" || element.nodeName == "SPAN")
- element = element.parentNode;
-
- if (element === undefined || element.nodeName != "LI")
- return;
-
- var action = element.getAttribute('data-action');
- hint.insertText(action);
- var menu = hint.menu();
- menu.hide();
-
- // Fill this with the correct value
- var show;
- if ((show = hint.analyzeContext()) != "-") {
- menu.show(show);
- menu.update(
- hint._search.getBoundingClientRect().right
- );
- };
-
- hint._search.focus();
- },
-
+ // Remove the HTML node from the first item
_removeFirst : function () {
this.item(this._list[this._offset]).lowlight();
this._element.removeChild(this._element.firstChild);
},
+
+ // Remove the HTML node from the last item
_removeLast : function () {
- this.item(this._list[this._offset + this.limit - 1]).lowlight();
+ this.item(this._list[this._offset + this.limit() - 1]).lowlight();
this._element.removeChild(this._element.lastChild);
},
-
- // Prepend item to the shown list based on index
- _prepend : function (i) {
- var item = this.item(i);
-
- // Highlight based on prefix
- if (this.prefix.length > 0)
- item.highlight(this.prefix);
-
- // Append element
- this.element.insertBefore(
- item.element,
- this.element.firstChild
- );
- },
-*/
-
+ // Length of the filtered list
+ liveLength : function () {
+ if (this._list === undefined)
+ this._initList();
+ return this._list.length;
+ }
};
-
-
/**
* Item in the Dropdown menu
*/
@@ -585,4 +609,10 @@
},
};
+/*
+ KorAP._updateKey : function (e) {
+ var code = this._codeFromEvent(e)
+ };
+*/
+
}(this.KorAP));
diff --git a/public/js/src/vc.js b/public/js/src/vc.js
index d226fc4..00528aa 100644
--- a/public/js/src/vc.js
+++ b/public/js/src/vc.js
@@ -3,9 +3,13 @@
*
* @author Nils Diewald
*/
-
+/*
+ * Replaces a previous version written by Mengfei Zhou
+ */
var KorAP = KorAP || {};
+// Requires menu.js
+
/*
TODO: Implement a working localization solution!
TODO: Disable "and" or "or" in case it's followed
@@ -50,7 +54,6 @@
loc.DEL = loc.DEL || '×';
loc.EMPTY = loc.EMPTY || '⋯'
-
// Utility for analysing boolean values
function _bool (bool) {
return (bool === undefined || bool === null || bool === false) ? false : true;
@@ -148,10 +151,10 @@
if (json !== undefined) {
// Root object
- if (json['@type'] == 'korap:doc') {
+ if (json['@type'] == 'koral:doc') {
obj._root = KorAP.Doc.create(obj, json);
}
- else if (json['@type'] == 'korap:docGroup') {
+ else if (json['@type'] == 'koral:docGroup') {
obj._root = KorAP.DocGroup.create(obj, json);
}
else {
@@ -343,7 +346,7 @@
// Set JSON-LD type
var newDoc = KorAP.Doc.create(this._parent, {
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"value" : "",
"key" : v
});
@@ -374,6 +377,9 @@
ellipsis.appendChild(document.createTextNode(loc.EMPTY));
this._element.appendChild(ellipsis);
+ // Set ref - TODO: Cleanup!
+ this._element.refTo = this;
+
// Set operators
if (this._parent !== undefined && this.parent().ldType() !== null) {
var op = this.operators(
@@ -430,6 +436,9 @@
// Get element
var e = this._element;
+ // Set ref - TODO: Cleanup!
+ e.refTo = this;
+
// Check if there is a change
if (this.__changed) {
@@ -441,6 +450,10 @@
// Added key
var key = document.createElement('span');
key.setAttribute('class', 'key');
+
+ // Change key
+ key.addEventListener('click', KorAP._changeKey, false);
+
if (this.key())
key.appendChild(document.createTextNode(this.key()));
@@ -676,7 +689,7 @@
return {};
return {
- "@type" : "korap:" + this.ldType(),
+ "@type" : "koral:" + this.ldType(),
"key" : this.key(),
"match" : "match:" + this.matchop(),
"value" : this.value() || '',
@@ -810,7 +823,7 @@
KorAP.log(701, "JSON-LD group has no @type attribute");
return;
- case "korap:doc":
+ case "koral:doc":
// Be aware of cyclic structures!
var doc = KorAP.Doc.create(this, operand);
if (doc === undefined)
@@ -822,7 +835,7 @@
};
return dupl;
- case "korap:docGroup":
+ case "koral:docGroup":
// Be aware of cyclic structures!
var docGroup = KorAP.DocGroup.create(this, operand);
if (docGroup === undefined)
@@ -1039,7 +1052,7 @@
opArray.push(this._operands[i].toJson());
};
return {
- "@type" : "korap:" + this.ldType(),
+ "@type" : "koral:" + this.ldType(),
"operation" : "operation:" + this.operation(),
"operands" : opArray
};
@@ -1301,7 +1314,7 @@
toJson : function () {
return {
// Unspecified object
- "@type" : "korap:" + this.ldType()
+ "@type" : "koral:" + this.ldType()
};
},
@@ -1309,5 +1322,65 @@
return '';
}
};
+
+
+ /**
+ * Criterion in a KorAP.Doc
+ */
+ KorAP._changeKey = function () {
+ var doc = this.parentNode.refTo;
+ console.log(doc.type());
+ // key, matchop, type, value
+ };
+
+
+ // Field menu
+ KorAP.FieldMenu = {
+ create : function (params) {
+ return Object.create(KorAP.Menu)
+ .upgradeTo(KorAP.FieldMenu)
+ ._init(KorAP.FieldMenuItem, params)
+ }
+ };
+
+
+ // Field menu item
+ KorAP.FieldMenuItem = {
+ create : function (params) {
+ return Object.create(KorAP.MenuItem)
+ .upgradeTo(KorAP.FieldMenuItem)
+ ._init(params);
+ },
+ _init : function (params) {
+ if (params[0] === undefined)
+ throw new Error("Missing parameters");
+
+ this._name = params[0];
+ this._value = params[1];
+ this._type = params[2];
+
+ this._lcField = ' ' + this._name.toLowerCase();
+
+ return this;
+ },
+ name : function () {
+ return this._name;
+ },
+ type : function () {
+ return this._type;
+ },
+ element : function () {
+ // already defined
+ if (this._element !== undefined)
+ return this._element;
+
+ // Create list item
+ var li = document.createElement("li");
+ li.setAttribute("data-type", this._type);
+ li.setAttribute("data-value", this._value);
+ li.appendChild(document.createTextNode(this._name));
+ return this._element = li;
+ }
+ };
}(this.KorAP));
diff --git a/script/korap b/script/kalamar
similarity index 80%
rename from script/korap
rename to script/kalamar
index 19de56f..27e5d48 100755
--- a/script/korap
+++ b/script/kalamar
@@ -8,4 +8,4 @@
# Start command line interface for application
require Mojolicious::Commands;
-Mojolicious::Commands->start_app('Korap');
+Mojolicious::Commands->start_app('Kalamar');
diff --git a/t/api-v0.1.t b/t/api-v0.1.t
index 69e4d3f..6295421 100644
--- a/t/api-v0.1.t
+++ b/t/api-v0.1.t
@@ -85,7 +85,7 @@
my $tx = $t->ua->build_tx('TRACE', $url->clone->path('search')->query({ q => 'contains(<s>, [orth=Test])', ql => 'poliqarp'}));
$tx = $t->ua->start($tx);
-#{"@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld","query":{"@type":"korap:group","operation":"operation:position","frame":"frame:contains","operands":[{"@type":"korap:span","key":"s"},{"@type":"korap:token","wrap":{"@type":"korap:term","layer":"orth","key":"Test","match":"match:eq"}}]},"collections":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"meta":{}}
+#{"@context":"http://ids-mannheim.de/ns/korap/json-ld/v0.1/context.jsonld","query":{"@type":"korap:group","operation":"operation:position","frame":"frame:contains","operands":[{"@type":"korap:span","key":"s"},{"@type":"korap:token","wrap":{"@type":"korap:term","layer":"orth","key":"Test","match":"match:eq"}}]},"collections":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"meta":{}}
$t->tx($tx)
->json_is('/@context', 'http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld')
->json_is('/query/@type', 'korap:group')
diff --git a/t/basic.t b/t/basic.t
index 1b2419a..7511236 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -3,7 +3,7 @@
use Test::More;
use Test::Mojo;
-my $t = Test::Mojo->new('Korap');
+my $t = Test::Mojo->new('Kalamar');
$t->get_ok('/')
->status_is(200)
->text_is('title', 'KorAP')
diff --git a/t/non-blocking-api.t b/t/non-blocking-api.t
index 2d42281..d4dcc72 100644
--- a/t/non-blocking-api.t
+++ b/t/non-blocking-api.t
@@ -6,7 +6,7 @@
use Mojo::URL;
use Benchmark qw/:hireswallclock/;
-my $t = Test::Mojo->new('Korap');
+my $t = Test::Mojo->new('Kalamar');
$t->app->routes->get('/searchtest')->to(
cb => sub {
diff --git a/t/remote.t b/t/remote.t
index 8cbee3b..e08bba2 100644
--- a/t/remote.t
+++ b/t/remote.t
@@ -3,7 +3,7 @@
use Test::More;
use Test::Mojo;
-my $t = Test::Mojo->new('Korap');
+my $t = Test::Mojo->new('Kalamar');
$t->get_ok('/')
->status_is(200)
->text_is('title', 'KorAP')
diff --git a/templates/api-communication.html.ep b/templates/api-communication.html.ep
index 332f3bd..9a6ccb0 100644
--- a/templates/api-communication.html.ep
+++ b/templates/api-communication.html.ep
@@ -1,6 +1,6 @@
% use JSON::XS;
-% if (korap_test_port() && search->api_request) {
+% if (kalamar_test_port() && search->api_request) {
<pre class="query api" onclick="this.classList.toggle('active')">
<span>API Response for </span>
<span style="font-size: 70%"><%= search->api_request %></span>
diff --git a/templates/collections.html.ep b/templates/collections.html.ep
index 7399ea4..3beeba3 100644
--- a/templates/collections.html.ep
+++ b/templates/collections.html.ep
@@ -12,6 +12,6 @@
</li>
% };
</ul>
-% if (korap_test_port()) {
-<p style="font-size: 9pt; padding-left: 1em">Index port: <%= $c->url_for($c->config('KorAP')->{'api-0.1'})->port %></p>
+% if (kalamar_test_port()) {
+<p style="font-size: 9pt; padding-left: 1em">Index port: <%= $c->url_for($c->config('Kalamar')->{'api-0.1'})->port %></p>
% };
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index e83d470..f8fbb41 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -50,7 +50,7 @@
<div id="searchbar">
%= search_field 'q', id => 'q-field', autofocus => 'autofocus', placeholder => 'Find ...'
<button type="submit"><i class="fa fa-search"></i></button>
-% if (korap_test_port()) {
+% if (kalamar_test_port()) {
<button type="submit" name="action" value="inspect"><i class="fa fa-code"></i></button>
% };
<i onclick="hint.popUp()" class="fa fa-arrow-circle-down show-hint"></i>
diff --git a/templates/partial/header.html.ep b/templates/partial/header.html.ep
index a386f69..10a8487 100644
--- a/templates/partial/header.html.ep
+++ b/templates/partial/header.html.ep
@@ -1,7 +1,7 @@
<head>
<title><%= title %></title>
-%= asset 'korap.css'
-%= asset 'korap.js'
+%= asset 'kalamar.css'
+%= asset 'kalamar.js'
<meta charset="utf-8" />
<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" />
diff --git a/templates/query.html.ep b/templates/query.html.ep
index 2ffee21..f6e73be 100644
--- a/templates/query.html.ep
+++ b/templates/query.html.ep
@@ -1,7 +1,7 @@
% use JSON::XS;
% use Mojo::JSON;
-% if (search->query_jsonld && korap_test_port()) {
+% if (search->query_jsonld && kalamar_test_port()) {
% my $action;
% if (param('action') && param('action') eq 'inspect') {
% $action = ' active" style="cursor: default';
diff --git a/templates/tutorial/foundries.html.ep b/templates/tutorial/foundries.html.ep
index f3e9c6e..04f25cc 100644
--- a/templates/tutorial/foundries.html.ep
+++ b/templates/tutorial/foundries.html.ep
@@ -2,7 +2,7 @@
<h2>KorAP-Tutorial: Foundries and Layers</h2>
-<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
+<p><%= kalamar_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>
diff --git a/templates/tutorial/index.html.ep b/templates/tutorial/index.html.ep
index 19fcb4e..a7739ac 100644
--- a/templates/tutorial/index.html.ep
+++ b/templates/tutorial/index.html.ep
@@ -9,10 +9,10 @@
<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' %>
- <%= korap_tut_link_to 'Wildcards', '/tutorial/wildcards' %>
+ <%= kalamar_tut_link_to 'Poliqarp+-Tutorial', '/tutorial/poliqarp-plus' %>
+ <%= kalamar_tut_link_to 'Foundry Overview', '/tutorial/foundries' %>
+ <%= kalamar_tut_link_to 'Regular Expressions', '/tutorial/regular-expressions' %>
+ <%= kalamar_tut_link_to 'Wildcards', '/tutorial/wildcards' %>
</p>
<!--
@@ -29,7 +29,7 @@
<section id="tut-intro">
<h3>Frontend Features</h3>
- <p>This frontend differs to the <%= link_to 'official frontend', 'http://korap.ids-mannheim.de/app/', target => '_blank' %> by providing a serialization view, an integrated tutorial, a comparison view for morphological annotations, and an autocompletion for closed annotations (type in <%= korap_tut_link_to 'foundry prefixes', '/tutorial/foundries' %> like <code>cnx/</code>).</p>
+ <p>This frontend differs to the <%= link_to 'official frontend', 'http://korap.ids-mannheim.de/app/', target => '_blank' %> by providing a serialization view, an integrated tutorial, a comparison view for morphological annotations, and an autocompletion for closed annotations (type in <%= kalamar_tut_link_to 'foundry prefixes', '/tutorial/foundries' %> like <code>cnx/</code>).</p>
</section>
@@ -43,33 +43,33 @@
%# [isnt => 'json_pointer', 'result']
%# [not_ok => 'json_pointer']
-<p><strong>Poliqarp</strong>: Find all occurrences of the lemma "baum" as annotated by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
-%= korap_tut_query poliqarp => '[base=Baum]', 'tests' => [[is => '/query', 'tokens:tt/l:Baum'],[is => '/request/query/wrap/layer', 'lemma'],[is => '/request/query/wrap/foundry', 'tt'], [ok => '/matches/10']]
+<p><strong>Poliqarp</strong>: Find all occurrences of the lemma "baum" as annotated by the <%= kalamar_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
+%= kalamar_tut_query poliqarp => '[base=Baum]', 'tests' => [[is => '/query', 'tokens:tt/l:Baum'],[is => '/request/query/wrap/layer', 'lemma'],[is => '/request/query/wrap/foundry', 'tt'], [ok => '/matches/10']]
<p><strong>Poliqarp</strong>: Find all sequences of adjectives as annotated by Treetagger, that are repeated 3 to 5 times in a row.</p>
-%= korap_tut_query poliqarp => '[tt/p=ADJA]{3,5}', 'tests' => [[is => '/query', 'spanRepetition(tokens:tt/p:ADJA{3,5})'], [is => '/request/query/operation', 'operation:repetition'],[is => '/request/query/operands/0/wrap/foundry', 'tt'], [ok => '/matches/5']]
+%= kalamar_tut_query poliqarp => '[tt/p=ADJA]{3,5}', 'tests' => [[is => '/query', 'spanRepetition(tokens:tt/p:ADJA{3,5})'], [is => '/request/query/operation', 'operation:repetition'],[is => '/request/query/operands/0/wrap/foundry', 'tt'], [ok => '/matches/5']]
<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', 'tests' => [[is => '/query', 'shrink(129: spanDistance({129: tokens:s:der}, {129: tokens:s:Baum}, [(w[0:5], notOrdered, notExcluded)]))'], [is => '/request/query/operation', 'operation:focus'], [is => '/request/query/@type', 'korap:reference'],[is => '/request/query/operands/0/operands/1/operation', 'operation:class'], [is => '/itemsPerPage', 25], [ok => '/matches/20'], [is => '/matches/4/corpusID', 'WPD'], [is => '/matches/12/corpusID', 'WPD']]
+%= kalamar_tut_query cosmas2 => 'der /w5 Baum', 'tests' => [[is => '/query', 'shrink(129: spanDistance({129: tokens:s:der}, {129: tokens:s:Baum}, [(w[0:5], notOrdered, notExcluded)]))'], [is => '/request/query/operation', 'operation:focus'], [is => '/request/query/@type', 'korap:reference'],[is => '/request/query/operands/0/operands/1/operation', 'operation:class'], [is => '/itemsPerPage', 25], [ok => '/matches/20'], [is => '/matches/4/corpusID', 'WPD'], [is => '/matches/12/corpusID', 'WPD']]
-<p><strong>Cosmas-II</strong>: Find all sequences of a word starting with a "d" (using a wildcard) followed by an adjective as annotated in the mate foundry, followed by the word "Baum" (ignore the case), that is in a sentence element annotated by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
+<p><strong>Cosmas-II</strong>: Find all sequences of a word starting with a "d" (using a wildcard) followed by an adjective as annotated in the mate foundry, followed by the word "Baum" (ignore the case), that is in a sentence element annotated by the <%= kalamar_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
<p><em>Be aware</em>: Minor incompatibilities with implemented languages may be announced with warnings.</p>
-%= korap_tut_query cosmas2 => 'd* MORPH(mate/p=ADJA) $Baum #IN #ELEM(s)', 'tests' => [[ok => '/matches/3'], [is => '/query', 'shrink(130: {131: spanContain({129: <tokens:s />}, {130: spanNext(spanNext(SpanMultiTermQueryWrapper(tokens:s:d*), tokens:mate/p:ADJA), tokens:i:baum)})})'], [is => '/request/query/@type', 'korap:reference'], [is => '/request/query/operation', 'operation:focus'], [is => '/request/query/operands/0/operands/0/operation', 'operation:position'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operation', 'operation:sequence'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/0/wrap/type', 'type:wildcard'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/1/wrap/key', 'ADJA'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/1/wrap/foundry', 'mate'], [ok => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/2/wrap/caseInsensitive'], [ok => '/matches/5']]
+%= kalamar_tut_query cosmas2 => 'd* MORPH(mate/p=ADJA) $Baum #IN #ELEM(s)', 'tests' => [[ok => '/matches/3'], [is => '/query', 'shrink(130: {131: spanContain({129: <tokens:s />}, {130: spanNext(spanNext(SpanMultiTermQueryWrapper(tokens:s:d*), tokens:mate/p:ADJA), tokens:i:baum)})})'], [is => '/request/query/@type', 'korap:reference'], [is => '/request/query/operation', 'operation:focus'], [is => '/request/query/operands/0/operands/0/operation', 'operation:position'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operation', 'operation:sequence'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/0/wrap/type', 'type:wildcard'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/1/wrap/key', 'ADJA'], [is => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/1/wrap/foundry', 'mate'], [ok => '/request/query/operands/0/operands/0/operands/1/operands/0/operands/2/wrap/caseInsensitive'], [ok => '/matches/5']]
<p><strong>Poliqarp+</strong>: Find all nominal phrases as annotated using Connexor, that contain an adverb as annotated by OpenNLP, that is annotated as something starting with an "A" using regular expressions in Treetagger.</p>
-%= korap_tut_query poliqarp => 'contains(<cnx/c=np>,{[opennlp/p=ADV & tt/p="A.*"]})', cutoff => 1, 'tests' => [[is => '/query', 'spanContain(<tokens:cnx/c:np />, {1: spanSegment(tokens:opennlp/p:ADV, SpanMultiTermQueryWrapper(tokens:/tt/p:A.*/))})'], [is => '/request/query/operation', 'operation:position'], [is => '/request/query/frames/0', 'frames:contains'], [is => '/request/query/operands/0/foundry', 'cnx'], [is => '/request/query/operands/0/layer', 'c'], [is => '/request/query/operands/0/foundry', 'cnx'], [is => '/request/query/operands/0/key', 'np'], [is => '/request/query/operands/1/operands/0/wrap/operands/0/foundry', 'opennlp'], [is => '/request/query/operands/1/operands/0/wrap/operands/0/layer', 'p'], [is => '/request/query/operands/1/operands/0/wrap/operands/1/foundry', 'tt'], [is => '/request/query/operands/1/operands/0/wrap/operands/1/type', 'type:regex'], [is => '/request/query/operands/1/operands/0/wrap/operands/1/key', 'A.*'], [ok => '/matches/5']]
+%= kalamar_tut_query poliqarp => 'contains(<cnx/c=np>,{[opennlp/p=ADV & tt/p="A.*"]})', cutoff => 1, 'tests' => [[is => '/query', 'spanContain(<tokens:cnx/c:np />, {1: spanSegment(tokens:opennlp/p:ADV, SpanMultiTermQueryWrapper(tokens:/tt/p:A.*/))})'], [is => '/request/query/operation', 'operation:position'], [is => '/request/query/frames/0', 'frames:contains'], [is => '/request/query/operands/0/foundry', 'cnx'], [is => '/request/query/operands/0/layer', 'c'], [is => '/request/query/operands/0/foundry', 'cnx'], [is => '/request/query/operands/0/key', 'np'], [is => '/request/query/operands/1/operands/0/wrap/operands/0/foundry', 'opennlp'], [is => '/request/query/operands/1/operands/0/wrap/operands/0/layer', 'p'], [is => '/request/query/operands/1/operands/0/wrap/operands/1/foundry', 'tt'], [is => '/request/query/operands/1/operands/0/wrap/operands/1/type', 'type:regex'], [is => '/request/query/operands/1/operands/0/wrap/operands/1/key', 'A.*'], [ok => '/matches/5']]
-<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 "die" annotated by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>. Highlight both terms of the sequence.</p>
-%= korap_tut_query poliqarp => 'startswith(<s>, {1:[cnx/m=PRES]}{2:[base=die]})', cutoff => 1, tests => [[is => '/query', 'spanStartsWith(<tokens:s />, spanNext({1: tokens:cnx/m:PRES}, {2: tokens:tt/l:die}))'], [is => '/request/meta/startPage', 1], [is => '/request/query/operation', 'operation:position'], [is => '/request/query/operands/0/@type','korap:span'], [is => '/request/query/operands/1/operands/0/operation', 'operation:class'], [is => '/request/query/operands/1/operands/1/operation', 'operation:class'], [is => '/request/query/operands/1/operands/1/operands/0/wrap/foundry', 'tt'], [ok => '/matches/4']]
+<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 "die" annotated by the <%= kalamar_tut_link_to 'default foundry', '/tutorial/foundries' %>. Highlight both terms of the sequence.</p>
+%= kalamar_tut_query poliqarp => 'startswith(<s>, {1:[cnx/m=PRES]}{2:[base=die]})', cutoff => 1, tests => [[is => '/query', 'spanStartsWith(<tokens:s />, spanNext({1: tokens:cnx/m:PRES}, {2: tokens:tt/l:die}))'], [is => '/request/meta/startPage', 1], [is => '/request/query/operation', 'operation:position'], [is => '/request/query/operands/0/@type','korap:span'], [is => '/request/query/operands/1/operands/0/operation', 'operation:class'], [is => '/request/query/operands/1/operands/1/operation', 'operation:class'], [is => '/request/query/operands/1/operands/1/operands/0/wrap/foundry', 'tt'], [ok => '/matches/4']]
<p><strong>Poliqarp+</strong>: Find all sequences of an article, followed by three to four adjectives and a noun as annotated by the Treetagger foundry, that finish a sentence. Highlight all parts of the sequence.</p>
-%= korap_tut_query poliqarp => 'focus(3:endswith(<s>,{3:[tt/p=ART]{1:{2:[tt/p=ADJA]{3,4}}[tt/p=NN]}}))', cutoff => 1, 'tests' => [[is => '/query', 'shrink(3: spanEndsWith(<tokens:s />, {3: spanNext(tokens:tt/p:ART, {1: spanNext({2: spanRepetition(tokens:tt/p:ADJA{3,4})}, tokens:tt/p:NN)})}))'], [is => '/request/query/operation', 'operation:focus'], [is => '/request/query/operands/0/frames/0', 'frames:endswith'], [ok => '/matches/3'], [is => '/matches/4/corpusID', 'WPD']]
+%= kalamar_tut_query poliqarp => 'focus(3:endswith(<s>,{3:[tt/p=ART]{1:{2:[tt/p=ADJA]{3,4}}[tt/p=NN]}}))', cutoff => 1, 'tests' => [[is => '/query', 'shrink(3: spanEndsWith(<tokens:s />, {3: spanNext(tokens:tt/p:ART, {1: spanNext({2: spanRepetition(tokens:tt/p:ADJA{3,4})}, tokens:tt/p:NN)})}))'], [is => '/request/query/operation', 'operation:focus'], [is => '/request/query/operands/0/frames/0', 'frames:endswith'], [ok => '/matches/3'], [is => '/matches/4/corpusID', 'WPD']]
-<p><strong>Annis</strong>: Find all occurrences of the sequence of two tokens annotated as adverbs by the <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
-%= korap_tut_query annis => 'pos="ADV" & pos="ADV" & #1 . #2', 'tests' => [[is => '/query', 'spanNext(tokens:tt/p:ADV, tokens:tt/p:ADV)'], [is => '/request/query/operands/0/wrap/foundry', 'tt'], [is => '/request/query/operands/1/wrap/foundry', 'tt'], [ok => '/matches/5'], [ok => '/matches/15'], [is => '/matches/15/corpusID', 'WPD']]
+<p><strong>Annis</strong>: Find all occurrences of the sequence of two tokens annotated as adverbs by the <%= kalamar_tut_link_to 'default foundry', '/tutorial/foundries' %>.</p>
+%= kalamar_tut_query annis => 'pos="ADV" & pos="ADV" & #1 . #2', 'tests' => [[is => '/query', 'spanNext(tokens:tt/p:ADV, tokens:tt/p:ADV)'], [is => '/request/query/operands/0/wrap/foundry', 'tt'], [is => '/request/query/operands/1/wrap/foundry', 'tt'], [ok => '/matches/5'], [ok => '/matches/15'], [is => '/matches/15/corpusID', 'WPD']]
<p><strong>CQL</strong>: Find all occurrences of the sequence "der alte Mann".</p>
-%= korap_tut_query cql => '"der alte Mann"', 'tests' => [[is => '/query', 'spanNext(spanNext(tokens:s:der, tokens:s:alte), tokens:s:Mann)'], [is => '/request/query/operation', 'operation:sequence'],[is => '/request/query/operands/0/wrap/key', 'der'],[is => '/request/query/operands/1/wrap/key', 'alte'],[is => '/request/query/operands/2/wrap/key', 'Mann'], [ok => '/matches/5'], [ok => '/matches/5']]
+%= kalamar_tut_query cql => '"der alte Mann"', 'tests' => [[is => '/query', 'spanNext(spanNext(tokens:s:der, tokens:s:alte), tokens:s:Mann)'], [is => '/request/query/operation', 'operation:sequence'],[is => '/request/query/operands/0/wrap/key', 'der'],[is => '/request/query/operands/1/wrap/key', 'alte'],[is => '/request/query/operands/2/wrap/key', 'Mann'], [ok => '/matches/5'], [ok => '/matches/5']]
</section>
diff --git a/templates/tutorial/poliqarp-plus.html.ep b/templates/tutorial/poliqarp-plus.html.ep
index 22478dc..e26f707 100644
--- a/templates/tutorial/poliqarp-plus.html.ep
+++ b/templates/tutorial/poliqarp-plus.html.ep
@@ -2,7 +2,7 @@
<h2>KorAP-Tutorial: Poliqarp+</h2>
-<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
+<p><%= kalamar_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>
@@ -12,15 +12,15 @@
<p>The atomic elements of Poliqarp queries are segments. Most of the time segments represent words and can be simply queried:</p>
%# footnote: In the polish national corpus, Poliqarp can join multiple segments when identifying a single word.
-%= korap_tut_query poliqarp => 'Baum'
+%= kalamar_tut_query poliqarp => 'Baum'
<p>Sequences of simple segments are expressed using a space delimiter:</p>
-%= korap_tut_query poliqarp => 'der Baum'
+%= kalamar_tut_query poliqarp => 'der Baum'
<p>Simple segments always refer to the surface form of a word. To search for surface forms without case sensitivity, you can use the <code>/i</code> flag.</p>
-%= korap_tut_query poliqarp => 'laufen/i'
+%= kalamar_tut_query poliqarp => 'laufen/i'
<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>
@@ -28,21 +28,21 @@
<section id="tut-regexp">
<h3>Regular Expressions</h3>
-<p>Segments can also be queried using <%= korap_tut_link_to 'regular expressions', '/tutorial/regular-expressions' %> - by surrounding the segment with double quotes.</p>
+<p>Segments can also be queried using <%= kalamar_tut_link_to 'regular expressions', '/tutorial/regular-expressions' %> - by surrounding the segment with double quotes.</p>
-%= korap_tut_query poliqarp => '"l(au|ie)fen"'
+%= kalamar_tut_query poliqarp => '"l(au|ie)fen"'
<p>Regular expression segments will always match the whole segment, meaning the above query will find words starting with <code>l</code> and ending with <code>n</code>. To support subqueries, you can use the <code>/x</code> flag.
-%= korap_tut_query poliqarp => '"l(au|ie)fen"/x', cutoff => 1
+%= kalamar_tut_query poliqarp => '"l(au|ie)fen"/x', cutoff => 1
<p>The <code>/x</code> will search for all segments that contain a sequence of characters the regular expression matches. That means the above query is equivalent to:</p>
-%= korap_tut_query poliqarp => '".*?l(au|ie)fen.*?"', cutoff => 1
+%= kalamar_tut_query poliqarp => '".*?l(au|ie)fen.*?"', cutoff => 1
<p>The <code>/x</code> flag can also be used in conjuntion with strict expressions to search for substrings:</p>
-%= korap_tut_query poliqarp => 'trenn/xi', cutoff => 1
+%= kalamar_tut_query poliqarp => 'trenn/xi', cutoff => 1
<p>The above query will find all occurrences of segments including the string <code>trenn</code> case insensitive, like "Trennung", "unzertrennlich", or "Wettrennen".</p>
@@ -52,7 +52,7 @@
<p>You can again apply the <code>/i</code> flag to search case insensitive.</p>
-%= korap_tut_query poliqarp => '"l(au|ie)fen"/xi', cutoff => 1
+%= kalamar_tut_query poliqarp => '"l(au|ie)fen"/xi', cutoff => 1
</section>
@@ -65,36 +65,36 @@
%# There are more special keys in Poliqarp, but KorAP doesn't provide them.
-%= korap_tut_query poliqarp => '[orth=Baum]'
+%= kalamar_tut_query poliqarp => '[orth=Baum]'
<p>The query is thus equivalent to:</p>
-%= korap_tut_query poliqarp => 'Baum'
+%= kalamar_tut_query poliqarp => 'Baum'
<p>Complex segments expect simple expressions as values, meaning that the following expression is valid as well:</p>
-%= korap_tut_query poliqarp => '[orth="l(au|ie)fen"/xi]', cutoff => 1
+%= kalamar_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 <%= korap_tut_link_to 'default foundry', '/tutorial/foundries' %>.
+<p>Another special key is <code>base</code>, refering to the lemma annotation of the <%= kalamar_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]'
+%= kalamar_tut_query poliqarp => '[base=Baum]'
-<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' %>.
+<p>The third special key is <code>pos</code>, refering to the part-of-speech annotation of the <%= kalamar_tut_link_to 'default foundry', '/tutorial/foundries' %>.
The following query finds all attributive adjectives:</p>
-%= korap_tut_query poliqarp => '[pos=ADJA]'
+%= kalamar_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 plural words in the mate foundry, you can search using the following query:</p>
-%= korap_tut_query poliqarp => '[mate/m=number:pl]'
+%= kalamar_tut_query poliqarp => '[mate/m=number:pl]'
<h4>Negation</h4>
<p>Negation of terms in complex expressions can be expressed by prepending the equal sign with an exclamation mark or by prepending the expression with one.</p>
-%= korap_tut_query poliqarp => '[pos!=ADJA]'
-%= korap_tut_query poliqarp => '[!pos=ADJA]'
+%= kalamar_tut_query poliqarp => '[pos!=ADJA]'
+%= kalamar_tut_query poliqarp => '[!pos=ADJA]'
<blockquote class="warning">
<p>Beware: Negated complex segments can't be searched solely in the Lucene index.
@@ -105,7 +105,7 @@
<p>A special segment is the empty segment, that matches every word in the index.</p>
-%= korap_tut_query poliqarp => '[]'
+%= kalamar_tut_query poliqarp => '[]'
<p>Empty segments are useful to express distances of words by using <a href="tut-syntagmatic-operators-repetitions">repetitions</a>.</p>
@@ -122,7 +122,7 @@
<p>Not all segments are bound to words - some are bound to concepts spanning multiple words, for example noun phrases, sentences, or paragraphs.
Span segments can be searched for using angular brackets instead of square brackets.</p>
-%= korap_tut_query poliqarp => '<xip/c=INFC>'
+%= kalamar_tut_query poliqarp => '<xip/c=INFC>'
<p>Otherwise they can be treated in exactly the same way as simple or complex segments.</p>
@@ -135,25 +135,25 @@
<p>A complex segment can have multiple properties a token has to fulfill.
For example to search for all words with the surface form <code>laufe</code> (no matter if capitalized or not) that have the lemma <code>lauf</code> (and not, for example, <code>laufen</code>, which would indicate a verb or a gerund), you can search for:</p>
-%= korap_tut_query poliqarp => '[orth=laufe/i & base=Lauf]'
+%= kalamar_tut_query poliqarp => '[orth=laufe/i & base=Lauf]'
<p>The ampersand combines multiple properties with a logical AND.
Terms of the complex segment can be negated as introduced before.</p>
-%= korap_tut_query poliqarp => '[orth=laufe/i & base!=Lauf]'
+%= kalamar_tut_query poliqarp => '[orth=laufe/i & base!=Lauf]'
<p>The following query is therefore equivalent:</p>
-%= korap_tut_query poliqarp => '[orth=laufe & !base=Lauf]'
+%= kalamar_tut_query poliqarp => '[orth=laufe & !base=Lauf]'
<p>Alternatives can be expressed by using the pipe symbol:</p>
-%= korap_tut_query poliqarp => '[base=laufen | base=gehen]'
+%= kalamar_tut_query poliqarp => '[base=laufen | base=gehen]'
<p>All these sub expressions can be grouped using round brackets to form
complex boolean expressions:</p>
-%= korap_tut_query poliqarp => '[(base=laufen | base=gehen) & tt/pos=VVFIN]'
+%= kalamar_tut_query poliqarp => '[(base=laufen | base=gehen) & tt/pos=VVFIN]'
</section>
@@ -165,19 +165,19 @@
<p>Sequences can be used to search for segments in order.
For example to search for the word "alte" preceded by "der" and followed by "Mann", you can simple search for the sequence of simple expressions separated by whitespaces.</p>
-%= korap_tut_query poliqarp => 'der alte Mann'
+%= kalamar_tut_query poliqarp => 'der alte Mann'
<p>However, you can obviously search using complex segments as well:</p>
-%= korap_tut_query poliqarp => '[orth=der][orth=alte][orth=Mann]'
+%= kalamar_tut_query poliqarp => '[orth=der][orth=alte][orth=Mann]'
<p>Now you may see the benefit of the empty segment to search for words you don't know:</p>
-%= korap_tut_query poliqarp => '[orth=der][][orth=Mann]'
+%= kalamar_tut_query poliqarp => '[orth=der][][orth=Mann]'
<p>You are also able to mix segments and spans in sequences, for example to search for the word "Der" at the beginning of a sentence (which can be interpreted as the first word after the end of a sentence).</p>
-%= korap_tut_query poliqarp => '<s>[orth=Der]'
+%= kalamar_tut_query poliqarp => '<s>[orth=Der]'
<h4>Groups</h4>
@@ -188,52 +188,52 @@
You already have seen that you can search for both sequences of
<code>der alte Mann</code> and <code>der junge Mann</code> by typing in:</p>
-%= korap_tut_query poliqarp => 'der [orth=alte | orth=junge] Mann'
+%= kalamar_tut_query poliqarp => 'der [orth=alte | orth=junge] Mann'
<p>However, this formulation has problems in case you want to search for alternations of sequences rather than terms. If you want to search for both sequences of <code>dem jungen Mann</code> and <code>der alte Mann</code> you can use syntagmatic alternations and groups:</p>
-%= korap_tut_query poliqarp => '(dem jungen | der alte) Mann'
+%= kalamar_tut_query poliqarp => '(dem jungen | der alte) Mann'
<p>The pipe symbol works the same way as with the paradigmatic alternation, but supports sequences of different length as operands. The above query for <code>der alte Mann</code> and <code>der junge Mann</code> can therefor be reformulated as:</p>
-%= korap_tut_query poliqarp => 'der (junge | alte) Mann'
+%= kalamar_tut_query poliqarp => 'der (junge | alte) Mann'
<h4 id="tut-syntagmatic-operators-repetitions">Repetition</h4>
-<p>Repetitions in Poliqarp are realized as in <%= korap_tut_link_to 'regular expressions', '/tutorial/regular-expressions' %>, by giving quantifieres in curly brackets.</p>
+<p>Repetitions in Poliqarp are realized as in <%= kalamar_tut_link_to 'regular expressions', '/tutorial/regular-expressions' %>, by giving quantifieres in curly brackets.</p>
<p>To search for a sequence of three occurrences of <code>der</code>, you can formulate your query in any of the following ways - they will have the same results:</p>
-%= korap_tut_query poliqarp => 'der der der'
-%= korap_tut_query poliqarp => 'der{3}'
-%= korap_tut_query poliqarp => '[orth=der]{3}'
+%= kalamar_tut_query poliqarp => 'der der der'
+%= kalamar_tut_query poliqarp => 'der{3}'
+%= kalamar_tut_query poliqarp => '[orth=der]{3}'
<p>In difference to regular expressions, the repetition operation won't refer to the match but to the pattern given. So the following query will give you a sequence of three words having the term <code>der</code> as a substring - but the words don't have to be identical. The following query for example will match a sequence of three words all starting with <code>la</code>.</p>
-%= korap_tut_query poliqarp => '"la.*?"/i{3}'
+%= kalamar_tut_query poliqarp => '"la.*?"/i{3}'
<p>The same is true for annotations. The following query will find a sequence of 3 to 4 adjectives as annotated by the TreeTagger foundry, that is preceded by the lemma <code>ein</code> as annotated by the default foundry and followed by a noun as annotated by the XIP foundry. The adjectives do not have to be identical though.</p>
-%= korap_tut_query poliqarp => '[base=ein][tt/p=ADJA]{3,4}[xip/p=NOUN]'
+%= kalamar_tut_query poliqarp => '[base=ein][tt/p=ADJA]{3,4}[xip/p=NOUN]'
<p>In addition to numbered quantities, it is also possible to pass repetition information as Kleene operators <code>?</code>, <code>+</code>, and <code>+</code>.</p>
<p>To search for a sequence of the lemma <code>der</code> followed by the lemma <code>baum</code> as annotated by the base foundry, but allowing an optional adjective as annotated by the TreeTagger foundry in between, you can search for:</p>
-%= korap_tut_query poliqarp => '[base=die][tt/pos=ADJA]?[base=Baum]'
+%= kalamar_tut_query poliqarp => '[base=die][tt/pos=ADJA]?[base=Baum]'
<p>This query is identical to the numbered quantification of:</p>
-%= korap_tut_query poliqarp => '[base=die][tt/pos=ADJA]{,1}[base=Baum]'
+%= kalamar_tut_query poliqarp => '[base=die][tt/pos=ADJA]{,1}[base=Baum]'
<p>To search for the same sequences but with unlimited adjectives as annotated by the TreeTagger foundry in between, you can use the Kleene Star:</p>
-%= korap_tut_query poliqarp => '[base=die][tt/pos=ADJA]*[base=Baum]'
+%= kalamar_tut_query poliqarp => '[base=die][tt/pos=ADJA]*[base=Baum]'
<p>And to search for this sequence but with at least one adjective in between, you can use the Kleene Plus (all queries are identical):</p>
-%= korap_tut_query poliqarp => '[base=die][tt/pos=ADJA]+[base=Baum]', cutoff => 1
-%= korap_tut_query poliqarp => '[base=die][tt/pos=ADJA]{1,}[base=Baum]', cutoff => 1
-%= korap_tut_query poliqarp => '[base=die][tt/pos=ADJA][tt/pos=ADJA]*[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][tt/pos=ADJA]+[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][tt/pos=ADJA]{1,}[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][tt/pos=ADJA][tt/pos=ADJA]*[base=Baum]', cutoff => 1
<blockquote class="warning">
<p>Repetition operators like <code>{,4}</code>, <code>?</code>, and <code>*</code> make segments or groups of segments optional. In case these queries are used separated and not in a sequence (and there are no mandatory segments in the query), you will be warned by the system that your query won't be treated as optional.</p>
@@ -242,16 +242,16 @@
<p>Repetition can also be used to express distances between segments by using <a href="#empty-segments">empty segments</a>.</p>
-%= korap_tut_query poliqarp => '[base=die][][base=Baum]'
-%= korap_tut_query poliqarp => '[base=die][]{2}[base=Baum]', cutoff => 1
-%= korap_tut_query poliqarp => '[base=die][]{2,}[base=Baum]', cutoff => 1
-%= korap_tut_query poliqarp => '[base=die][]{,3}[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][][base=Baum]'
+%= kalamar_tut_query poliqarp => '[base=die][]{2}[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][]{2,}[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][]{,3}[base=Baum]', cutoff => 1
<p>Of course, Kleene operators can be used with empty segments as well.</p>
-%= korap_tut_query poliqarp => '[base=die][]?[base=Baum]'
-%= korap_tut_query poliqarp => '[base=die][]*[base=Baum]', cutoff => 1
-%= korap_tut_query poliqarp => '[base=die][]+[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][]?[base=Baum]'
+%= kalamar_tut_query poliqarp => '[base=die][]*[base=Baum]', cutoff => 1
+%= kalamar_tut_query poliqarp => '[base=die][]+[base=Baum]', cutoff => 1
<h4>Position</h4>
@@ -259,23 +259,23 @@
<p>Positional operators compare two matches of subqueries and will match, in case a certain condition regarding the position of both is true.</p>
<p>The <code>contains()</code> operation will match, when a second subquery matches inside the span of a first subquery.</p>
-%= korap_tut_query poliqarp => 'contains(<s>, [tt/p=KOUS])', cutoff => 1
+%= kalamar_tut_query poliqarp => 'contains(<s>, [tt/p=KOUS])', cutoff => 1
<p>The <code>startsWith()</code> operation will match, when a second subquery matches at the beginning of the span of a first subquery.</p>
-%= korap_tut_query poliqarp => 'startsWith(<s>, [tt/p=KOUS])', cutoff => 1
+%= kalamar_tut_query poliqarp => 'startsWith(<s>, [tt/p=KOUS])', cutoff => 1
<p>The <code>endsWith()</code> operation will match, when a second subquery matches at the end of the span of a first subquery.</p>
-%= korap_tut_query poliqarp => 'endsWith(<s>, [opennlp/p=NN])', cutoff => 1
+%= kalamar_tut_query poliqarp => 'endsWith(<s>, [opennlp/p=NN])', cutoff => 1
<p>The <code>matches()</code> operation will match, when a second subquery has the exact same span of a first subquery.</p>
-%= korap_tut_query poliqarp => 'matches(<s>,[tt/p=CARD][tt/p="N.*"])', cutoff => 1
+%= kalamar_tut_query poliqarp => 'matches(<s>,[tt/p=CARD][tt/p="N.*"])', cutoff => 1
<p>The <code>overlaps()</code> operation will match, when a second subquery has an overlapping span with the first subquery.</p>
-%= korap_tut_query poliqarp => 'overlaps([][tt/p=ADJA],{1:[tt/p=ADJA]}[])', cutoff => 1
+%= kalamar_tut_query poliqarp => 'overlaps([][tt/p=ADJA],{1:[tt/p=ADJA]}[])', cutoff => 1
<blockquote class="warning">
<p>Positional operators are still experimental and may change in certain aspects in the future (although the behaviour defined is intended to be stable). There is also known incorrect behaviour which will be corrected in future versions.</p>
@@ -298,9 +298,9 @@
Classes can be used to refer to sub matches in a query, similar to captures in regular expressions.
In Poliqarp+ classes have multiple purposes, with highlighting being the most intuitive one:</p>
-%= korap_tut_query poliqarp => 'der {1:{2:[]} Mann}'
+%= kalamar_tut_query poliqarp => 'der {1:{2:[]} Mann}'
-%#= korap_tut_query poliqarp => 'der {1:{2:[]{1,4}} {3:Baum}} {4:[]}'
+%#= kalamar_tut_query poliqarp => 'der {1:{2:[]{1,4}} {3:Baum}} {4:[]}'
<p>In KorAP classes can be defined from 1 to 128. In case a class number is dismissed, the class defaults to the class number 1: <code>{...}</code> is equal to <code>{1:...}</code>.</p>
@@ -308,24 +308,24 @@
<p>Based on classes, matches may be modified. The <code>focus()</code> operator restricts the span of a match to the boundary of a certain class.</p>
-%= korap_tut_query poliqarp => 'focus(der {Baum})'
+%= kalamar_tut_query poliqarp => 'focus(der {Baum})'
<p>The query above will search for the sequence <code>der Baum</code> but the match will be limited to <code>Baum</code>.
You can think of <code>der</code> in this query as a positive look-behind zero-length assertion in regular expressions.</p>
<p>But focus is way more useful if you are searching for matches without knowing the surface form. For example, to find all terms between the words "der" and "Mann" you can search:</p>
-%= korap_tut_query poliqarp => 'focus(der {[]} Mann)'
+%= kalamar_tut_query poliqarp => 'focus(der {[]} Mann)'
<p>This will limit the match to all interesting terms in between "der" and "Mann". Or you may want to search for all words following the sequence "der alte und" immediately:</p>
-%= korap_tut_query poliqarp => 'focus(der alte und {[]})'
+%= kalamar_tut_query poliqarp => 'focus(der alte und {[]})'
<!--
<p><code>focus()</code> is especially useful if you are searching for matches in certain areas, for example in quotes using positional operators.
While not being interested in the whole quote as a match, you can focus on what's really relevant to you.</p>
-%= korap_tut_query poliqarp => 'focus(1:contains(er []{,10} sagte, 1{Baum}))'
+%= kalamar_tut_query poliqarp => 'focus(1:contains(er []{,10} sagte, 1{Baum}))'
-->
<p>In case a class number is dismissed, the focus operator defaults to the class number 1: <code>focus(...)</code> is equal to <code>focus(1: ...)</code>.</p>
diff --git a/templates/tutorial/regular-expressions.html.ep b/templates/tutorial/regular-expressions.html.ep
index 3f15598..4012089 100644
--- a/templates/tutorial/regular-expressions.html.ep
+++ b/templates/tutorial/regular-expressions.html.ep
@@ -2,7 +2,7 @@
<h2>KorAP-Tutorial: Regular Expressions</h2>
-<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
+<p><%= kalamar_tut_link_to 'Back to Index', '/tutorial' %></p>
<p>The support for regular expressions in KorAP may be backend dependend. Below you can find the description for the respective backends.</p>
diff --git a/templates/tutorial/wildcards.html.ep b/templates/tutorial/wildcards.html.ep
index 39f6fa1..5086f78 100644
--- a/templates/tutorial/wildcards.html.ep
+++ b/templates/tutorial/wildcards.html.ep
@@ -2,7 +2,7 @@
<h2>KorAP-Tutorial: Wildcards</h2>
-<p><%= korap_tut_link_to 'Back to Index', '/tutorial' %></p>
+<p><%= kalamar_tut_link_to 'Back to Index', '/tutorial' %></p>
<p>The support for wildcard terms in KorAP may be backend dependend. Below you can find the description for the respective backends.</p>