Getting vertex or edges records in pyrorient OrientDb?

356 views Asked by At

I have a vertex class Transformer and I would like to retrieve its records. I am doing the following;

ABC = client.query("SELECT * FROM ABC")
print(ABC[0])

However, this outputs;

{'@ABC':{'name': 'ABC_MVLV', 'origin_node': 'node_MV', 'destination_node': 'node_LV_1', 'rdfs_label': '', 'rdfs_comment': '', 'out_has_nominal_power': <pyorient.otypes.OrientBinaryObject object at 0x116ea5668>, 'out_has_primary_rated_voltage': <pyorient.otypes.OrientBinaryObject object at 0x116ea55f8>, 'out_has_secondary_maximum_current': <pyorient.otypes.OrientBinaryObject object at 0x116ea5cf8>, 'out_has_resistance': <pyorient.otypes.OrientBinaryObject object at 0x116ea5cc0>, 'out_has_reactance': <pyorient.otypes.OrientBinaryObject object at 0x116ea5e48>, 'out_has_conductance': <pyorient.otypes.OrientBinaryObject object at 0x116ea54a8>, 'out_has_susceptance': <pyorient.otypes.OrientBinaryObject object at 0x116ea54e0>, 'out_has_primary_maximum_current': <pyorient.otypes.OrientBinaryObject object at 0x116ea5d30>, 'out_has_ratio': <pyorient.otypes.OrientBinaryObject object at 0x116ea5160>, 'out_has_secondary_rated_voltage': <pyorient.otypes.OrientBinaryObject object at 0x116ea5e80>, 'out_has_maximum_apparent_power': <pyorient.otypes.OrientBinaryObject object at 0x116ea56a0>, 'in_has_transformers': <pyorient.otypes.OrientBinaryObject object at 0x116ea51d0>},'version':13,'rid':'#485:0'}

as this class has some properties e.g. name, origin_node, which could be retrieved by ABC[0].name, but I would like to retrieve other records as well, which could be edges between other classes. I came to know that in java one could check if it is a vertex or edge and then retrieve by using record.getvertex() or get edge. How could I do that in pyorient?

1

There are 1 answers

0
dgiannotti On

There are no specific commands in PyOrient to retrieve certain fields such as ABC[0].name since it's all handled by SQL queries. You should look into them here:

OrientDB | SQL-Functions

OrientDB | PyOrient commands