本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getEdgeType方法的典型用法代码示例。如果您正苦于以下问题:Java OrientBaseGraph.getEdgeType方法的具体用法?Java OrientBaseGraph.getEdgeType怎么用?Java OrientBaseGraph.getEdgeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.blueprints.impls.orient.OrientBaseGraph
的用法示例。
在下文中一共展示了OrientBaseGraph.getEdgeType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEdgeType
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
private static void addEdgeType(OrientBaseGraph graph, Class<?> clasz) {
if (clasz.isAnnotationPresent(DatabaseEdge.class)) {
//DatabaseEdge classAnotation = clasz.getAnnotation(DatabaseEdge.class);
OrientEdgeType oClass = graph.getEdgeType(clasz.getSimpleName());
OrientEdgeType oClassParent = graph.getEdgeType(clasz.getSuperclass().getSimpleName());
if (clasz.getSuperclass().getSimpleName().equals(Object.class.getSimpleName())) {
oClassParent = graph.getEdgeBaseType();
}
if (oClass == null) {
logger.warn("Add Edge @" + clasz.getSimpleName() + " child of @" + oClassParent);
graph.createEdgeType(clasz.getSimpleName(), oClassParent.getName());
} else {
if (logger.isDebugEnabled())
logger.debug("Edge @" + clasz.getSimpleName() + " exist, child of @" + oClassParent);
}
}
}
示例2: edgeLookup
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
@Override
public List<Object> edgeLookup(String edgeLabel, String indexPostfix, Object key) {
OrientBaseGraph orientBaseGraph = unwrapCurrentGraph();
List<Object> ids = new ArrayList<>();
// Load the edge type in order to access the indices of the edge
OrientEdgeType edgeType = orientBaseGraph.getEdgeType(edgeLabel);
if (edgeType != null) {
// Fetch the required index
OIndex<?> index = edgeType.getClassIndex("e." + edgeLabel.toLowerCase() + "_" + indexPostfix);
if (index != null) {
// Iterate over the sb-tree index entries
OIndexCursor cursor = index.iterateEntriesMajor(new OCompositeKey(key), true, false);
while (cursor.hasNext()) {
Entry<Object, OIdentifiable> entry = cursor.nextEntry();
if (entry != null) {
OCompositeKey entryKey = (OCompositeKey) entry.getKey();
// The index returns all entries. We thus need to filter it manually
if (entryKey.getKeys().get(1).equals(key)) {
Object inId = entryKey.getKeys().get(0);
// Only add the inbound vertex id to the list of ids
ids.add(inId);
}
} else {
break;
}
}
}
}
return ids;
}
示例3: ensureEdgeTypeExistence
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
private void ensureEdgeTypeExistence(OrientBaseGraph graph, String type ) {
if( graph.getEdgeType( type ) == null ) {
graph.createEdgeType( type );
}
}