sorry, i made a mistake.
it does look like tinkerpop blueprints does not support composite indices.
https://github.com/tinkerpop/blueprints/wiki/Graph-Indices

so in your case it is not possible to use the getvertexbykey api the way 
you intended to.


~nagu.

On Monday, July 27, 2015 at 6:58:22 PM UTC+5:30, Parthasarathy 
Suryanarayanan wrote:
>
> I must be missing something. Which property are you referring to? There 
> are four properties (key1...key4) that constitute the composite key (which, 
> I assume is not considered to be a "property" of vertex, or is it?)
> Can you specify how the below line should be modified?
>  Vertex exists = graph.getVertexByKey("<WHAT_GOES_HERE>", new 
> Object[]{key1_val, key2_val, key3_val, key4_val});
>   
>
> On Monday, July 27, 2015 at 2:52:20 AM UTC-4, nagaraja sosale ramaswamy 
> wrote:
>>
>> the argument to getVertexByKey is the property name on which the index is 
>> created, not the name of the index itself.
>>
>> check the javadocs: 
>> Parameters:
>> iKey - Name of the indexed property
>>
>> so like i said, if you want the Method 3 to work (assuming the property 
>> name on Entity class is Id, against which you have created an index with 
>> name Entity.Id) you need to pass the argument as Id, not Entity.Id.
>>
>>
>> ~nagu.
>>
>>
>> On Monday, July 27, 2015 at 11:34:43 AM UTC+5:30, Parthasarathy 
>> Suryanarayanan wrote:
>>>
>>> It is a composite index (with the name "Entity.Id") of properties (key1, 
>>> key2, key3, key4) on the class "Entity".
>>>
>>> To be clear:
>>> Method 1: select from index:Entity.id where key = [1224736769, 2, 14, 22]
>>> Method 2: 
>>> for (Vertex entity : graph.getVertices("Entity", new String[] { "key1", 
>>> "key2", "key3",
>>>         "key4" }, new Object[] { key1_val, key2_val, key3_val, key4_val 
>>> })) {
>>>       return (OrientVertex) entity;
>>>       //there really shouldn't be more than one as this is a unique 
>>> index but this seems like a hack
>>> }
>>> Method 3:     Vertex exists = graph.getVertexByKey("Entity.Id", new 
>>> Object[]{key1_val, key2_val, key3_val, key4_val});
>>>
>>> Method 1, Method 2 works. But not Method 3 (which I want to work)
>>>
>>> On Sunday, July 26, 2015 at 5:58:38 PM UTC-4, nagaraja sosale ramaswamy 
>>> wrote:
>>>>
>>>> you probably meant to write: 
>>>>
>>>> Vertex exists = graph.getVertexByKey("Id", new Object[]{key1, key2, 
>>>> key3, key4});
>>>>
>>>> (assuming the property name on Entity Vertex is Id)
>>>>
>>>>
>>>>
>>>> On Monday, July 27, 2015 at 12:30:06 AM UTC+5:30, Parthasarathy 
>>>> Suryanarayanan wrote:
>>>>>
>>>>> After adding many instances of OrientVertex, I created a composite 
>>>>> index using some of the properties like the following
>>>>>     <MY_OClass>.createIndex("Entity.Id", "UNIQUE", new String[]{key1, 
>>>>> key2, key3, key4});
>>>>> ..where the key1..4 are of INTEGER type (not sure if this the right 
>>>>> way to create the composite key).
>>>>> Now I am trying to verify if the entity exists before trying to add 
>>>>> one, like the following
>>>>>     Vertex exists = graph.getVertexByKey("Entity.Id", new 
>>>>> Object[]{key1, key2, key3, key4});
>>>>>
>>>>> But the value of the exists is always null. Note that I could always 
>>>>> query in the console
>>>>> select from index:Entity.id where key = [1224736769, 2, 14, 22]
>>>>> and get the appropriate entity back.  I just want to be sticking to 
>>>>> the graph API in my java code.
>>>>>
>>>>> What am I doing wrong? Thanks for your help.
>>>>>
>>>>>
>>>>>

-- 

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