Hi could you please show the indices in the Studio? Thanks

Am Dienstag, 2. Dezember 2014 15:04:29 UTC+1 schrieb syshex:
>
> Hi !
>
> I create the following Vertex type and index :
>
> OrientGraphNoTx graph = factory.getNoTx();
> *graph*
>
> *.createVertexType("Government");graph.createKeyIndex("itemid", 
> Vertex.class, new Parameter<>("class", 
> "Government"));graph.createKeyIndex("nif", Vertex.class, new 
> Parameter<>("class", "Government"));*
> graph.commit();  // Just Because ...
>
>
> Then I go on to create a Vertex of that type :
>
> OrientGraph graph = factory.getTx();
> Vertex node = graph.addVertex("class:Government");
> *node**.setProperty("itemid", 45);*
> node.setProperty("nif", "1234567890");
> node.setProperty("description", "Somewhere");
> graph.commit() ; 
>
> I then search for  :
>
> Vertex exists = graph2.getVertexByKey("Government.itemid", 45);
>
> And exists == Null ; therefore not found. 
>
> I even tried defining the properties of the Gorvernment vertex type, like 
> this : 
>
> OrientGraphNoTx graph = factory.getNoTx();
> OrientVertexType vertexType = graph.createVertexType("Government");
> *vertexType**.createProperty("itemid", OType.LONG);*
> *vertexType**.createProperty("nif", OType.STRING);*
> graph.createKeyIndex("itemid", Vertex.class, new Parameter<>("class", 
> "Government"));
> graph.createKeyIndex("nif", Vertex.class, new Parameter<>("class", 
> "Government"));
> graph.commit();
>
> and do the same: 
>
>         OrientGraph graph2 = factory.getTx();
>         Vertex node = graph2.addVertex("class:Government");
>         node.setProperty("itemid", 45);
>         node.setProperty("nif", "1234567890");
>         node.setProperty("description", "Somewhere");
>         graph2.commit() ;
>
>         graph2 = factory.getTx();
>         Vertex exists = graph2.getVertexByKey("Government.itemid", 45);
>
>
>         if (exists == null) {
>             System.out.println("Does not Exist");
>             node = graph2.addVertex("class:Government");
>             node.setProperty("itemid", 45);
>             node.setProperty("nif", "1234567890");
>             node.setProperty("description", "Somewhere");
>             graph2.commit() ;
>         } else {
>             System.out.println("Exist already");
>         }
>
>
> I always end up with two vertex entries on the DB , as can be see from the 
> attached Image,
>
> I also attach a test class for this problem. 
>
> I'm running 2.0-M3 on linux and the dependencies for the TestRun class 
> attached are :
>
> "com.orientechnologies" % "orientdb-client" % "2.0-M3",
>   "com.orientechnologies" % "orientdb-enterprise" % "2.0-M3",
>   "com.orientechnologies" % "orient-commons" % "2.0-M1",
>   "com.orientechnologies" % "orientdb-core" % "2.0-M3",
>   "com.orientechnologies" % "orientdb-graphdb" % "2.0-M3",
>   "com.tinkerpop.blueprints" % "blueprints-core" % "2.6.0",
>
>
>
>
>

-- 

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