本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientVertexType类的典型用法代码示例。如果您正苦于以下问题:Java OrientVertexType类的具体用法?Java OrientVertexType怎么用?Java OrientVertexType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrientVertexType类属于com.tinkerpop.blueprints.impls.orient包,在下文中一共展示了OrientVertexType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: Auditor
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
public Auditor(Transaction t, String user) {
this.transaction = t;
this.auditUser = user;
// verificar que la clase de auditorías exista
if (this.transaction.getDBClass(this.ODBAUDITLOGVERTEXCLASS) == null) {
OrientVertexType olog = this.transaction.getGraphdb().createVertexType(this.ODBAUDITLOGVERTEXCLASS);
olog.createProperty("rid", OType.STRING);
olog.createProperty("timestamp", OType.DATETIME);
olog.createProperty("user", OType.STRING);
olog.createProperty("action", OType.STRING);
olog.createProperty("label", OType.STRING);
olog.createProperty("log", OType.STRING);
this.transaction.commit();
}
}
开发者ID:mdre,项目名称:odbogm,代码行数:18,代码来源:Auditor.java
示例2: checkIndexUniqueness
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的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
示例3: setUp
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@Override
public void setUp() {
OGlobalConfiguration.USE_WAL.setValue(true);
super.setUp();
final OrientVertexType v1 = graph.createVertexType("V1");
final OrientVertexType v2 = graph.createVertexType("V2");
final OrientEdgeType edgeType = graph.createEdgeType("Friend");
edgeType.createProperty("in", OType.LINK, v2);
edgeType.createProperty("out", OType.LINK, v1);
// ASSURE NOT DUPLICATES
edgeType.createIndex("out_in", OClass.INDEX_TYPE.UNIQUE, "in", "out");
graph.addVertex("class:V2").setProperty("name", "Luca");
graph.commit();
}
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:19,代码来源:OEdgeTransformerTest.java
示例4: addVertrexType
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的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
示例5: getType
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
public final String getType() {
OrientVertexType type;
try {
type = this.getOrientVertex().getType();
} catch (Exception e) {
logger.trace("getType() is null -> 2nd chance! [" + e.getMessage() + "]");
this.reload();
type = this.getOrientVertex().getType();
}
return type.getName();
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:15,代码来源:vBaseAbstract.java
示例6: initialize
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@Override
public void initialize() {
final OrientBaseGraph db = context.getConnection();
/**
* Avoid creating scheme if table already exist.
* Look method implementation: internally it use document api the same way as it was used in
* document sample.
*/
if (db.getVertexType(CLASS_NAME) != null) {
return;
}
/**
* In database scheme the only difference with other apis would be that
* Sample class would extend "V" in scheme (which marks type as Vertex type).
*/
final OrientVertexType vtype = db.createVertexType(CLASS_NAME);
vtype.createProperty("name", OType.STRING);
vtype.createProperty("amount", OType.INTEGER);
// registration of graph type is not mandatory (orient will create it on-the-fly)
// but with warning
// also note that edge name is case-insensitive and so used as "belongsTo" everywhere in code
db.createEdgeType("BelongsTo");
}
开发者ID:xvik,项目名称:guice-persist-orient-examples,代码行数:29,代码来源:ManualSchemeInitializer.java
示例7: addVertexType
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@Override
public void addVertexType(Class<?> clazzOfVertex, Class<?> superClazzOfVertex) {
if (log.isDebugEnabled()) {
log.debug("Adding vertex type for class {" + clazzOfVertex.getName() + "}");
}
OrientGraphNoTx noTx = factory.getNoTx();
try {
OrientVertexType vertexType = noTx.getVertexType(clazzOfVertex.getSimpleName());
if (vertexType == null) {
String superClazz = "V";
if (superClazzOfVertex != null) {
superClazz = superClazzOfVertex.getSimpleName();
}
vertexType = noTx.createVertexType(clazzOfVertex.getSimpleName(), superClazz);
} else {
// Update the existing vertex type and set the super class
if (superClazzOfVertex != null) {
OrientVertexType superType = noTx.getVertexType(superClazzOfVertex.getSimpleName());
if (superType == null) {
throw new RuntimeException("The supertype for vertices of type {" + clazzOfVertex + "} can't be set since the supertype {"
+ superClazzOfVertex.getSimpleName() + "} was not yet added to orientdb.");
}
vertexType.setSuperClass(superType);
}
}
} finally {
noTx.shutdown();
}
}
开发者ID:gentics,项目名称:mesh,代码行数:30,代码来源:OrientDBDatabase.java
示例8: removeVertexType
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@Override
public void removeVertexType(String typeName) {
if (log.isDebugEnabled()) {
log.debug("Removing vertex type with name {" + typeName + "}");
}
OrientGraphNoTx noTx = factory.getNoTx();
try {
OrientVertexType type = noTx.getVertexType(typeName);
if (type != null) {
noTx.dropVertexType(typeName);
}
} finally {
noTx.shutdown();
}
}
开发者ID:gentics,项目名称:mesh,代码行数:16,代码来源:OrientDBDatabase.java
示例9: addVertexIndex
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@Override
public void addVertexIndex(String indexName, Class<?> clazzOfVertices, boolean unique, String fieldKey, FieldType fieldType) {
if (log.isDebugEnabled()) {
log.debug("Adding vertex index for class {" + clazzOfVertices.getName() + "}");
}
OrientGraphNoTx noTx = factory.getNoTx();
try {
String name = clazzOfVertices.getSimpleName();
OrientVertexType v = noTx.getVertexType(name);
if (v == null) {
throw new RuntimeException("Vertex type {" + name + "} is unknown. Can't create index {" + indexName + "}");
}
if (v.getProperty(fieldKey) == null) {
OType type = convertType(fieldType);
OType subType = convertToSubType(fieldType);
if (subType != null) {
v.createProperty(fieldKey, type, subType);
} else {
v.createProperty(fieldKey, type);
}
}
if (v.getClassIndex(indexName) == null) {
v.createIndex(indexName, unique ? OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.toString() : OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX.toString(),
null, new ODocument().fields("ignoreNullValues", true), new String[] { fieldKey });
}
} finally {
noTx.shutdown();
}
}
开发者ID:gentics,项目名称:mesh,代码行数:33,代码来源:OrientDBDatabase.java
示例10: setupTypesAndIndices
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
private static void setupTypesAndIndices(OrientGraphFactory factory2) {
OrientGraph g = factory.getTx();
try {
// g.setUseClassForEdgeLabel(true);
g.setUseLightweightEdges(false);
g.setUseVertexFieldsForEdgeLabels(false);
} finally {
g.shutdown();
}
try {
g = factory.getTx();
OrientEdgeType e = g.createEdgeType("HAS_ITEM");
e.createProperty("in", OType.LINK);
e.createProperty("out", OType.LINK);
e.createIndex("e.has_item", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "out", "in");
OrientVertexType v = g.createVertexType("root", "V");
v.createProperty("name", OType.STRING);
v = g.createVertexType("item", "V");
v.createProperty("name", OType.STRING);
v.createIndex("item", OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX, "name");
} finally {
g.shutdown();
}
}
开发者ID:gentics,项目名称:mesh,代码行数:31,代码来源:EdgeIndexPerformanceTest.java
示例11: getConfiguration
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@Override
public ODocument getConfiguration() {
return new ODocument().fromJSON("{parameters:[" + getCommonConfigurationParameters() + ","
+ "{class:{optional:true,description:'Vertex class name to assign. Default is " + OrientVertexType.CLASS_NAME + "'}}"
+ ",skipDuplicates:{optional:true,description:'Vertices with duplicate keys are skipped', default:false}" + "]"
+ ",input:['OrientVertex','ODocument'],output:'OrientVertex'}");
}
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:8,代码来源:OVertexTransformer.java
示例12: init
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@BeforeClass
public void init() {
initDB();
graph = new OrientGraph((ODatabaseDocumentTx) databaseDocumentTx, false);
OrientVertexType type = graph.createVertexType("City");
type.createProperty("latitude", OType.DOUBLE);
type.createProperty("longitude", OType.DOUBLE);
type.createProperty("name", OType.STRING);
databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
}
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:12,代码来源:GraphEmbeddedTest.java
示例13: init
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
@BeforeClass
public void init() {
initDB();
OrientGraph graph = new OrientGraph((ODatabaseDocumentTx) databaseDocumentTx, false);
OrientVertexType type = graph.createVertexType("City");
type.createProperty("name", OType.STRING);
databaseDocumentTx.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
}
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:11,代码来源:LuceneIndexCreateDropTest.java
示例14: createSchema
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
protected void createSchema()
{
graph.executeOutsideTx(new OCallable<Object, OrientBaseGraph>() {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Object call(final OrientBaseGraph g)
{
OrientVertexType v = g.getVertexBaseType();
if(!v.existsProperty(NODE_ID)) { // TODO fix schema detection hack later
v.createProperty(NODE_ID, OType.INTEGER);
g.createKeyIndex(NODE_ID, Vertex.class, new Parameter("type", "UNIQUE_HASH_INDEX"), new Parameter(
"keytype", "INTEGER"));
v.createEdgeProperty(Direction.OUT, SIMILAR, OType.LINKBAG);
v.createEdgeProperty(Direction.IN, SIMILAR, OType.LINKBAG);
OrientEdgeType similar = g.createEdgeType(SIMILAR);
similar.createProperty("out", OType.LINK, v);
similar.createProperty("in", OType.LINK, v);
g.createKeyIndex(COMMUNITY, Vertex.class, new Parameter("type", "NOTUNIQUE_HASH_INDEX"),
new Parameter("keytype", "INTEGER"));
g.createKeyIndex(NODE_COMMUNITY, Vertex.class, new Parameter("type", "NOTUNIQUE_HASH_INDEX"),
new Parameter("keytype", "INTEGER"));
}
return null;
}
});
}
开发者ID:socialsensor,项目名称:graphdb-benchmarks,代码行数:29,代码来源:OrientGraphDatabase.java
示例15: saveDataModule
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
private Module saveDataModule(Module module) {
DataModel dataModel;
if (module.getModel() == null) {
dataModel = DataModel.createDefault();
dataModel.setName(module.getName());
module.setModel(HybridbpmCoreUtil.objectToJson(dataModel));
} else {
dataModel = HybridbpmCoreUtil.jsonToObject(module.getModel(), DataModel.class);
}
module.setCode(HybridbpmCoreUtil.createDataCode(dataModel));
OrientGraphNoTx graphNoTx = getOrientGraphNoTx();
OrientVertexType vertexType;
if (!graphNoTx.getRawGraph().getMetadata().getSchema().existsClass(module.getName())) {
vertexType = graphNoTx.createVertexType(module.getName());
} else {
vertexType = graphNoTx.getVertexType(module.getName());
}
for (FieldModel fieldModel : dataModel.getFields()) {
createProperty(vertexType, fieldModel, graphNoTx);
}
// TODO: check if we need to remove or not
// for (OProperty property : vertexType.declaredProperties()) {
// try {
// if (!dataModel.containsField(property.getName())) {
// vertexType.dropProperty(property.getName());
// }
// } catch (Exception ex) {
// Logger.getLogger(DevelopmentAPI.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
// }
// }
graphNoTx.commit();
try (OObjectDatabaseTx database = getOObjectDatabaseTx()) {
module.setUpdateDate(new Date());
module = database.save(module);
database.commit();
module = detach(module);
}
regenerateGroovySources();
return module;
}
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:44,代码来源:DevelopmentAPI.java
示例16: addGenres
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
public void addGenres() throws IOException {
Logger.log("Adding Genres.");
// get lines as stream
Stream<String> lines = Files.lines(Paths.get(Config.MOVIELENS_PATH + "movies.csv"));
// set will always have unique values
Set<String> genres = new HashSet<>();
// genres format: someMovie,genre1|genre2|genre3
lines.skip(1).forEach(line -> {
// split by comma (commas inside double quotes needs to be skipped)
String[] tokens = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1);
genres.addAll(Arrays.asList(tokens[2].split("\\|")));
});
Logger.log("Genres loaded from CSV into HashSet.");
// create a class
// execute it outside a transaction because this class needs to be created before adding genres
graph.executeOutsideTx(arg -> {
// drop if exist
if (graph.getVertexType("Genre") != null) {
graph.dropVertexType("Genre");
}
// creating the class
OrientVertexType genreClass = graph.createVertexType("Genre");
genreClass.createProperty("name", OType.STRING);
// creating the type
OrientVertexType genreType = graph.getVertexType("Genre");
genreType.createIndex("Genre.name", OClass.INDEX_TYPE.UNIQUE, "name");
return null;
});
// add vertices
genres.stream().forEach(genre -> {
try {
graph.addVertex("class:Genre", "name", genre);
} catch (Exception e) {
graph.rollback();
}
});
graph.commit();
Logger.log("Genres added.");
}
开发者ID:warriorkitty,项目名称:orientlens,代码行数:52,代码来源:Worker.java
示例17: addUsers
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
public void addUsers() throws IOException {
Logger.log("Adding Users.");
// get lines as stream
Stream<String> lines = Files.lines(Paths.get(Config.MOVIELENS_PATH + "ratings.csv"));
// set will always have unique values
Set<Integer> users = new HashSet<>();
lines.skip(1).forEach(line -> {
// split by comma
String[] tokens = line.split(",");
users.add(Integer.parseInt(tokens[0]));
});
Logger.log("Users loaded from CSV into HashSet.");
// create a class
graph.executeOutsideTx(iArgument -> {
// drop if exist
if (graph.getVertexType("User") != null) {
graph.dropVertexType("User");
}
OrientVertexType userClass = graph.createVertexType("User");
userClass.createProperty("userId", OType.INTEGER);
OrientVertexType genreType = graph.getVertexType("User");
genreType.createIndex("User.userId", OClass.INDEX_TYPE.UNIQUE, "userId");
return null;
});
// add vertices
users.stream().forEach(id -> {
try {
graph.addVertex("class:User", "userId", id);
// worked faster for me
if (Worker.randInt(1, 20) == 5) {
graph.commit();
}
} catch (Exception e) {
graph.rollback();
}
});
graph.commit();
Logger.log("Users added.");
}
开发者ID:warriorkitty,项目名称:orientlens,代码行数:50,代码来源:Worker.java
示例18: addMovies
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
public void addMovies() throws IOException {
Logger.log("Adding Movies.");
// get lines as stream
Stream<String> lines = Files.lines(Paths.get(Config.MOVIELENS_PATH + "movies.csv"));
// set will always have unique values
Map<Integer, String> movies = new HashMap<>();
lines.skip(1).forEach(line -> {
// split by comma (commas inside double quotes needs to be skipped)
String[] tokens = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1);
String movie = tokens[1].replaceAll("\\\"", "");
Integer movieId = Integer.parseInt(tokens[0]);
movies.put(movieId, movie);
});
Logger.log("Movies loaded from CSV into HashMap.");
// create a class
// execute it outside a transaction because this class needs to be created before adding movies
graph.executeOutsideTx(iArgument -> {
// drop if exist
if (graph.getVertexType("Movie") != null) {
graph.dropVertexType("Movie");
}
OrientVertexType movieClass = graph.createVertexType("Movie");
movieClass.createProperty("name", OType.STRING);
movieClass.createProperty("movieId", OType.INTEGER);
// OrientVertexType genreType = graph.getVertexType("Movie");
// genreType.createIndex("Movie.name", OClass.INDEX_TYPE.UNIQUE, "name");
OrientVertexType movieIdType = graph.getVertexType("Movie");
movieIdType.createIndex("Movie.movieId", OClass.INDEX_TYPE.UNIQUE, "movieId");
return null;
});
// add vertices
movies.entrySet().stream().forEach(movie -> {
try {
graph.addVertex("class:Movie", "name", movie.getValue(), "movieId", movie.getKey());
// worked faster for me
if (Worker.randInt(1, 20) == 5) {
graph.commit();
}
} catch (Exception e) {
graph.rollback();
}
});
graph.commit();
Logger.log("Movies added.");
}
开发者ID:warriorkitty,项目名称:orientlens,代码行数:58,代码来源:Worker.java
示例19: getVertexType
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
protected final OrientVertexType getVertexType() {
OrientVertexType ovt = this.getGraph().getVertexType(this.getClass().getSimpleName());
if (ovt == null) {
throw new RuntimeException("The \"ovt\" is null for @" + this.getClass().getSimpleName() + "!");
}
return ovt;
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:12,代码来源:vCommon.java
示例20: newOrientVertex
import com.tinkerpop.blueprints.impls.orient.OrientVertexType; //导入依赖的package包/类
protected void newOrientVertex() {
if (!this.hasOrientVertex()) {
OrientVertexType ovt = this.getVertexType();
if (ovt == null) {
throw new RuntimeException("The class \"" + this.getClass().getSimpleName() + "\" is note defined in the database");
}
this.setOrientVertex(this.getGraph().addVertex("class:" + ovt.getName()));
}
}
开发者ID:e-baloo,项目名称:it-keeps,代码行数:14,代码来源:vBaseAbstract.java
注:本文中的com.tinkerpop.blueprints.impls.orient.OrientVertexType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论