The only method that returns a single Vertex is noTxGraph.getVertex(Object
id);
So if you know there's only one vertex (or if you just want the first
result), just do:
noTxGRaph.getVertices("Person.ID", 1).iterator().next()
I typically hide this behind an api so that I essentially a single Vertex
return version of getVertices to avoid iterator().next() all over my code.
On Monday, September 8, 2014 7:56:04 AM UTC-4, Curtis Mosters wrote:
>
> I have
>
> for (Vertex person : noTxGraph.getVertices("Person.ID", 1) {
> for (Vertex appln : noTxGraph.getVertices("Appln.ID", 1) {
> noTxGraph.addEdge(null, person, appln, "WROTE");
> }
> }
>
> What gives back all entries with Appln.ID=1 and same on Person.ID
>
> But I know that it's UNIQUE so it does not make any sense. So how can I say
>
> noTxGraph.addEdge(null, noTxGraph.getVertex("Person.ID", 1), noTxGraph.
> getVertex("Appln.ID", 1), "WROTE");
>
> That would be much faster in case of Memory usage and transfer. Also much
> shorter.
>
> Is this possible. When yes how. Thank you.
>
> Btw: if possible not with an SQLCommand!
>
--
---
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.