Redesign relations in snippets to be xlink conformant
Change-Id: I6aea77c632bfa3b0acbc079eb58639ae197104b1
diff --git a/Changes b/Changes
index 167c1b1..7191cff 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+0.56.1 2018-01-31
+ - [bugfix] Changed relation serialization in snippet to work
+ with segmented target anchors (diewald)
+ Warning: This is a breaking change!
+
0.55.9 2018-01-11
- [bugfix] Serialize token identifier correctly for
new corpora with text siglen (diewald)
diff --git a/pom.xml b/pom.xml
index d7d361d..78279d8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
<groupId>de.ids_mannheim.korap</groupId>
<artifactId>Krill</artifactId>
- <version>0.55.9</version>
+ <version>0.56.1</version>
<packaging>jar</packaging>
<name>Krill</name>
diff --git a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
index 2f8e274..f0ead37 100644
--- a/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
+++ b/src/main/java/de/ids_mannheim/korap/response/match/HighlightCombinatorElement.java
@@ -79,7 +79,7 @@
// ID already in use - create join
if (joins.contains(id)) {
- sb.append("<span xlink:type=\"join\" xlink:href=\"#")
+ sb.append("<span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#")
.append(id)
.append("\">");
}
@@ -114,7 +114,7 @@
sb.append("xlink:title=\"")
.append(escapeHTML(rel.annotation))
- .append("\" xlink:type=\"simple\" xlink:href=\"#")
+ .append("\" xlink:show=\"none\" xlink:href=\"#")
.append(escapeHTML(match.getPosID(rel.refStart, rel.refEnd)))
.append('"');
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index 8c4956e..f74efd8 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -355,44 +355,44 @@
"<span class=\"context-left\"></span>"+
"<span class=\"match\">"+
"<span xml:id=\"token-WDD17/982/72848-p15836-15839\">"+
- "<span xlink:title=\"lwc/d:NK\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15838\">Ein</span>"+
+ "<span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">Ein</span>"+
" "+
- "<span xlink:title=\"lwc/d:NK\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15838\">letztes</span>"+
+ "<span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">letztes</span>"+
" "+
"<span xml:id=\"token-WDD17/982/72848-p15838\">"+
- "<span xlink:title=\"lwc/d:--\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15836-15839\">mal</span>"+
+ "<span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15836-15839\">mal</span>"+
"</span>"+
": "+
"<span xml:id=\"token-WDD17/982/72848-p15839-15840\">"+
- "<span xlink:title=\"lwc/d:--\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">AL</span>"+
+ "<span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">AL</span>"+
"</span>"+
"</span>"+
- "<span xlink:type=\"join\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">"+
+ "<span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">"+
":"+
"<span xml:id=\"token-WDD17/982/72848-p15840-15846\">"+
"<span xml:id=\"token-WDD17/982/72848-p15840\">"+
- "<span xlink:title=\"lwc/d:--\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">halt</span>"+
+ "<span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">halt</span>"+
"</span>"+
"</span>"+
"</span>"+
// "<span xml:id=\"token-WDD17/982/72848-p15840-15846\">"+
- "<span xlink:type=\"join\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">"+
+ "<span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">"+
" "+
- "<span xlink:title=\"lwc/d:NK\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15842\">den</span>"+
+ "<span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15842\">den</span>"+
" "+
"<span xml:id=\"token-WDD17/982/72848-p15842\">"+
- "<span xlink:title=\"lwc/d:OA\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15843\">Ball</span>"+
+ "<span xlink:title=\"lwc/d:OA\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">Ball</span>"+
"</span>"+
" "+
"<span xml:id=\"token-WDD17/982/72848-p15843\">"+
- "<span xlink:title=\"lwc/d:PD\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15840\">flach</span>"+
+ "<span xlink:title=\"lwc/d:PD\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840\">flach</span>"+
"</span>"+
", "+
"<mark>"+
- "<span xlink:title=\"lwc/d:MO\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15845\">ganz</span>"+
+ "<span xlink:title=\"lwc/d:MO\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15845\">ganz</span>"+
" "+
"<span xml:id=\"token-WDD17/982/72848-p15845\">"+
- "<span xlink:title=\"lwc/d:CJ\" xlink:type=\"simple\" xlink:href=\"#token-WDD17/982/72848-p15843\">flach</span>"+
+ "<span xlink:title=\"lwc/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">flach</span>"+
"</span>"+
"</mark>"+
"</span>"+
@@ -485,7 +485,7 @@
+ "</span>" + "<span class=\"match\">"
+ "<mark>"
+ "<span title=\"x/o:erstens\">"
- + "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" "
+ + "<span xlink:title=\"x/rel:a\" xlink:show=\"none\" "
+ "xlink:href=\"#token-c1!d1-p3\">"
+ "a" + "</span>"
+ "</span>"
@@ -510,7 +510,7 @@
"<span class=\"context-left\">"
+ "</span>" + "<span class=\"match\">"+"<mark>"
+"<span title=\"x/o:erstens\">"
- +"<span xlink:title=\"x/rel:a\" " + "xlink:type=\"simple\" "
+ +"<span xlink:title=\"x/rel:a\" " + "xlink:show=\"none\" "
+"xlink:href=\"#token-c1!d1-p3\">a</span>"
+"</span>"
+"<span title=\"x/o:zweitens\">b</span>"
@@ -610,7 +610,7 @@
"<span title=\"f/y:one\">"+
"<span title=\"it/is:1\">"+
"<span title=\"x/o:erstens\">"+
- "<span xlink:title=\"x/rel:a\" xlink:type=\"simple\" xlink:href=\"#token-c1!d1-p3\">a</span>"+
+ "<span xlink:title=\"x/rel:a\" xlink:show=\"none\" xlink:href=\"#token-c1!d1-p3\">a</span>"+
"</span>"+
"</span>"+
"</span>"+
@@ -619,7 +619,7 @@
"<span title=\"f/y:two\">"+
"<span title=\"it/is:2\">"+
"<span title=\"x/o:zweitens\">"+
- "<span xlink:title=\"x/rel:b\" xlink:type=\"simple\" xlink:href=\"#token-c1!d1-p3\">b</span>"+
+ "<span xlink:title=\"x/rel:b\" xlink:show=\"none\" xlink:href=\"#token-c1!d1-p3\">b</span>"+
"</span>"+
"</span>"+
"</span>"+
@@ -835,38 +835,40 @@
"match-Corpus/Doc/0002-p0-6",
"tokens", "malt", null, true, false);
- assertEquals("SnippetHTML (1)",
- "<span class=\"context-left\">"+
- "</span>"+
- "<span class=\"match\">"+
- "<span xml:id=\"token-Corpus/Doc/0002-p0-6\">"+
- "<mark>"+
- "<span xml:id=\"token-Corpus/Doc/0002-p0\">"+
- "<span xlink:title=\"malt/d:ROOT\" xlink:type=\"simple\" xlink:href=\"#token-Corpus/Doc/0002-p0-6\">Maximen</span>"+
- "</span>"+
- " "+
- "<span xml:id=\"token-Corpus/Doc/0002-p1\">"+
- "<span xlink:title=\"malt/d:KON\" xlink:type=\"simple\" xlink:href=\"#token-Corpus/Doc/0002-p0\">und</span>"+
- "</span>"+
- " "+
- "<span xlink:title=\"malt/d:CJ\" xlink:type=\"simple\" xlink:href=\"#token-Corpus/Doc/0002-p1\">Reflexionen</span>"+
- " "+
- "<span xml:id=\"token-Corpus/Doc/0002-p3\">"+
- "<span xlink:title=\"malt/d:KON\" xlink:type=\"simple\" xlink:href=\"#token-Corpus/Doc/0002-p0\">Religion</span>"+
- "</span>"+
- " "+
- "<span xml:id=\"token-Corpus/Doc/0002-p4\">"+
- "<span xlink:title=\"malt/d:KON\" xlink:type=\"simple\" xlink:href=\"#token-Corpus/Doc/0002-p3\">und</span>"+
- "</span>"+
- " "+
- "<span xlink:title=\"malt/d:CJ\" xlink:type=\"simple\" xlink:href=\"#token-Corpus/Doc/0002-p4\">Christentum</span>"+
- "</mark>"+
- "</span>"+
- "</span>"+
- "<span class=\"context-right\">"+
- "<span class=\"more\"></span>"+
- "</span>",
- km.getSnippetHTML());
+ assertEquals(
+ "SnippetHTML (1)",
+ "<span class=\"context-left\">"+
+ "</span>"+
+ "<span class=\"match\">"+
+ "<span xml:id=\"token-Corpus/Doc/0002-p0-6\">"+
+ "<mark>"+
+ "<span xml:id=\"token-Corpus/Doc/0002-p0\">"+
+ "<span xlink:title=\"malt/d:ROOT\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p0-6\">Maximen</span>"+
+ "</span>"+
+ " "+
+ "<span xml:id=\"token-Corpus/Doc/0002-p1\">"+
+ "<span xlink:title=\"malt/d:KON\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p0\">und</span>"+
+ "</span>"+
+ " "+
+ "<span xlink:title=\"malt/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p1\">Reflexionen</span>"+
+ " "+
+ "<span xml:id=\"token-Corpus/Doc/0002-p3\">"+
+ "<span xlink:title=\"malt/d:KON\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p0\">Religion</span>"+
+ "</span>"+
+ " "+
+ "<span xml:id=\"token-Corpus/Doc/0002-p4\">"+
+ "<span xlink:title=\"malt/d:KON\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p3\">und</span>"+
+ "</span>"+
+ " "+
+ "<span xlink:title=\"malt/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-Corpus/Doc/0002-p4\">Christentum</span>"+
+ "</mark>"+
+ "</span>"+
+ "</span>"+
+ "<span class=\"context-right\">"+
+ "<span class=\"more\"></span>"+
+ "</span>",
+ km.getSnippetHTML()
+ );
};