Convert { @UserFunction @Description("apoc.convert.toRelationship(value) | tries it's best to convert the value to a relationship") public Relationship toRelationship(@Name("relationship") Object relationship) { return relationship instanceof Relationship ? (Relationship) relationship : null; }  @UserFunction @Description("apoc.convert.toMap(value) | tries it's best to convert the value to a map") Map<String, Object> toMap(@Name("map") Object map); @UserFunction @Description("apoc.convert.toString(value) | tries it's best to convert the value to a string") String toString(@Name("string") Object string); @UserFunction @Description("apoc.convert.toList(value) | tries it's best to convert the value to a list") List<Object> toList(@Name("list") Object list); @UserFunction @Description("apoc.convert.toBoolean(value) | tries it's best to convert the value to a boolean") Boolean toBoolean(@Name("bool") Object bool); @UserFunction @Description("apoc.convert.toNode(value) | tries it's best to convert the value to a node") Node toNode(@Name("node") Object node); @UserFunction @Description("apoc.convert.toRelationship(value) | tries it's best to convert the value to a relationship") Relationship toRelationship(@Name("relationship") Object relationship); @SuppressWarnings("unchecked") @UserFunction @Description("apoc.convert.toSet(value) | tries it's best to convert the value to a set") List<Object> toSet(@Name("list") Object value); @UserFunction @Description("apoc.convert.toIntList(value) | tries it's best to convert " + "the value to a list of integers") List<Long> toIntList(@Name("list") Object list); @UserFunction @Description("apoc.convert.toStringList(value) | tries it's best to convert " + "the value to a list of strings") List<String> toStringList(@Name("list") Object list); @UserFunction @Description("apoc.convert.toBooleanList(value) | tries it's best to convert " + "the value to a list of booleans") List<Boolean> toBooleanList(@Name("list") Object list); @UserFunction @Description("apoc.convert.toNodeList(value) | tries it's best to convert " + "the value to a list of nodes") List<Node> toNodeList(@Name("list") Object list); @UserFunction @Description("apoc.convert.toRelationshipList(value) | tries it's best to convert " + "the value to a list of relationships") List<Relationship> toRelationshipList(@Name("list") Object list); @UserFunction @Description("apoc.convert.toInteger(value) | tries it's best to convert the value to an integer") Long toInteger(@Name("object") Object obj); @UserFunction @Description("apoc.convert.toFloat(value) | tries it's best to convert the value to a float") Double toFloat(@Name("object") Object obj); @Context
    public Log log; }
@Test public void testToRelationship() throws Exception { testCall(db, "CREATE (n)-[r:KNOWS]->(m) WITH [r] as x RETURN apoc.convert.toRelationship(x[0]) AS rel", r -> assertEquals(true, r.get("rel") instanceof Relationship)); testCall(db, "RETURN apoc.convert.toRelationship(null) AS rel", r -> assertEquals(null, r.get("rel"))); }