@Test public void jsonPropertiesAreNotRegexed() { String query = util.resolveRelationships("(a {foo: 'bar'})-[:fizz*]-(end)"); assertThat(query, is("(a {foo: 'bar'})-[:`fizz`*]-(end)")); }
public String resolveRelationships(String cypher) { Matcher m = ENTAILMENT_PATTERN.matcher(cypher); StringBuffer buffer = new StringBuffer(); while (m.find()) { String varName = m.group(1); String types = m.group(2); String modifiers = m.group(3); Collection<String> resolvedTypes = resolveTypes(types, modifiers.contains("!")); modifiers = modifiers.replaceAll("!", ""); String typeString = resolvedTypes.isEmpty() ? "" : ":`" + on("`|`").join(resolvedTypes) + "`"; m.appendReplacement(buffer, "[" + varName + typeString + modifiers + "]"); } m.appendTail(buffer); return buffer.toString(); }
CypherUtil { public String resolveRelationships(String cypher) { Matcher m = ENTAILMENT_PATTERN.matcher(cypher); StringBuffer buffer = new StringBuffer(); while (m.find()) { String varName = m.group(1); String types = m.group(2); String modifiers = m.group(3); Collection<String> resolvedTypes = resolveTypes(types, modifiers.contains("!")); modifiers = modifiers.replaceAll("!", ""); String typeString = resolvedTypes.isEmpty() ? "" : ":`" + on("`|`").join(resolvedTypes) + "`"; m.appendReplacement(buffer, "[" + varName + typeString + modifiers + "]"); } m.appendTail(buffer); return buffer.toString(); } }
CypherUtil { public String resolveRelationships(String cypher) { Matcher m = ENTAILMENT_PATTERN.matcher(cypher); StringBuffer buffer = new StringBuffer(); while (m.find()) { String varName = m.group(1); String types = m.group(2); String modifiers = m.group(3); Collection<String> resolvedTypes = resolveTypes(types, modifiers.contains("!")); modifiers = modifiers.replaceAll("!", ""); String typeString = resolvedTypes.isEmpty() ? "" : ":`" + on("`|`").join(resolvedTypes) + "`"; m.appendReplacement(buffer, "[" + varName + typeString + modifiers + "]"); } m.appendTail(buffer); return buffer.toString(); } @Inject  CypherUtil(GraphDatabaseService graphDb, CurieUtil curieUtil); }
CypherUtil { public String resolveRelationships(String cypher) { Matcher m = ENTAILMENT_PATTERN.matcher(cypher); StringBuffer buffer = new StringBuffer(); while (m.find()) { String varName = m.group(1); String types = m.group(2); String modifiers = m.group(3); Collection<String> resolvedTypes = resolveTypes(types, modifiers.contains("!")); modifiers = modifiers.replaceAll("!", ""); String typeString = resolvedTypes.isEmpty() ? "" : ":`" + on("`|`").join(resolvedTypes) + "`"; m.appendReplacement(buffer, "[" + varName + typeString + modifiers + "]"); } m.appendTail(buffer); return buffer.toString(); } @Inject  CypherUtil(GraphDatabaseService graphDb, CurieUtil curieUtil); Result execute(String query, Multimap<String, Object> params, long timeout, TimeUnit unit); Result execute(String query, long timeout, TimeUnit unit); Result execute(String query, Multimap<String, Object> params); Result execute(String query); Set<RelationshipType> getEntailedRelationshipTypes(Collection<String> parents); @Deprecated String resolveStartQuery(String cypher); String resolveNodeIris(String cypher); String resolveRelationships(String cypher); Map<String, String> getCurieMap(); }
CypherUtil { public String resolveRelationships(String cypher) { Matcher m = ENTAILMENT_PATTERN.matcher(cypher); StringBuffer buffer = new StringBuffer(); while (m.find()) { String varName = m.group(1); String types = m.group(2); String modifiers = m.group(3); Collection<String> resolvedTypes = resolveTypes(types, modifiers.contains("!")); modifiers = modifiers.replaceAll("!", ""); String typeString = resolvedTypes.isEmpty() ? "" : ":`" + on("`|`").join(resolvedTypes) + "`"; m.appendReplacement(buffer, "[" + varName + typeString + modifiers + "]"); } m.appendTail(buffer); return buffer.toString(); } @Inject  CypherUtil(GraphDatabaseService graphDb, CurieUtil curieUtil); Result execute(String query, Multimap<String, Object> params, long timeout, TimeUnit unit); Result execute(String query, long timeout, TimeUnit unit); Result execute(String query, Multimap<String, Object> params); Result execute(String query); Set<RelationshipType> getEntailedRelationshipTypes(Collection<String> parents); @Deprecated String resolveStartQuery(String cypher); String resolveNodeIris(String cypher); String resolveRelationships(String cypher); Map<String, String> getCurieMap();  }