OrientDB客户端触发查询

时间:2016-12-16 07:55:57

标签: java html orientdb

我有一个任务是创建一个简单的应用程序,使用eclipse作为工具和OrientDB通过java,你可以查看我在下面发布的代码,我已经连接到OrientDB服务器,我得到了输出在控制台窗口上,但我想从客户端的网页命令。请帮助我在客户端解雇查询。

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);
        }

    }
}

0 个答案:

没有答案