本文整理汇总了Java中com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel类的典型用法代码示例。如果您正苦于以下问题:Java BaseVertexLabel类的具体用法?Java BaseVertexLabel怎么用?Java BaseVertexLabel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseVertexLabel类属于com.thinkaurelius.titan.graphdb.types.system包,在下文中一共展示了BaseVertexLabel类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testImplicitKey
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
/**
* Test the correct application of {@link com.thinkaurelius.titan.graphdb.types.system.ImplicitKey}
* to vertices, edges, and properties.
* <p/>
* Additionally tests RelationIdentifier since this is closely related to ADJACENT and TITANID implicit keys.
*/
@Test
public void testImplicitKey() {
TitanVertex v = graph.addVertex("name", "Dan"), u = graph.addVertex();
Edge e = v.addEdge("knows", u);
graph.tx().commit();
RelationIdentifier eid = (RelationIdentifier) e.id();
assertEquals(v.id(), v.value(ID_NAME));
assertEquals(eid, e.value(ID_NAME));
assertEquals("knows", e.value(LABEL_NAME));
assertEquals(BaseVertexLabel.DEFAULT_VERTEXLABEL.name(), v.value(LABEL_NAME));
assertCount(1, v.query().direction(Direction.BOTH).labels("knows").has(ID_NAME, eid).edges());
assertCount(0, v.query().direction(Direction.BOTH).labels("knows").has(ID_NAME, RelationIdentifier.get(new long[]{4, 5, 6, 7})).edges());
assertCount(1, v.query().direction(Direction.BOTH).labels("knows").has("~nid", eid.getRelationId()).edges());
assertCount(0, v.query().direction(Direction.BOTH).labels("knows").has("~nid", 110111).edges());
//Test edge retrieval
assertNotNull(getE(graph, eid));
assertEquals(eid, getE(graph, eid).id());
//Test adjacent constraint
assertEquals(1, v.query().direction(BOTH).has("~adjacent", u.id()).edgeCount());
assertCount(1, v.query().direction(BOTH).has("~adjacent", (int) getId(u)).edges());
try {
//Not a valid vertex
assertCount(0, v.query().direction(BOTH).has("~adjacent", 110111).edges());
fail();
} catch (IllegalArgumentException ex) {
}
}
示例2: testImplicitKey
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
/**
* Test the correct application of {@link com.thinkaurelius.titan.graphdb.types.system.ImplicitKey}
* to vertices, edges, and properties.
*
* Additionally tests RelationIdentifier since this is closely related to ADJACENT and TITANID implicit keys.
*/
@Test
public void testImplicitKey() {
TitanVertex v = graph.addVertex(null), u = graph.addVertex(null);
v.setProperty("name","Dan");
Edge e = v.addEdge("knows",u);
graph.commit();
RelationIdentifier eid = (RelationIdentifier)e.getId();
assertEquals(v.getId(),v.getProperty("id"));
assertEquals(eid,e.getProperty("id"));
assertEquals("knows",e.getProperty("label"));
assertEquals(BaseVertexLabel.DEFAULT_VERTEXLABEL.getName(),v.getProperty("label"));
assertEquals(1,v.query().labels("knows").direction(BOTH).has("id",eid).count());
assertEquals(0,v.query().labels("knows").direction(BOTH).has("id",RelationIdentifier.get(new long[]{4,5,6,7})).count());
assertEquals(1,v.query().labels("knows").direction(BOTH).has("$titanid",eid.getRelationId()).count());
assertEquals(0,v.query().labels("knows").direction(BOTH).has("$titanid",110111).count());
assertEquals(1,v.query().has("$adjacent",u.getLongId()).count());
assertEquals(1,v.query().has("$adjacent",(int)u.getLongId()).count());
try {
//Not a valid vertex
assertEquals(0,v.query().has("$adjacent",110111).count());
fail();
} catch (IllegalArgumentException ex) {}
assertNotNull(graph.getEdge(eid));
assertEquals(eid,graph.getEdge(eid).getId());
//Test edge retrieval
}
示例3: getTitanVertex
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
private TitanVertex getTitanVertex(FaunusVertex faunusVertex, Mapper<NullWritable, FaunusVertex, LongWritable, Holder<FaunusVertex>>.Context context) {
if (null != loaderScript && loaderScript.hasVertexMethod()) {
return loaderScript.getVertex(faunusVertex, graph, context);
} else {
VertexLabel titanLabel = BaseVertexLabel.DEFAULT_VERTEXLABEL;
FaunusVertexLabel faunusLabel = faunusVertex.getVertexLabel();
if (!faunusLabel.isDefault()) titanLabel = graph.getVertexLabel(faunusLabel.getName());
TitanVertex tv = graph.addVertexWithLabel(titanLabel);
DEFAULT_COMPAT.incrementContextCounter(context, Counters.VERTICES_ADDED, 1L);
return tv;
}
}
示例4: getVertexLabel
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
/**
* Special handling to provide access to the label even though its a different vertex by accessing it directly
* in the enclosing transaction which will cache all vertex labels
* @return
*/
@Override
public VertexLabel getVertexLabel() {
Long labelid = getProperty(BaseLabel.VertexLabelEdge.getName());
if (labelid==null) return BaseVertexLabel.DEFAULT_VERTEXLABEL;
else return (VertexLabelVertex)tx().getInternalVertex(labelid);
}
示例5: vertexLabel
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
@Override
public VertexLabel vertexLabel() {
Vertex label = getVertexLabelInternal();
if (label==null) return BaseVertexLabel.DEFAULT_VERTEXLABEL;
else return (VertexLabelVertex)label;
}
示例6: isDefault
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
public boolean isDefault() {
return getName().equals(BaseVertexLabel.DEFAULT_VERTEXLABEL.getName());
}
示例7: getVertexLabel
import com.thinkaurelius.titan.graphdb.types.system.BaseVertexLabel; //导入依赖的package包/类
@Override
public VertexLabel getVertexLabel() {
Vertex label = getVertexLabelInternal();
if (label==null) return BaseVertexLabel.DEFAULT_VERTEXLABEL;
else return (VertexLabelVertex)label;
}