A simple annotations access framework.
Useful when you only need to know if a module, class or property definition contains an annotation in its source code and you don't have a modelbuilder.
One the phase is applied one can access the annotations through the related MEntity:
~~~nit
fun is_annotated_with_foo(mentity: AnnotatedMEntity): Bool do
return mentity.has_annotation("foo")
end
~~~
I introduced a specific super class to avoid the introduction of `annotations` directly into the MEntity since the concept of annnotations is weird when talking about a MClass or a MType.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2504
# Return `self`.
#
# ```
- # var query = (new CypherQuery).nmatch("(n)").nwhere(
- # "n.key = key").set("key", "foo")
+ # var query = (new CypherQuery).
+ # nmatch("(n)").
+ # nwhere("n.key = \{key\}").
+ # set("key", "foo")
#
# assert query.params["key"] == "foo"
# ```
assert client.is_ok
# Clear the previous objects, if any
-client.cypher(new CypherQuery.from_string("MATCH (n) WHERE n.key = {key} OPTIONAL MATCH n-[r]-() DELETE r, n"))
+client.cypher(
+ new CypherQuery.from_string(
+ "MATCH (n) WHERE n.key = \{key\} OPTIONAL MATCH n-[r]-() DELETE r, n"
+ ).set("key", key)
+)
var andres = new NeoNode
andres.labels.add_all(["PERSON", "MALE"])
var query = (new CypherQuery).
nmatch("(n: MALE)-[r: LOVES]->(m)").
nwhere("n.name = 'Andres'").
- nand("n.key = {key}").
- nreturn("n, r, m")
+ nand("n.key = \{key\}").
+ nreturn("n, r, m").
+ set("key", key)
var res7 = client.cypher(query)
assert res7.as(JsonObject)["data"].as(JsonArray).length == 1
assert client.is_ok
# Clear the previous objects, if any
-client.cypher(new CypherQuery.from_string("MATCH (n) WHERE n.key = {key} OPTIONAL MATCH n-[r]-() DELETE r, n"))
+client.cypher(
+ new CypherQuery.from_string(
+ "MATCH (n) WHERE n.key = \{key\} OPTIONAL MATCH n-[r]-() DELETE r, n"
+ ).set("key", key)
+)
print "# Save batch\n"
var query = (new CypherQuery).
nmatch("(n: MALE)-[r: LOVES]->(m)").
nwhere("n.name = 'Andres'").
- nand("n.key = {key}").
- nreturn("n, r, m")
+ nand("n.key = \{key\}").
+ nreturn("n, r, m").
+ set("key", key)
var res7 = client.cypher(query)
assert res7.as(JsonObject)["data"].as(JsonArray).length == 1