當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。