Preliminary work on text siglen support
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