本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientBaseGraph类的典型用法代码示例。如果您正苦于以下问题:Java OrientBaseGraph类的具体用法?Java OrientBaseGraph怎么用?Java OrientBaseGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrientBaseGraph类属于com.tinkerpop.blueprints.impls.orient包,在下文中一共展示了OrientBaseGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:18,代码来源:DatabaseFactory.java
示例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);
}
}
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:25,代码来源:DatabaseFactory.java
示例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);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:19,代码来源:vAclGroup.java
示例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);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:18,代码来源:vAclGroup.java
示例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);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:18,代码来源:vAclGroup.java
示例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);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:19,代码来源:vPath.java
示例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);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:19,代码来源:vAcl.java
示例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);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:20,代码来源:vBaseAbstract.java
示例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;
}
}
开发者ID:xvik,项目名称:guice-persist-orient-examples,代码行数:24,代码来源:SampleDataInitializer.java
示例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;
}
开发者ID:gentics,项目名称:mesh,代码行数:22,代码来源:OrientDBDatabase.java
示例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();
}
}
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:17,代码来源:GDomDB.java
示例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());
}
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:26,代码来源:OOrientDBLoader.java
示例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());
}
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:15,代码来源:DatabaseFactory.java
示例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);
}
}
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:39,代码来源:DatabaseFactory.java
示例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();
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:12,代码来源:GraphFactory.java
示例16: getOrientGraphNoTx
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
public synchronized static OrientBaseGraph getOrientGraphNoTx() {
if(memoryGraph != null)
return memoryGraph;
if (singleton == null) {
singleton = getOrientGraphFactory();
}
return singleton.getNoTx();
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:12,代码来源:GraphFactory.java
示例17: execute
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
public static int execute(OrientBaseGraph graph, String cmdSQL, Object... args) {
final Timer.Context timerContext = TIMER_DATABASE_REQUEST_SQL.time();
try {
long tStart = System.currentTimeMillis();
if(graph == null)
graph = GraphFactory.getOrientBaseGraph();
Integer value = graph.command(new OCommandSQL(cmdSQL)).execute(args);
graph.commit();
long elapsedSeconds = (System.currentTimeMillis() - tStart);
if(logger.isDebugEnabled()) {
StringBuilder message = new StringBuilder();
message.append(String.format("Query executed in %d ms for %d record%s", elapsedSeconds, value, value > 1 ? "s" : ""));
/*
try{
throw new Exception();
} catch(Exception e) {
e.printStackTrace();
}
*/
message.append(String.format(" [%s]", cmdSQL));
addMessageArgs(message,args);
logger.debug(message.toString());
}
return value;
} finally {
timerContext.stop();
}
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:40,代码来源:GraphFactory.java
示例18: getGraph
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
protected final OrientBaseGraph getGraph() {
if (!this.hasOrientVertex()) {
return GraphFactory.getOrientBaseGraph();
}
return this.getOrientVertex().getGraph();
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:9,代码来源:vCommon.java
示例19: getByExternalRef
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
protected static <T extends vBaseAbstract> T getByExternalRef(OrientBaseGraph graph, final Class<T> target,
final String key, final String value, final boolean instanceOf) {
String cmdSql = "SELECT FROM " + target.getSimpleName() + " WHERE "
+ WhereClause.IsntanceOf(target, instanceOf) + " AND "
+ jBaseStandard.EXTERNAL_REF + "['"+ key + "'] = ?";
List<OrientVertex> list = vCommon.command(graph, cmdSql, value);
if (list.isEmpty()) {
if (logger.isTraceEnabled())
logger.trace("OrientVertex not found for [k,v]: " + key + "," + value);
return null;
}
if (list.size() > 1) {
throw new RuntimeException("To many obejct for [k,v]: " + key + "," + value + " [" + cmdSql + "]");
}
OrientVertex ov = list.get(0);
T baseAbstract = vBaseAbstract.getInstance(target, ov);
if (logger.isTraceEnabled())
logger.trace("OrientVertex found for [k,v]: " + key + "," + value + " @" + ov.getType().getName() + " #"
+ ov.getIdentity().toString());
return baseAbstract;
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:31,代码来源:vBaseStandard.java
示例20: getByOtherName
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入依赖的package包/类
protected static <T extends vBaseAbstract> T getByOtherName(OrientBaseGraph graph, Class<T> target, final String iValue, final boolean isInstanceOf) {
if(StringUtils.isBlank(iValue)) {
return null;
}
String value = stripOtherName(iValue);
// TODO Injection SQL
String cmdSQL = "";
cmdSQL += "SELECT FROM " + target.getSimpleName() + " WHERE @rid in ";
cmdSQL += " (SELECT myRid FROM ";
cmdSQL += " (SELECT @rid as myRid, " + jBaseStandard.OTHER_NAME + " FROM " + target.getSimpleName() + "";
cmdSQL += " WHERE " + jBaseStandard.OTHER_NAME + " IS NOT NULL ";
cmdSQL += "AND ";
cmdSQL += WhereClause.IsntanceOf(target, isInstanceOf);
cmdSQL += " UNWIND " + jBaseStandard.OTHER_NAME + " ) ";
cmdSQL += " WHERE " + jBaseStandard.OTHER_NAME + ".toLowerCase() = '" + value + "') ";
//BaseQuery bq = new BaseQuery();
List<T> list = vBaseAbstract.commandBaseAbstract(graph, target, cmdSQL);
if(list.isEmpty()) {
return null;
}
if(list.size() > 1) {
logger.error("To many obejct for find version in : " + iValue + " / ["+ cmdSQL +"]");
return null;
}
return list.get(0);
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:37,代码来源:vBaseStandard.java
注:本文中的com.tinkerpop.blueprints.impls.orient.OrientBaseGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论