hi,
you have already tried using java?
With java the field @version, @type there are not (see the image)

<https://lh3.googleusercontent.com/-Q6MlwRmWAjU/VX6b0W4XQWI/AAAAAAAAACc/Ly3M_2V2bnI/s1600/list1.png>




java code:

public class TestObject{

    private String value;

    public TestObject() {
        super();
        this.value = "";
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "TestObject [value=" + value + "]";
    }

}




public class TestEmbeddedList {
    
    private static String remote = "remote:localhost/";

    public static void main(String[] args) {

        String nomeDb = "TestingList";
        String currentPath = remote + nomeDb;

        OServerAdmin serverAdmin;
        OrientGraph g; 
        
        try {
            serverAdmin = new OServerAdmin(currentPath).connect("root", 
"root");
            
            if (serverAdmin.existsDatabase()) {
                System.out.println("Db already exist");
            } else {
                serverAdmin.createDatabase(nomeDb, "graph", "plocal");
                System.out.println("Db created");
            }    
            
            g = new OrientGraph(currentPath);

            //VERTEX 1
                TestObject mio1= new TestObject ();
                mio1.setValue("my1");            
                TestObject mio2= new TestObject ();
                mio2.setValue("my2");
                List<TestObject> list = new ArrayList<TestObject>();
                list.add(mio1);
                list.add(mio2);
                
                
                
                OClass cl=g.createVertexType("PersonList", "V");
                cl.createProperty("name", OType.STRING);
                cl.createProperty("listPeople", OType.EMBEDDEDLIST);
                
                OrientVertex v1=g.addVertex("class:PersonList");
                v1.setProperties("name","list1");
                v1.setProperties("listPeople",list.toString());
            
                
                //VERTEX 2
                TestObject mio3= new TestObject ();
                mio3.setValue("my3");            
                TestObject mio4= new TestObject ();
                mio4.setValue("my4");
                
                List<TestObject> list2 = new ArrayList<TestObject>();
                list2.add(mio3);
                list2.add(mio4);
                
                OrientVertex v2=g.addVertex("class:PersonList");
                v2.setProperties("name","list2");
                v2.setProperties("listPeople",list2.toString());
                
                g.commit();

           
                //get info vertex 1 and 2
                for (Vertex v : g.getVertices()) {
                    System.out.println(v.getProperty("name"));
                    System.out.println(v.getProperty("listPeople"));
                }

            g.shutdown();
            
        serverAdmin.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}



However there are visibile also in a javascritp function 

<https://lh3.googleusercontent.com/-4Ciiipc5Ij4/VX6cOdyu4FI/AAAAAAAAACk/UPRy6DjCiqI/s1600/Schermata%2Bda%2B2015-06-15%2B11%253A25%253A40.png>














@Type
Type is 'd' for documents, 'b' for binaries, 'f' for flat. what you are 
looking for is the @class that is 'OGraphVertex' for vertices and 
'OGraphEdge' for edges.

@version
The purpose of the @version property is to check if any update have been 
made between the time you fetched the object and when you updated it.
For instance if in your code you fetch a product, you update its 
properties, in the meanwhile the object has changed in the database 
(another piece of code has updated it), then you save it : you are trying 
to update the object with the version 2, but it has the version 3 in 
database.
This can help you to prevent concurrent access to your database.

regards,
Savio L.







-- 

--- 
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.

Reply via email to