OrientDB Client-side firing query

谁说我不能喝 提交于 2020-01-03 04:04:30

问题


I had a task to create a simple application using eclipse as a tool and OrientDB through java, u can look into the code that I have posted below and I have connected to the OrientDB server, I'm getting the output on the console window but I want to command from the web page that is on client side. Please help me out in firing queries on the client side.

package test;

import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;

public class Sample {



    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Sample sam = new Sample();
sam.run();
    }
    @SuppressWarnings("unchecked")
    public void run() {

        OrientGraph graph = new OrientGraph("plocal:C:\\Users\\Labuser\\Desktop\\orientdb-community-2.2.12\\databases\\OBD", "admin", "admin");
        graph.createVertexType("Person");
        graph.createVertexType("Address");

        Vertex vPerson = graph.addVertex("class:Person");
        vPerson.setProperty("firstName", "John");
        vPerson.setProperty("lastName", "Smith");

        Vertex vAddress = graph.addVertex("class:Address");
        vAddress.setProperty("street", "Van Ness Ave.");
        vAddress.setProperty("city", "San Francisco");
        vAddress.setProperty("state", "California");

        Vertex vPerson1 = graph.addVertex(null);



        OrientEdge eLives = graph.addEdge("class:lives", vPerson, vAddress, null);
        for (Vertex v : (Iterable<Vertex>) graph.command(
                new OCommandSQL(
                    "SELECT  * FROM V"
                  )).execute()) {
            System.out.println("- Bought: " + v);
        }

    }
}

来源:https://stackoverflow.com/questions/41179681/orientdb-client-side-firing-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!