Replace operation:insertion with operation:injection (#778)
Change-Id: I0c6212b3cb3a24a3a969fa9aea0bcd09e8a204ee
diff --git a/Changes b/Changes
index 06cc8b4..43009a8 100644
--- a/Changes
+++ b/Changes
@@ -3,7 +3,8 @@
- Add institution & landingPage to the resource web-service (#777)
- Make URL mandatory for plugin registration (#573)
- Remove hidden group from test database
-- Implemented QueryContextRewrite (#755)
+- Implemented QueryContextRewrite (#755)
+- Replace operation:insertion with operation:injection (#778)
# version 0.75
diff --git a/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java b/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java
index 56b0092..970efdd 100644
--- a/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java
+++ b/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java
@@ -24,8 +24,7 @@
/**
* CollectionRewrite determines which availability field values are
- * possible for a user with respect to his mean and location of
- * access.
+ * possible for a user with respect to login and location of access.
*
* <br/><br/>
* KorAP differentiates 3 kinds of access:
@@ -36,14 +35,12 @@
* </ul>
*
* Each of these accesses corresponds to a regular expression of
- * license
- * formats defined in kustvakt.conf. For a given access, only those
+ * license formats defined in kustvakt.conf. For a given access, only those
* resources whose availability field matches its regular expression
* are allowed to be retrieved.
*
*
* @author margaretha
- * @last-update 21 Nov 2017
* @see CorpusAccess
*/
public class CollectionRewrite implements RewriteTask.RewriteQuery {
diff --git a/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java b/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java
index 0893820..52eb5dc 100644
--- a/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java
+++ b/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java
@@ -114,6 +114,10 @@
}
}
+ // EM: we agree to use injection instead because it has been introduced to
+ // public in several occasions.
+ // This method is similar to put
+ @Deprecated
public void set (String name, Object value, RewriteIdentifier ident) {
if (this.node.isObject()) {
ObjectNode n = (ObjectNode) this.node;
@@ -127,7 +131,7 @@
if (ident != null)
name = ident.toString();
- this.rewrites.add("insertion", name);
+ this.rewrites.add("injection", name);
}
}
@@ -136,7 +140,7 @@
ObjectNode n = (ObjectNode) this.node;
n.setAll(other);
}
- this.rewrites.add("insertion", null);
+ this.rewrites.add("injection", null);
}
public String get (String name) {
@@ -173,6 +177,11 @@
private String scope, value;
private Object source;
+ public RewriteIdentifier (String scope) {
+ this.scope = scope;
+ }
+
+ @Deprecated
public RewriteIdentifier (String scope, String value) {
this.scope = scope;
this.value = value;
diff --git a/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java b/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
index 3a64df9..2fe7502 100644
--- a/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
+++ b/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
@@ -102,7 +102,8 @@
koralNode.remove("ref", new RewriteIdentifier("ref", ref));
ref = ref.substring(vcOwner.length() + 1, ref.length());
- koralNode.set("ref", ref, new RewriteIdentifier("ref", ref));
+ koralNode.put("ref", ref);
+// koralNode.set("ref", ref, new RewriteIdentifier("ref", ref));
}
private void rewriteVC (QueryDO vc, KoralNode koralNode)
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestVariables.java b/src/test/java/de/ids_mannheim/korap/config/TestVariables.java
index e4658ce..b29d947 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestVariables.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestVariables.java
@@ -44,7 +44,7 @@
+ "\t\t}],\n" + "\t\t\"rewrites\": [{\n"
+ "\t\t\t\"@type\": \"koral:rewrite\",\n"
+ "\t\t\t\"src\": \"Kustvakt\",\n"
- + "\t\t\t\"operation\": \"operation:insertion\",\n"
+ + "\t\t\t\"operation\": \"operation:injection\",\n"
+ "\t\t\t\"scope\": \"corpusSigle\"\n" + "\t\t}]\n" + "\t},\n"
+ "\t\"matches\": [{\n" + "\t\t\"field\": \"tokens\",\n"
+ "\t\t\"textClass\": \"wissenschaft populaerwissenschaft\",\n"
diff --git a/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java b/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
index f35096c..b3a308f 100644
--- a/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
@@ -70,7 +70,7 @@
node = node.at("/operands/1/rewrites");
assertEquals(2, node.size());
assertEquals(node.at("/0/operation").asText(), "operation:deletion");
- assertEquals(node.at("/1/operation").asText(), "operation:insertion");
+ assertEquals(node.at("/1/operation").asText(), "operation:injection");
}
@Test
@@ -91,7 +91,7 @@
assertEquals(3, node.size());
assertEquals(node.at("/0/operation").asText(), "operation:deletion");
assertEquals(node.at("/1/operation").asText(), "operation:deletion");
- assertEquals(node.at("/2/operation").asText(), "operation:insertion");
+ assertEquals(node.at("/2/operation").asText(), "operation:injection");
}
@Test
@@ -111,7 +111,7 @@
assertEquals(3, node.size());
assertEquals(node.at("/0/operation").asText(), "operation:deletion");
assertEquals(node.at("/1/operation").asText(), "operation:deletion");
- assertEquals(node.at("/2/operation").asText(), "operation:insertion");
+ assertEquals(node.at("/2/operation").asText(), "operation:injection");
}
@Test
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
index 4ad3ba3..4cc98b0 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
@@ -26,7 +26,7 @@
assertEquals(node.at("/collection/operands/0/value").asText(),
"CC.*");
assertEquals(node.at("/collection/rewrites/0/operation").asText(),
- "operation:insertion");
+ "operation:injection");
assertEquals(node.at("/collection/rewrites/0/scope").asText(),
"availability(FREE)");
}
@@ -63,7 +63,7 @@
.asText(),
"QAO-NC");
assertEquals(node.at("/collection/rewrites/0/operation").asText(),
- "operation:insertion");
+ "operation:injection");
assertEquals(node.at("/collection/rewrites/0/scope").asText(),
"availability(PUB)");
}
@@ -74,7 +74,7 @@
assertEquals(node.at("/collection/operation").asText(),
"operation:and");
assertEquals(node.at("/collection/rewrites/0/operation").asText(),
- "operation:insertion");
+ "operation:injection");
assertEquals(node.at("/collection/rewrites/0/scope").asText(),
"availability(PUB)");
assertEquals(node.at("/collection/operands/1/match").asText(),
@@ -104,7 +104,7 @@
assertEquals(node.at("/collection/operation").asText(),
"operation:and");
assertEquals(node.at("/collection/rewrites/0/operation").asText(),
- "operation:insertion");
+ "operation:injection");
assertEquals(node.at("/collection/rewrites/0/scope").asText(),
"availability(ALL)");
assertEquals(node.at("/collection/operands/1/match").asText(),
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
index 181ec65..132f6b0 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
@@ -120,7 +120,7 @@
assertEquals("CC.*", node.at("/collection/value").asText());
assertEquals("availability(FREE)",
node.at("/collection/rewrites/0/scope").asText());
- assertEquals("operation:insertion",
+ assertEquals("operation:injection",
node.at("/collection/rewrites/0/operation").asText());
}
@@ -183,7 +183,7 @@
assertEquals("CC.*", node.at("/collection/value").asText());
assertEquals("availability(FREE)",
node.at("/collection/rewrites/0/scope").asText());
- assertEquals("operation:insertion",
+ assertEquals("operation:injection",
node.at("/collection/rewrites/0/operation").asText());
}
@@ -203,7 +203,7 @@
assertEquals("CC.*", node.at("/collection/value").asText());
assertEquals("availability(FREE)",
node.at("/collection/rewrites/0/scope").asText());
- assertEquals("operation:insertion",
+ assertEquals("operation:injection",
node.at("/collection/rewrites/0/operation").asText());
}
@@ -232,7 +232,7 @@
assertEquals("operation:or", node.at("/collection/operation").asText());
assertEquals("availability(PUB)",
node.at("/collection/rewrites/0/scope").asText());
- assertEquals("operation:insertion",
+ assertEquals("operation:injection",
node.at("/collection/rewrites/0/operation").asText());
}
@@ -264,7 +264,7 @@
assertEquals("operation:or", node.at("/collection/operation").asText());
assertEquals("availability(ALL)",
node.at("/collection/rewrites/0/scope").asText());
- assertEquals("operation:insertion",
+ assertEquals("operation:injection",
node.at("/collection/rewrites/0/operation").asText());
}
@@ -327,7 +327,7 @@
assertEquals(Status.OK.getStatusCode(), response.getStatus());
JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
assertNotNull(node);
- assertEquals("operation:insertion",
+ assertEquals("operation:injection",
node.at("/collection/rewrites/0/operation").asText());
assertEquals("availability(FREE)",
node.at("/collection/rewrites/0/scope").asText());
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
index 03a019e..39f1cf9 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
@@ -117,7 +117,7 @@
assertEquals(2, node.at("/query/wrap/key").size());
assertEquals(1, node.at("/collection/rewrites").size());
assertEquals(node.at("/collection/rewrites/0/operation").asText(),
- "operation:insertion");
+ "operation:injection");
assertEquals(node.at("/collection/rewrites/0/scope").asText(),
"availability(FREE)");
node = node.at("/query/wrap/rewrites");
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
index aeec05e..cd5e617 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
@@ -131,7 +131,7 @@
"operation:deletion");
assertEquals(node.at("/rewrites/1/scope").asText(), "ref(system-vc)");
assertEquals(node.at("/rewrites/2/operation").asText(),
- "operation:insertion");
+ "operation:injection");
}
@Test
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java
index 6b908e9..76377a2 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java
@@ -193,7 +193,7 @@
assertEquals(node.at("/0/scope").asText(), "@type(koral:docGroupRef)");
assertEquals(node.at("/1/operation").asText(), "operation:deletion");
assertEquals(node.at("/1/scope").asText(), "ref(marlin/published-vc)");
- assertEquals(node.at("/2/operation").asText(), "operation:insertion");
+ assertEquals(node.at("/2/operation").asText(), "operation:injection");
}
@Test
diff --git a/src/test/resources/network-output/search-result.jsonld b/src/test/resources/network-output/search-result.jsonld
index 2c364fd..0dbf855 100644
--- a/src/test/resources/network-output/search-result.jsonld
+++ b/src/test/resources/network-output/search-result.jsonld
@@ -64,7 +64,7 @@
{
"@type": "koral:rewrite",
"src": "Kustvakt",
- "operation": "operation:insertion",
+ "operation": "operation:injection",
"scope": "availability(FREE)"
}
]