Format source code
Change-Id: I7587c31bbbd3e33d6ab999f14753e86e2089ce5a
diff --git a/src/main/java/de/ids_mannheim/korap/KrillMeta.java b/src/main/java/de/ids_mannheim/korap/KrillMeta.java
index 8ef1028..743b450 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillMeta.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillMeta.java
@@ -43,24 +43,13 @@
// Lift following fields per default
// These fields are chosen for <legacy /> reasons
- for (String field : new String[] {
- "ID",
- "UID",
- "textSigle",
- "corpusID",
- "author",
- "title",
- "subTitle",
- "textClass",
- "pubPlace",
- "pubDate",
+ for (String field : new String[] { "ID", "UID", "textSigle",
+ "corpusID", "author", "title", "subTitle", "textClass",
+ "pubPlace", "pubDate",
// "foundries",
// "tokenization",
// New:
- "layerInfos",
- "docSigle",
- "corpusSigle",
- }) {
+ "layerInfos", "docSigle", "corpusSigle", }) {
fields.add(field);
};
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index 272a027..f68e389 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -656,7 +656,7 @@
// Get prefix string corpus/doc
if (this.getTextSigle() != null) {
- id.setTextSigle(this.getTextSigle());
+ id.setTextSigle(this.getTextSigle());
}
// LEGACY
else {
diff --git a/src/main/java/de/ids_mannheim/korap/response/match/DocIdentifier.java b/src/main/java/de/ids_mannheim/korap/response/match/DocIdentifier.java
index 9b16727..660a831 100644
--- a/src/main/java/de/ids_mannheim/korap/response/match/DocIdentifier.java
+++ b/src/main/java/de/ids_mannheim/korap/response/match/DocIdentifier.java
@@ -7,10 +7,9 @@
// TODO: This should only use textSigle!
public class DocIdentifier {
- protected String
- textSigle,
- corpusID, // LEGACY
- docID; // LEGACY
+ protected String textSigle, corpusID, // LEGACY
+ docID; // LEGACY
+
// Legacy
public String getCorpusID () {
@@ -37,10 +36,12 @@
this.docID = id;
};
+
public String getTextSigle () {
return this.textSigle;
};
+
public void setTextSigle (String id) {
if (id != null && !id.contains("!"))
this.textSigle = id;
diff --git a/src/main/java/de/ids_mannheim/korap/response/match/MatchIdentifier.java b/src/main/java/de/ids_mannheim/korap/response/match/MatchIdentifier.java
index 7247d17..b559b67 100644
--- a/src/main/java/de/ids_mannheim/korap/response/match/MatchIdentifier.java
+++ b/src/main/java/de/ids_mannheim/korap/response/match/MatchIdentifier.java
@@ -93,8 +93,7 @@
sb.append(this.docID);
};
- sb.append('-')
- .append(this.getPositionString());
+ sb.append('-').append(this.getPositionString());
return sb.toString();
};
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
index b53f13a..7f74b95 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestMetaFields.java
@@ -28,7 +28,7 @@
@RunWith(JUnit4.class)
public class TestMetaFields {
-
+
@Test
public void searchMetaFields () throws IOException {
@@ -97,12 +97,13 @@
assertEquals("", res.at("/matches/0/tokenization").asText());
};
+
@Test
public void searchMetaFieldsNew () throws IOException {
// Construct index
KrillIndex ki = new KrillIndex();
- ki.addDoc(getClass().getResourceAsStream("/goe/AGX-00002.json"),false);
+ ki.addDoc(getClass().getResourceAsStream("/goe/AGX-00002.json"), false);
ki.commit();
String jsonString = getString(getClass().getResource(
@@ -114,36 +115,49 @@
JsonNode res = mapper.readTree(kr.toJsonString());
assertEquals(0, res.at("/matches/0/UID").asInt());
assertEquals("GOE_AGX.00002", res.at("/matches/0/textSigle").asText());
- assertEquals("Maximen und Reflexionen", res.at("/matches/0/title").asText());
+ assertEquals("Maximen und Reflexionen", res.at("/matches/0/title")
+ .asText());
assertEquals("1982", res.at("/matches/0/pubDate").asText());
- assertEquals("Goethe, Johann Wolfgang von", res.at("/matches/0/author").asText());
+ assertEquals("Goethe, Johann Wolfgang von", res.at("/matches/0/author")
+ .asText());
assertEquals("GOE_AGX", res.at("/matches/0/docSigle").asText());
assertEquals("GOE", res.at("/matches/0/corpusSigle").asText());
- assertEquals("Religion und Christentum", res.at("/matches/0/subTitle").asText());
+ assertEquals("Religion und Christentum", res.at("/matches/0/subTitle")
+ .asText());
assertEquals("München", res.at("/matches/0/pubPlace").asText());
- assertEquals("base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans", res.at("/matches/0/layerInfos").asText());
+ assertEquals(
+ "base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans",
+ res.at("/matches/0/layerInfos").asText());
assertTrue(res.at("/matches/0/textType").isMissingNode());
// All fields
jsonString = getString(getClass().getResource(
- "/queries/metas/fields_all.jsonld").getFile());
+ "/queries/metas/fields_all.jsonld").getFile());
ks = new Krill(jsonString);
kr = ks.apply(ki);
mapper = new ObjectMapper();
res = mapper.readTree(kr.toJsonString());
- assertEquals("Verlag C. H. Beck", res.at("/matches/0/publisher").asText());
+ assertEquals("Verlag C. H. Beck", res.at("/matches/0/publisher")
+ .asText());
assertEquals("Aphorismus", res.at("/matches/0/textType").asText());
assertEquals("Aphorismen", res.at("/matches/0/textTypeRef").asText());
- assertEquals("Goethe, Johann Wolfgang von: Maximen und Reflexionen. Religion und Christentum, [Aphorismen], (Erstveröffentlichung: Stuttgart ; Tübingen, 1827-1842), In: Goethe, Johann Wolfgang von: Goethes Werke, Bd. 12, Schriften zur Kunst. Schriften zur Literatur. Maximen und Reflexionen, Hrsg.: Trunz, Erich. München: Verlag C. H. Beck, 1982, S. 372-377", res.at("/matches/0/reference").asText());
+ assertEquals(
+ "Goethe, Johann Wolfgang von: Maximen und Reflexionen. Religion und Christentum, [Aphorismen], (Erstveröffentlichung: Stuttgart ; Tübingen, 1827-1842), In: Goethe, Johann Wolfgang von: Goethes Werke, Bd. 12, Schriften zur Kunst. Schriften zur Literatur. Maximen und Reflexionen, Hrsg.: Trunz, Erich. München: Verlag C. H. Beck, 1982, S. 372-377",
+ res.at("/matches/0/reference").asText());
assertEquals("de", res.at("/matches/0/language").asText());
- assertEquals("opennlp#tokens", res.at("/matches/0/tokenSource").asText());
- assertEquals("base base/paragraphs base/sentences connexor connexor/morpho connexor/phrase connexor/sentences connexor/syntax corenlp corenlp/constituency corenlp/morpho corenlp/namedentities corenlp/sentences glemm glemm/morpho mate mate/morpho opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences xip xip/constituency xip/morpho xip/sentences", res.at("/matches/0/foundries").asText());
+ assertEquals("opennlp#tokens", res.at("/matches/0/tokenSource")
+ .asText());
+ assertEquals(
+ "base base/paragraphs base/sentences connexor connexor/morpho connexor/phrase connexor/sentences connexor/syntax corenlp corenlp/constituency corenlp/morpho corenlp/namedentities corenlp/sentences glemm glemm/morpho mate mate/morpho opennlp opennlp/morpho opennlp/sentences treetagger treetagger/morpho treetagger/sentences xip xip/constituency xip/morpho xip/sentences",
+ res.at("/matches/0/foundries").asText());
assertEquals("Goethe-Korpus", res.at("/matches/0/corpusTitle").asText());
assertEquals("QAO-NC", res.at("/matches/0/license").asText());
- assertEquals("Goethe: Maximen und Reflexionen, (1827-1842)", res.at("/matches/0/docTitle").asText());
+ assertEquals("Goethe: Maximen und Reflexionen, (1827-1842)",
+ res.at("/matches/0/docTitle").asText());
assertEquals("1827", res.at("/matches/0/creationDate").asText());
assertEquals("372-377", res.at("/matches/0/pages").asText());
- assertEquals("match-GOE_AGX.00002-p7-8", res.at("/matches/0/ID").asText());
+ assertEquals("match-GOE_AGX.00002-p7-8", res.at("/matches/0/ID")
+ .asText());
};
};