Preliminary work on text siglen support
diff --git a/Changes b/Changes
index ed003ad..222ff09 100755
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+0.21 2016-07-04
+ - Use textSigle for API communication instead of
+ {corpus,doc,text}ID.
+
0.20 2016-05-25
- Improved menu using sliders.
- Improved menu to make prefixes chooseable,
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index 1af080f..80690e5 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -23,6 +23,7 @@
'docID' : 'UUU',
'textID' : '01912',
'matchID' : 'p121-122',
+ 'textSigle' : 'WPD/UUU/01912',
'available' : available
};
@@ -137,6 +138,7 @@
me.setAttribute('data-corpus-id', 'WPD');
me.setAttribute('data-doc-id', 'FFF');
me.setAttribute('data-text-id', '01460');
+ me.setAttribute('data-text-sigle', 'WPD/FFF/01460');
me.setAttribute('data-match-id', 'p119-120');
me.innerHTML = '<div><div class="snippet">check</div></div><p class="ref">me</p>';
return me;
@@ -187,6 +189,7 @@
'docID' : 'UUU',
'textID' : '01912',
'matchID' : 'p121-122',
+ 'textSigle' : 'WPD/UUU/01912',
'available' : available
};
@@ -200,9 +203,7 @@
expect(matchClass.create(match)).toBeTruthy();
var m = matchClass.create(match);
- expect(m.corpusID).toEqual("WPD");
- expect(m.docID).toEqual("UUU");
- expect(m.textID).toEqual("01912");
+ expect(m.textSigle).toEqual("WPD/UUU/01912");
expect(m.matchID).toEqual("p121-122");
// /corpus/WPD/UUU.01912/p121-122/matchInfo?spans=false&foundry=*
@@ -237,9 +238,7 @@
it('should be initializable by Node', function () {
var m = matchClass.create(matchElementFactory());
- expect(m.corpusID).toEqual("WPD");
- expect(m.docID).toEqual("FFF");
- expect(m.textID).toEqual("01460");
+ expect(m.textSigle).toEqual("WPD/FFF/01460");
expect(m.matchID).toEqual("p119-120");
// Spans:
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index eeddc58..8da1934 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -18,9 +18,12 @@
// match is a KorAP.Match object
var url = KorAP.URL;
url += '/corpus';
+/*
url += '/' + match.corpusID;
url += '/' + match.docID;
url += '/' + match.textID;
+*/
+ url += '/' + match.textSigle;
url += '/' + match.matchID;
// { spans: true, layer:x, foundry : y}
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 88c87fb..07a46ec 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -20,7 +20,8 @@
loc.SHOWINFO = loc.SHOWINFO || 'Show information';
loc.CLOSE = loc.CLOSE || 'Close';
- var _matchTerms = ['corpusID', 'docID', 'textID', 'matchID', 'available'];
+ // 'corpusID', 'docID', 'textID'
+ var _matchTerms = ['textSigle', 'matchID', 'available'];
/**
* Match object
@@ -57,10 +58,23 @@
// Circular reference !!
match["_match"] = this;
+/*
this.corpusID = match.getAttribute('data-corpus-id'),
this.docID = match.getAttribute('data-doc-id'),
this.textID = match.getAttribute('data-text-id'),
- this.matchID = match.getAttribute('data-match-id')
+*/
+ if (match.hasAttribute('data-text-sigle')) {
+ this.textSigle = match.getAttribute('data-text-sigle')
+ }
+ else {
+ this.textSigle = match.getAttribute('data-corpus-id') +
+ '/' +
+ match.getAttribute('data-doc-id') +
+ '/' +
+ match.getAttribute('data-text-id');
+ };
+
+ this.matchID = match.getAttribute('data-match-id');
// List of available annotations
this.available = match.getAttribute('data-available-info').split(' ');
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 0bc7284..e551d63 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -14,6 +14,8 @@
/*
TODO: Disable "and" or "or" in case it's followed
by an unspecified document
+ TODO: Add "and"-method to root to add further constraints based on match-
+ input (like clicking on a pubDate timestamp in a match)
TODO: Implement "persistence"-Option,
injecting the current creation date stamp
TODO: Implement vec-Type for document-id vectors
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index ee19cd7..5591cc4 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -4,7 +4,7 @@
use Mojo::JSON 'decode_json';
# Minor version - may be patched from package.json
-our $VERSION = '0.20';
+our $VERSION = '0.21';
# TODO: The FAQ-Page has a contact form for new questions
# TODO: Embed query serialization
diff --git a/package.json b/package.json
index d50b1de..507370d 100755
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "Kalamar",
"description": "Mojolicious-based Frontend for KorAP",
- "version": "0.20.0",
+ "version": "0.21.0",
"repository" : {
"type": "git",
"url": "https://github.com/KorAP/Kalamar.git"
diff --git a/templates/match.html.ep b/templates/match.html.ep
index 4f3e312..6e24489 100644
--- a/templates/match.html.ep
+++ b/templates/match.html.ep
@@ -2,11 +2,11 @@
% my $match = stash('match') || {};
% my %match_data = %$match;
% delete @match_data{qw/snippet startMore endMore field/};
-% my $id = $match->{textSigle} . '#' . $match->{matchID};
-<li data-corpus-id="<%= $match->{corpusID} %>"
- data-doc-id="<%= $match->{docID} %>"
- data-text-id="<%= $match->{textID} %>"
- data-match-id="<%= $match->{matchID} %>"
+% my $text_sigle = $match->{textSigle} // join('/', $match->{corpusID}, $match->{docID}, $match->{textID});
+% my $id = $text_sigle . '#' . $match->{matchID};
+<li data-match-id="<%= $match->{matchID} %>"
+ data-text-sigle="<%= $text_sigle %>"
+
%# TODO: This needs to be retrieved per match
data-available-info="<%= $match->{layerInfos} // $match->{layerInfo} // 'cnx/c=spans corenlp/ne=tokens corenlp/p=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens tt/l=tokens tt/p=tokens xip/c=spans' %>"
data-info="<%== b(encode_json(\%match_data))->decode->xml_escape %>"
@@ -24,6 +24,6 @@
% if ($match->{pubDate}) {
(<time datetime="<%= $match->{pubDate} %>"><%= $match->{pubDate} %></time>)\
% };
- <span class="sigle">[<%= $match->{corpusID} %>/<%= $match->{docID} %>/<%= $match->{textID} %>]</span> \
+ <span class="sigle">[<%= $text_sigle %>]</span> \
</p>
</li>