当前位置: 首页>>代码示例>>Java>>正文


Java VertexEntity类代码示例

本文整理汇总了Java中com.arangodb.entity.VertexEntity的典型用法代码示例。如果您正苦于以下问题:Java VertexEntity类的具体用法?Java VertexEntity怎么用?Java VertexEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VertexEntity类属于com.arangodb.entity包,在下文中一共展示了VertexEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replaceVertex

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void replaceVertex() throws InterruptedException, ExecutionException {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc, null)
			.get();
	doc.getProperties().clear();
	doc.addAttribute("b", "test");
	final VertexUpdateEntity replaceResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.replaceVertex(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 BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.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"));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:24,代码来源:ArangoVertexCollectionTest.java

示例2: replaceVertexIfMatch

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void replaceVertexIfMatch() throws InterruptedException, ExecutionException {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc, null)
			.get();
	doc.getProperties().clear();
	doc.addAttribute("b", "test");
	final VertexReplaceOptions options = new VertexReplaceOptions().ifMatch(createResult.getRev());
	final VertexUpdateEntity replaceResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.replaceVertex(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 BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.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"));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:25,代码来源:ArangoVertexCollectionTest.java

示例3: replaceVertexIfMatchFail

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void replaceVertexIfMatchFail() throws InterruptedException, ExecutionException {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc, null)
			.get();
	doc.getProperties().clear();
	doc.addAttribute("b", "test");
	try {
		final VertexReplaceOptions options = new VertexReplaceOptions().ifMatch("no");
		db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).replaceVertex(createResult.getKey(), doc, options)
				.get();
		fail();
	} catch (final Exception e) {
	}
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:17,代码来源:ArangoVertexCollectionTest.java

示例4: updateVertexIfMatchFail

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void updateVertexIfMatchFail() throws InterruptedException, ExecutionException {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	doc.addAttribute("c", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc, null)
			.get();
	doc.updateAttribute("a", "test1");
	doc.addAttribute("b", "test");
	doc.updateAttribute("c", null);
	try {
		final VertexUpdateOptions options = new VertexUpdateOptions().ifMatch("no");
		db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).updateVertex(createResult.getKey(), doc, options)
				.get();
		fail();
	} catch (final Exception e) {
	}
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:19,代码来源:ArangoVertexCollectionTest.java

示例5: updateVertexKeepNullTrue

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void updateVertexKeepNullTrue() throws InterruptedException, ExecutionException {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc, null)
			.get();
	doc.updateAttribute("a", null);
	final VertexUpdateOptions options = new VertexUpdateOptions().keepNull(true);
	final VertexUpdateEntity updateResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.updateVertex(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 BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.class, null).get();
	assertThat(readResult.getKey(), is(createResult.getKey()));
	assertThat(readResult.getProperties().keySet().size(), is(1));
	assertThat(readResult.getProperties().keySet(), hasItem("a"));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:22,代码来源:ArangoVertexCollectionTest.java

示例6: updateVertexKeepNullFalse

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void updateVertexKeepNullFalse() throws InterruptedException, ExecutionException {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc, null)
			.get();
	doc.updateAttribute("a", null);
	final VertexUpdateOptions options = new VertexUpdateOptions().keepNull(false);
	final VertexUpdateEntity updateResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.updateVertex(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 BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.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")));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:23,代码来源:ArangoVertexCollectionTest.java

示例7: createTerritory

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Override
	@Deprecated
	public Territory createTerritory(String name, String shortName, TerritoryTypes type, String theme, boolean showInChecklist, INodeKey parent) throws FloraOnException {
		Territory out = new Territory(name, shortName, type, theme, showInChecklist);
		try {
//			VertexEntity<Territory> ve=dbDriver.graphCreateVertex(OccurrenceConstants.TAXONOMICGRAPHNAME, NodeTypes.territory.toString(), out, false);
			VertexEntity ve = database.graph(Constants.TAXONOMICGRAPHNAME).vertexCollection(NodeTypes.territory.toString())
					.insertVertex(out, new VertexCreateOptions());
			out.setID(ve.getId());
			out.setKey(ve.getKey());
			if(parent!=null) driver.wrapNode(driver.asNodeKey(out.getID())).setPART_OF(parent);
		} catch (ArangoDBException e) {
			throw new DatabaseException(e.getMessage());
		}
		
		return out;
	}
 
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:18,代码来源:NodeWorkerDriver.java

示例8: replaceVertex

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void replaceVertex() {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc,
		null);
	doc.getProperties().clear();
	doc.addAttribute("b", "test");
	final VertexUpdateEntity replaceResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.replaceVertex(createResult.getKey(), doc, null);
	assertThat(replaceResult, is(notNullValue()));
	assertThat(replaceResult.getId(), is(createResult.getId()));
	assertThat(replaceResult.getRev(), is(not(replaceResult.getOldRev())));
	assertThat(replaceResult.getOldRev(), is(createResult.getRev()));

	final BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.class, null);
	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"));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:24,代码来源:ArangoVertexCollectionTest.java

示例9: replaceVertexIfMatch

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void replaceVertexIfMatch() {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc,
		null);
	doc.getProperties().clear();
	doc.addAttribute("b", "test");
	final VertexReplaceOptions options = new VertexReplaceOptions().ifMatch(createResult.getRev());
	final VertexUpdateEntity replaceResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.replaceVertex(createResult.getKey(), doc, options);
	assertThat(replaceResult, is(notNullValue()));
	assertThat(replaceResult.getId(), is(createResult.getId()));
	assertThat(replaceResult.getRev(), is(not(replaceResult.getOldRev())));
	assertThat(replaceResult.getOldRev(), is(createResult.getRev()));

	final BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.class, null);
	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"));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:25,代码来源:ArangoVertexCollectionTest.java

示例10: updateVertexIfMatchFail

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void updateVertexIfMatchFail() {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	doc.addAttribute("c", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc,
		null);
	doc.updateAttribute("a", "test1");
	doc.addAttribute("b", "test");
	doc.updateAttribute("c", null);
	try {
		final VertexUpdateOptions options = new VertexUpdateOptions().ifMatch("no");
		db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).updateVertex(createResult.getKey(), doc, options);
		fail();
	} catch (final ArangoDBException e) {
	}
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:18,代码来源:ArangoVertexCollectionTest.java

示例11: updateVertexKeepNullTrue

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void updateVertexKeepNullTrue() {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc,
		null);
	doc.updateAttribute("a", null);
	final VertexUpdateOptions options = new VertexUpdateOptions().keepNull(true);
	final VertexUpdateEntity updateResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.updateVertex(createResult.getKey(), doc, options);
	assertThat(updateResult, is(notNullValue()));
	assertThat(updateResult.getId(), is(createResult.getId()));
	assertThat(updateResult.getRev(), is(not(updateResult.getOldRev())));
	assertThat(updateResult.getOldRev(), is(createResult.getRev()));

	final BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.class, null);
	assertThat(readResult.getKey(), is(createResult.getKey()));
	assertThat(readResult.getProperties().keySet().size(), is(1));
	assertThat(readResult.getProperties().keySet(), hasItem("a"));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:22,代码来源:ArangoVertexCollectionTest.java

示例12: updateVertexKeepNullFalse

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void updateVertexKeepNullFalse() {
	final BaseDocument doc = new BaseDocument();
	doc.addAttribute("a", "test");
	final VertexEntity createResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME).insertVertex(doc,
		null);
	doc.updateAttribute("a", null);
	final VertexUpdateOptions options = new VertexUpdateOptions().keepNull(false);
	final VertexUpdateEntity updateResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.updateVertex(createResult.getKey(), doc, options);
	assertThat(updateResult, is(notNullValue()));
	assertThat(updateResult.getId(), is(createResult.getId()));
	assertThat(updateResult.getRev(), is(not(updateResult.getOldRev())));
	assertThat(updateResult.getOldRev(), is(createResult.getRev()));

	final BaseDocument readResult = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.getVertex(createResult.getKey(), BaseDocument.class, null);
	assertThat(readResult.getKey(), is(createResult.getKey()));
	assertThat(readResult.getId(), is(createResult.getId()));
	assertThat(readResult.getRevision(), is(notNullValue()));
	assertThat(readResult.getProperties().keySet(), not(hasItem("a")));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:23,代码来源:ArangoVertexCollectionTest.java

示例13: addExampleElements

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
private static void addExampleElements() throws ArangoDBException, InterruptedException, ExecutionException {

		// Add circle circles
		final VertexEntity vA = createVertex(new Circle("A", "1"));
		final VertexEntity vB = createVertex(new Circle("B", "2"));
		final VertexEntity vC = createVertex(new Circle("C", "3"));
		final VertexEntity vD = createVertex(new Circle("D", "4"));
		final VertexEntity vE = createVertex(new Circle("E", "5"));
		final VertexEntity vF = createVertex(new Circle("F", "6"));
		final VertexEntity vG = createVertex(new Circle("G", "7"));
		final VertexEntity vH = createVertex(new Circle("H", "8"));
		final VertexEntity vI = createVertex(new Circle("I", "9"));
		final VertexEntity vJ = createVertex(new Circle("J", "10"));
		final VertexEntity vK = createVertex(new Circle("K", "11"));

		// Add relevant edges - left branch:
		saveEdge(new CircleEdge(vA.getId(), vB.getId(), false, true, "left_bar"));
		saveEdge(new CircleEdge(vB.getId(), vC.getId(), false, true, "left_blarg"));
		saveEdge(new CircleEdge(vC.getId(), vD.getId(), false, true, "left_blorg"));
		saveEdge(new CircleEdge(vB.getId(), vE.getId(), false, true, "left_blub"));
		saveEdge(new CircleEdge(vE.getId(), vF.getId(), false, true, "left_schubi"));

		// Add relevant edges - right branch:
		saveEdge(new CircleEdge(vA.getId(), vG.getId(), false, true, "right_foo"));
		saveEdge(new CircleEdge(vG.getId(), vH.getId(), false, true, "right_blob"));
		saveEdge(new CircleEdge(vH.getId(), vI.getId(), false, true, "right_blub"));
		saveEdge(new CircleEdge(vG.getId(), vJ.getId(), false, true, "right_zip"));
		saveEdge(new CircleEdge(vJ.getId(), vK.getId(), false, true, "right_zup"));
	}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:30,代码来源:BaseGraphTest.java

示例14: createEdgeValue

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
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;
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:12,代码来源:ArangoEdgeCollectionTest.java

示例15: insertVertex

import com.arangodb.entity.VertexEntity; //导入依赖的package包/类
@Test
public void insertVertex() throws InterruptedException, ExecutionException {
	final VertexEntity vertex = db.graph(GRAPH_NAME).vertexCollection(COLLECTION_NAME)
			.insertVertex(new BaseDocument(), null).get();
	assertThat(vertex, is(notNullValue()));
	final BaseDocument document = db.collection(COLLECTION_NAME)
			.getDocument(vertex.getKey(), BaseDocument.class, null).get();
	assertThat(document, is(notNullValue()));
	assertThat(document.getKey(), is(vertex.getKey()));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:11,代码来源:ArangoVertexCollectionTest.java


注:本文中的com.arangodb.entity.VertexEntity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。