This is a snippet I'm using. It's written on ruby and I'm using graph
database.
connection = Oriented.connection
connection.java_connection.transaction.close
graph = connection.graph
vertex_type = graph.get_vertex_type(class_name) || graph.
create_vertex_type(class_name)
if vertex_type.exists_property key.to_s
prop = vertex_type.get_property(key.to_s)
else
o_type = Oriented::TypeConverters.converter(type).o_type
prop = vertex_type.create_property(key.to_s, o_type)
end
Em sábado, 30 de agosto de 2014 06h03min44s UTC-3, Curtis Mosters escreveu:
>
> Well checking if a class exists is really easy
>
> OrientGraphNoTx noTxGraph = factoryGraph.getNoTx();
> OSchema schema = db.getMetadata().getSchema();
> if (!schema.existsClass(className)) {
> noTxGraph.createVertexType(className);
> }
>
>
>
> but I cannot find a ways to check this on a property. The only way is with
> searching for the class, saving it, and than go through all the property
> and match it with the searched property.
>
> Is there a ways to do this much easier, like with the Schema above?
>
> And for sure I just can put a try catch but I don't an exception thrown,
> because it's easy to avoid.
>
> Thank you.
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.