Using 2.0 with lightweight edges turned on and remote connection

1. What would be the best way to get a vertex and all its connected 
vertices. 

currently Im doing the following:

        String query = "select * from MyVertex where name = :name FETCHPLAN 
*:-1";
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("name", "Test");
        Iterable<OrientVertex> vertices = 
(Iterable<OrientVertex>)graph.command(new 
OCommandSQL(query)).setFetchPlan("*:-1").execute(params);

In the above code should the fetchplan be in the query or in setFetchPlan? 
Is it better to do a traverse query?

2. How do i get my vertex and its connected vertices into a json document.

I thought OJsonWriter would work for this but i only get TEST:= ["#-2:1"] 
using the follwong code


        try {
            System.out.println("TEST:= "+OJSONWriter.writeValue(vertices));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

The following will only give me the fields on the vertex but not the 
connected vertices 

        for(OrientVertex myVertex : vertices) {
           myVertex.getRecord().toJSON()
            
        }


What i want to achieve is something like the following document 
structure:    [{name:'test', connectedVertices: [{name:'firstV'}, 
{name:'secondV'}] }]

Do i need to do the traversal myself and build the json document or is 
there already a class that will help me do that? 

Thanks

-- 

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