com.arangodb.entity.BaseEdgeDocument Java Examples

The following examples show how to use com.arangodb.entity.BaseEdgeDocument. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
private BaseEdgeDocument createEdgeValue() throws InterruptedException, ExecutionException {
    final VertexEntity v1 = db.graph(GRAPH_NAME).vertexCollection(VERTEX_COLLECTION_NAME)
            .insertVertex(new BaseDocument(), null).get();
    final VertexEntity v2 = db.graph(GRAPH_NAME).vertexCollection(VERTEX_COLLECTION_NAME)
            .insertVertex(new BaseDocument(), null).get();

    final BaseEdgeDocument value = new BaseEdgeDocument();
    value.setFrom(v1.getId());
    value.setTo(v2.getId());
    return value;
}
 
Example #2
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void insertEdge() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = createEdgeValue();
    final EdgeEntity edge = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(value, null).get();
    assertThat(edge, is(notNullValue()));
    final BaseEdgeDocument document = db.collection(EDGE_COLLECTION_NAME)
            .getDocument(edge.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(document, is(notNullValue()));
    assertThat(document.getKey(), is(edge.getKey()));
}
 
Example #3
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void updateEdgeKeepNullFalse() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.updateAttribute("a", null);
    final EdgeUpdateOptions options = new EdgeUpdateOptions().keepNull(false);
    final EdgeUpdateEntity updateResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .updateEdge(createResult.getKey(), doc, options).get();
    assertThat(updateResult, is(notNullValue()));
    assertThat(updateResult.getId(), is(createResult.getId()));
    assertThat(updateResult.getRev(), is(not(updateResult.getOldRev())));
    assertThat(updateResult.getOldRev(), is(createResult.getRev()));

    final BaseEdgeDocument readResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(readResult.getKey(), is(createResult.getKey()));
    assertThat(readResult.getId(), is(createResult.getId()));
    assertThat(readResult.getRevision(), is(notNullValue()));
    assertThat(readResult.getProperties().keySet(), not(hasItem("a")));
}
 
Example #4
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void updateEdgeKeepNullTrue() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.updateAttribute("a", null);
    final EdgeUpdateOptions options = new EdgeUpdateOptions().keepNull(true);
    final EdgeUpdateEntity updateResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .updateEdge(createResult.getKey(), doc, options).get();
    assertThat(updateResult, is(notNullValue()));
    assertThat(updateResult.getId(), is(createResult.getId()));
    assertThat(updateResult.getRev(), is(not(updateResult.getOldRev())));
    assertThat(updateResult.getOldRev(), is(createResult.getRev()));

    final BaseEdgeDocument readResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(readResult.getKey(), is(createResult.getKey()));
    assertThat(readResult.getProperties().keySet().size(), is(1));
    assertThat(readResult.getProperties().keySet(), hasItem("a"));
}
 
Example #5
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void updateEdgeIfMatchFail() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    doc.addAttribute("c", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.updateAttribute("a", "test1");
    doc.addAttribute("b", "test");
    doc.updateAttribute("c", null);
    try {
        final EdgeUpdateOptions options = new EdgeUpdateOptions().ifMatch("no");
        db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).updateEdge(createResult.getKey(), doc, options)
                .get();
        fail();
    } catch (final ExecutionException e) {
        assertThat(e.getCause(), instanceOf(ArangoDBException.class));
    }
}
 
Example #6
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void replaceEdge() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.getProperties().clear();
    doc.addAttribute("b", "test");
    final EdgeUpdateEntity replaceResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .replaceEdge(createResult.getKey(), doc, null).get();
    assertThat(replaceResult, is(notNullValue()));
    assertThat(replaceResult.getId(), is(createResult.getId()));
    assertThat(replaceResult.getRev(), is(not(replaceResult.getOldRev())));
    assertThat(replaceResult.getOldRev(), is(createResult.getRev()));

    final BaseEdgeDocument readResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(readResult.getKey(), is(createResult.getKey()));
    assertThat(readResult.getRevision(), is(replaceResult.getRev()));
    assertThat(readResult.getProperties().keySet(), not(hasItem("a")));
    assertThat(readResult.getAttribute("b"), is(notNullValue()));
    assertThat(String.valueOf(readResult.getAttribute("b")), is("test"));
}
 
Example #7
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void replaceEdgeIfMatch() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.getProperties().clear();
    doc.addAttribute("b", "test");
    final EdgeReplaceOptions options = new EdgeReplaceOptions().ifMatch(createResult.getRev());
    final EdgeUpdateEntity replaceResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .replaceEdge(createResult.getKey(), doc, options).get();
    assertThat(replaceResult, is(notNullValue()));
    assertThat(replaceResult.getId(), is(createResult.getId()));
    assertThat(replaceResult.getRev(), is(not(replaceResult.getOldRev())));
    assertThat(replaceResult.getOldRev(), is(createResult.getRev()));

    final BaseEdgeDocument readResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(readResult.getKey(), is(createResult.getKey()));
    assertThat(readResult.getRevision(), is(replaceResult.getRev()));
    assertThat(readResult.getProperties().keySet(), not(hasItem("a")));
    assertThat(readResult.getAttribute("b"), is(notNullValue()));
    assertThat(String.valueOf(readResult.getAttribute("b")), is("test"));
}
 
Example #8
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 6 votes vote down vote up
@Test
public void replaceEdgeIfMatchFail() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.getProperties().clear();
    doc.addAttribute("b", "test");
    try {
        final EdgeReplaceOptions options = new EdgeReplaceOptions().ifMatch("no");
        db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).replaceEdge(createResult.getKey(), doc, options)
                .get();
        fail();
    } catch (final ExecutionException e) {
        assertThat(e.getCause(), instanceOf(ArangoDBException.class));
    }
}
 
Example #9
Source File: AQLActorsAndMoviesExample.java    From arangodb-java-driver with Apache License 2.0 5 votes vote down vote up
private static void saveActsIn(
        final ArangoCollectionAsync actsIn,
        final String actor,
        final String movie,
        final String[] roles,
        final int year) throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = new BaseEdgeDocument();
    value.setFrom(actor);
    value.setTo(movie);
    value.addAttribute("roles", roles);
    value.addAttribute("year", year);
    actsIn.insertDocument(value).get();
}
 
Example #10
Source File: DefaultArangoConverter.java    From spring-data with Apache License 2.0 5 votes vote down vote up
private BaseDocument readBaseDocument(final Class<?> type, final VPackSlice source) {
	@SuppressWarnings("unchecked")
	final Map<String, Object> properties = (Map<String, Object>) readMap(ClassTypeInformation.MAP, source);

	if (BaseDocument.class.equals(type)) {
		return new BaseDocument(properties);
	} //
	else if (BaseEdgeDocument.class.equals(type)) {
		return new BaseEdgeDocument(properties);
	} //
	else {
		throw new MappingException(String.format("Can't read type %s as %s!", type, BaseDocument.class));
	}
}
 
Example #11
Source File: AQLActorsAndMoviesExample.java    From arangodb-java-driver with Apache License 2.0 5 votes vote down vote up
private static void saveActsIn(
        final ArangoCollection actsIn,
        final String actor,
        final String movie,
        final String[] roles,
        final int year) {
    final BaseEdgeDocument value = new BaseEdgeDocument();
    value.setFrom(actor);
    value.setTo(movie);
    value.addAttribute("roles", roles);
    value.addAttribute("year", year);
    actsIn.insertDocument(value);
}
 
Example #12
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
  public void deleteEdgeIfMatchFail() throws InterruptedException, ExecutionException {
      final BaseEdgeDocument doc = createEdgeValue();
      final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
              .get();
      final EdgeDeleteOptions options = new EdgeDeleteOptions().ifMatch("no");
      try {
          db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).deleteEdge(createResult.getKey(), options).get();
          fail();
      } catch (final ExecutionException e) {
	assertThat(e.getCause(), instanceOf(ArangoDBException.class));
}
  }
 
Example #13
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void deleteEdgeIfMatch() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    final EdgeDeleteOptions options = new EdgeDeleteOptions().ifMatch(createResult.getRev());
    db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).deleteEdge(createResult.getKey(), options).get();
    try {
        db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
                .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
        fail();
    } catch (final ExecutionException e) {
        assertThat(e.getCause(), instanceOf(ArangoDBException.class));
    }
}
 
Example #14
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void deleteEdge() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).deleteEdge(createResult.getKey(), null).get();
    try {
        db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
                .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
        fail();
    } catch (final ExecutionException e) {
        assertThat(e.getCause(), instanceOf(ArangoDBException.class));
    }
}
 
Example #15
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void updateEdgeIfMatch() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    doc.addAttribute("c", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.updateAttribute("a", "test1");
    doc.addAttribute("b", "test");
    doc.updateAttribute("c", null);
    final EdgeUpdateOptions options = new EdgeUpdateOptions().ifMatch(createResult.getRev());
    final EdgeUpdateEntity updateResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .updateEdge(createResult.getKey(), doc, options).get();
    assertThat(updateResult, is(notNullValue()));
    assertThat(updateResult.getId(), is(createResult.getId()));
    assertThat(updateResult.getRev(), is(not(updateResult.getOldRev())));
    assertThat(updateResult.getOldRev(), is(createResult.getRev()));

    final BaseEdgeDocument readResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(readResult.getKey(), is(createResult.getKey()));
    assertThat(readResult.getAttribute("a"), is(notNullValue()));
    assertThat(String.valueOf(readResult.getAttribute("a")), is("test1"));
    assertThat(readResult.getAttribute("b"), is(notNullValue()));
    assertThat(String.valueOf(readResult.getAttribute("b")), is("test"));
    assertThat(readResult.getRevision(), is(updateResult.getRev()));
    assertThat(readResult.getProperties().keySet(), hasItem("c"));
}
 
Example #16
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void updateEdge() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument doc = createEdgeValue();
    doc.addAttribute("a", "test");
    doc.addAttribute("c", "test");
    final EdgeEntity createResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(doc, null)
            .get();
    doc.updateAttribute("a", "test1");
    doc.addAttribute("b", "test");
    doc.updateAttribute("c", null);
    final EdgeUpdateEntity updateResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .updateEdge(createResult.getKey(), doc, null).get();
    assertThat(updateResult, is(notNullValue()));
    assertThat(updateResult.getId(), is(createResult.getId()));
    assertThat(updateResult.getRev(), is(not(updateResult.getOldRev())));
    assertThat(updateResult.getOldRev(), is(createResult.getRev()));

    final BaseEdgeDocument readResult = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(createResult.getKey(), BaseEdgeDocument.class, null).get();
    assertThat(readResult.getKey(), is(createResult.getKey()));
    assertThat(readResult.getAttribute("a"), is(notNullValue()));
    assertThat(String.valueOf(readResult.getAttribute("a")), is("test1"));
    assertThat(readResult.getAttribute("b"), is(notNullValue()));
    assertThat(String.valueOf(readResult.getAttribute("b")), is("test"));
    assertThat(readResult.getRevision(), is(updateResult.getRev()));
    assertThat(readResult.getProperties().keySet(), hasItem("c"));
}
 
Example #17
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void getEdgeIfNoneMatchFail() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = createEdgeValue();
    final EdgeEntity edge = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(value, null).get();
    final GraphDocumentReadOptions options = new GraphDocumentReadOptions().ifNoneMatch(edge.getRev());
    try {
        db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
                .getEdge(edge.getKey(), BaseEdgeDocument.class, options).get();
        fail();
    } catch (final ExecutionException e) {
        assertThat(e.getCause(), instanceOf(ArangoDBException.class));
    }
}
 
Example #18
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void getEdgeIfNoneMatch() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = createEdgeValue();
    final EdgeEntity edge = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(value, null).get();
    final GraphDocumentReadOptions options = new GraphDocumentReadOptions().ifNoneMatch("no");
    final BaseDocument document = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(edge.getKey(), BaseDocument.class, options).get();
    assertThat(document, is(notNullValue()));
    assertThat(document.getKey(), is(edge.getKey()));
}
 
Example #19
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void getEdgeIfMatchFail() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = createEdgeValue();
    final EdgeEntity edge = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(value, null).get();
    final GraphDocumentReadOptions options = new GraphDocumentReadOptions().ifMatch("no");
    try {
        db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
                .getEdge(edge.getKey(), BaseEdgeDocument.class, options).get();
        fail();
    } catch (final ExecutionException e) {
        assertThat(e.getCause(), instanceOf(ArangoDBException.class));
    }
}
 
Example #20
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void getEdgeIfMatch() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = createEdgeValue();
    final EdgeEntity edge = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(value, null).get();
    final GraphDocumentReadOptions options = new GraphDocumentReadOptions().ifMatch(edge.getRev());
    final BaseDocument document = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(edge.getKey(), BaseDocument.class, options).get();
    assertThat(document, is(notNullValue()));
    assertThat(document.getKey(), is(edge.getKey()));
}
 
Example #21
Source File: ArangoEdgeCollectionTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void getEdge() throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = createEdgeValue();
    final EdgeEntity edge = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME).insertEdge(value, null).get();
    final BaseDocument document = db.graph(GRAPH_NAME).edgeCollection(EDGE_COLLECTION_NAME)
            .getEdge(edge.getKey(), BaseDocument.class, null).get();
    assertThat(document, is(notNullValue()));
    assertThat(document.getKey(), is(edge.getKey()));
}
 
Example #22
Source File: AQLActorsAndMoviesExample.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
private static void saveActsIn(
        final ArangoCollectionAsync actsIn,
        final String actor,
        final String movie,
        final String[] roles,
        final int year) throws InterruptedException, ExecutionException {
    final BaseEdgeDocument value = new BaseEdgeDocument();
    value.setFrom(actor);
    value.setTo(movie);
    value.addAttribute("roles", roles);
    value.addAttribute("year", year);
    actsIn.insertDocument(value).get();
}
 
Example #23
Source File: DefaultArangoConverter.java    From spring-data with Apache License 2.0 5 votes vote down vote up
private void writeBaseEdgeDocument(
	final String attribute,
	final BaseEdgeDocument source,
	final VPackBuilder sink,
	final TypeInformation<?> definedType) {

	final VPackBuilder builder = new VPackBuilder();
	writeMap(attribute, source.getProperties(), builder, definedType);
	builder.add(_ID, source.getId());
	builder.add(_KEY, source.getKey());
	builder.add(_REV, source.getRevision());
	builder.add(_FROM, source.getFrom());
	builder.add(_TO, source.getTo());
	sink.add(attribute, builder.slice());
}
 
Example #24
Source File: DefaultArangoConverter.java    From spring-data with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private void writeInternal(
	final String attribute,
	final Object source,
	final VPackBuilder sink,
	final TypeInformation<?> definedType) {

	final Class<?> rawType = source.getClass();
	final TypeInformation<?> type = ClassTypeInformation.from(rawType);

	if (conversions.isSimpleType(rawType)) {
		final Optional<Class<?>> customWriteTarget = conversions.getCustomWriteTarget(rawType);
		final Class<?> targetType = customWriteTarget.orElse(rawType);
		writeSimple(attribute, conversionService.convert(source, targetType), sink);
	}

	else if (BaseDocument.class.equals(rawType)) {
		writeBaseDocument(attribute, (BaseDocument) source, sink, definedType);
	}

	else if (BaseEdgeDocument.class.equals(rawType)) {
		writeBaseEdgeDocument(attribute, (BaseEdgeDocument) source, sink, definedType);
	}

	else if (type.isMap()) {
		writeMap(attribute, (Map<Object, Object>) source, sink, definedType);
	}

	else if (type.getType().isArray()) {
		writeArray(attribute, source, sink, definedType);
	}

	else if (type.isCollectionLike()) {
		writeCollection(attribute, source, sink, definedType);
	}

	else {
		final ArangoPersistentEntity<?> entity = context.getRequiredPersistentEntity(source.getClass());
		writeEntity(attribute, source, sink, entity, definedType);
	}
}