本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientBaseGraph类的典型用法代码示例。如果您正苦于以下问题:Java OrientBaseGraph类的具体用法?Java OrientBaseGraph怎么用?Java OrientBaseGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrientBaseGraph类属于com.tinkerpop.blueprints.impls.orient包,在下文中一共展示了OrientBaseGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initEdge
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
public static void initEdge(OrientBaseGraph graph) {
Map<String, Class<?>> map = new TreeMap<>();
for (Class<?> clasz : ReflectionsFactory.getReflections(eRelation.class).getTypesAnnotatedWith(DatabaseEdge.class)) {
logger.info(clasz.getName());
if (clasz.getSuperclass() != null) {
map.put(getAllSuperclass(clasz), clasz);
}
}
for (Entry<String, Class<?>> es : map.entrySet()) {
addEdgeType(graph, es.getValue());
}
}
示例2: 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);
}
}
}
示例3: setParents
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
final void setParents(List<jBaseLight> list) {
if (list == null)
list = new ArrayList<>();
// Optimization
OrientBaseGraph graph = this.getGraph();
setEdges(
graph,
vAclGroup.class,
this,
vAclGroup.class,
list.stream().map(e -> get(graph, vAclGroup.class, e, false)).collect(Collectors.toList()),
DirectionType.PARENT,
eAclNoTraverse.class,
false);
}
示例4: setAclAdmin
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
final void setAclAdmin(List<enAclAdmin> list) {
if(list == null)
list = new ArrayList<>();
// Optimization
OrientBaseGraph graph = this.getGraph();
setEdges(
graph,
vAclGroup.class,
this,
vAclAdmin.class,
list.stream().map(e -> vAclAdmin.get(graph, vAclAdmin.class, e.name())).collect(Collectors.toList()),
DirectionType.PARENT,
eAclNoTraverse.class,
false);
}
示例5: setAclData
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
final void setAclData(List<enAclData> list) {
if(list == null)
list = new ArrayList<>();
// Optimization
OrientBaseGraph graph = this.getGraph();
setEdges(
graph,
vAclGroup.class,
this,
vAclData.class,
list.stream().map(e -> vAclData.get(graph, vAclData.class, e.name())).collect(Collectors.toList()),
DirectionType.PARENT,
eAclNoTraverse.class,
false);
}
示例6: setChilds
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
private void setChilds(List<jBaseLight> list) {
if(list == null)
list = new ArrayList<>();
// Optimization
OrientBaseGraph graph = this.getGraph();
setEdges(
graph,
vPath.class,
this,
vPath.class,
list.stream().map(e -> get(graph, vPath.class, e, false)).collect(Collectors.toList()),
DirectionType.CHILD,
eInPath.class,
false);
}
示例7: setChildObjects
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
private void setChildObjects(List<jBaseLight> list) {
if(list == null)
list = new ArrayList<>();
// Optimization
OrientBaseGraph graph = this.getGraph();
setEdges(
graph,
vAcl.class,
this,
vBaseChildAcl.class,
list.stream().map(e -> get(graph, vBaseChildAcl.class, e, true)).collect(Collectors.toList()),
DirectionType.CHILD,
eAclRelation.class,
true);
}
示例8: get
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
public static <T extends vBaseAbstract> T get(final OrientBaseGraph graph, final Class<T> target, final Rid rid, boolean isInstanceof)
{
if(rid == null)
return null;
String cmdSQL = "SELECT FROM " + rid.getFull() + " WHERE " + WhereClause.IsntanceOf(target, isInstanceof);
List<T> list = vBaseAbstract.commandBaseAbstract(graph, target, cmdSQL);
if(list.size() == 0) {
return null;
}
if(list.size() > 1) {
throw new RuntimeException(String.format("rid is not unique : %s", rid));
}
return list.get(0);
}
示例9: initializeData
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
@Override
public void initializeData() {
final OrientBaseGraph db = context.getConnection();
// init only empty database
if (db.countVertices(CLASS_NAME) > 0) {
return;
}
Vertex previous = null;
for (int i = 0; i < 10; i++) {
// note usage of "class:" prefix - it is required to reference registered class,
// otherwise orient could try to register new class
final Vertex node = db.addVertex("class:" + CLASS_NAME,
"name", "Sample" + i,
"amount", (int) (Math.random() * 200));
if (previous != null) {
// bottom-up connection: second Sample BelongsTo previous sample (graph is directed)
node.addEdge("belongsTo", previous);
}
previous = node;
}
}
示例10: checkIndexUniqueness
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
@Override
public <T extends MeshElement> T checkIndexUniqueness(String indexName, T element, Object key) {
FramedGraph graph = Tx.getActive().getGraph();
OrientBaseGraph orientBaseGraph = unwrapCurrentGraph();
OrientVertexType vertexType = orientBaseGraph.getVertexType(element.getClass().getSimpleName());
if (vertexType != null) {
OIndex<?> index = vertexType.getClassIndex(indexName);
if (index != null) {
Object recordId = index.get(key);
if (recordId != null) {
if (recordId.equals(element.getElement().getId())) {
return null;
} else {
return (T) graph.getFramedVertexExplicit(element.getClass(), recordId);
}
}
}
}
return null;
}
示例11: init
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
private void init( OrientBaseGraph graph, String rootName ) {
this.graph = graph;
this.rootName = rootName;
ensureNodeTypeExistence( graph, conf.getRootClass() );
ensureNodeTypeExistence( graph, rootName + NODE_CLASS );
ensureEdgeTypeExistence( graph, CHILDOF_CLASS );
ensureEdgeTypeExistence( graph, LINK_CLASS );
root = getRoot( rootName, 0 );
if( root == null ) {
root = graph.addVertex( conf.getRootClass(), (String)null );
root.setProperty( "tag", rootName );
graph.commit();
}
}
示例12: begin
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
@Override
public void begin() {
ODatabaseDocumentTx documentDatabase = init();
if (documentDatabase == null) {
switch (dbType) {
case DOCUMENT:
documentDatabase = new ODatabaseDocumentTx(dbURL);
documentDatabase.open(dbUser, dbPassword);
break;
case GRAPH:
final OrientGraphFactory factory = new OrientGraphFactory(dbURL, dbUser, dbPassword);
final OrientBaseGraph graphDatabase = tx ? factory.getTx() : factory.getNoTx();
graphDatabase.setUseLightweightEdges(useLightweightEdges);
graphDatabase.setStandardElementConstraints(standardElementConstraints);
documentDatabase = graphDatabase.getRawGraph();
pipeline.setGraphDatabase(graphDatabase);
break;
}
pipeline.setDocumentDatabase(documentDatabase);
}
documentDatabase.declareIntent(new OIntentMassiveInsert());
}
示例13: initVertex
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
private static void initVertex(OrientBaseGraph graph) {
Map<String, Class<?>> map = new TreeMap<>();
for (Class<?> clasz : ReflectionsFactory.getReflections(vBase.class).getTypesAnnotatedWith(DatabaseVertrex.class)) {
if (clasz != null && clasz.getSuperclass() != null) {
map.put(getAllSuperclass(clasz), clasz);
}
}
for (Entry<String, Class<?>> es : map.entrySet()) {
addVertrexType(graph, es.getValue());
}
}
示例14: addVertrexType
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
public static void addVertrexType(OrientBaseGraph graph, Class<?> clasz) {
if (clasz.isAnnotationPresent(DatabaseVertrex.class)) {
//Map<String, DatabaseProperty> mapSchemaProperty = new HashMap<String, DatabaseProperty>();
DatabaseVertrex classAnotation = clasz.getAnnotation(DatabaseVertrex.class);
String className = clasz.getSimpleName();
if(StringUtils.isNotBlank(classAnotation.name())) {
className = classAnotation.name();
}
OrientVertexType oClass = graph.getVertexType(className);
Class<?> parentClass = clasz.getSuperclass();
while(!parentClass.isAnnotationPresent(DatabaseVertrex.class) && (parentClass.getSuperclass() != null)) {
parentClass = parentClass.getSuperclass();
}
OrientVertexType oParentClass = graph.getVertexType(parentClass.getSimpleName());
if (parentClass.getSimpleName().equals(Object.class.getSimpleName())) {
oParentClass = graph.getVertexBaseType();
}
if (oClass == null) {
logger.warn("Add Vertrex @" + className + " child of @" + oParentClass);
graph.createVertexType(className, oParentClass.getName());
} else {
if (logger.isDebugEnabled())
logger.debug("Vertrex @" + className + " exist, child of @" + oParentClass);
}
}
}
示例15: getOrientBaseGraph
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
public synchronized static OrientBaseGraph getOrientBaseGraph() {
if(memoryGraph != null)
return memoryGraph;
if (singleton == null) {
singleton = getOrientGraphFactory();
}
return getOrientGraphNoTx();
}