I just recently needed to do this but I don't think it should be necessary
when using Blueprints... it goes against what Blueprints is for.
Can't the "@" properties be allowed so that the following would be
equivalent?
Graph graph = ...
//NOTE THIS IS NOT WORKING CODE, JUST A WISH
graph.query().has("@class","SomeClass").vertices()
//Would be the same as:
graph.getVerticesOfClass("SomeClass")
I suppose this is related to a previous request that "@" properties should
be completely separate from regular properties... @properties are really
metadata about the vertex or edge but currently they are mixed in with the
regular properties. LVC's suggestion works but it gets more complicated
when you extend blueprints in such a way that it's graph.query can't be
cast to OrientGraphQuery. In my case, graph.query returns an object that
encapsulates an OrientQuery so I had to add another method in my Query
object to return the underlying OrientQuery. This is not portable so maybe
the above code could be considered?
> On Thursday, 18 July 2013 13:43:59 UTC-4, Lvc@ wrote:
>>
>> Hi John,
>> cast it to OrientGraph: it should return a OrientQuery that has labels().
>>
>> Lvc@
>>
>>
>>
>> On 18 July 2013 19:12, John Paul Lee <[email protected]> wrote:
>>
>>> Sorry, that should have read
>>>
>>> labels() method is not a valid method off of graphquery, just looked at
>>> version blueprints-core-2.4.0-20130716.113533-50
>>>
>>>
>>> On Thursday, 18 July 2013 13:06:18 UTC-4, John Paul Lee wrote:
>>>>
>>>> Actually, that was my first attempt at doing this, but I couldn't seem
>>>> to make this work with the Blueprints 2.4 snapshot build.
>>>>
>>>> Just retried, same error, labels() is not a valid method off of query.
>>>> What version of Blueprints are you on Lvc? Should I try an older build?
>>>>
>>>>
>>>> On Thursday, 18 July 2013 12:34:11 UTC-4, Lvc@ wrote:
>>>>>
>>>>> Hi John,
>>>>> Blueprints 2.4 introduced the query() that is very powerful and
>>>>> efficient because OrientDB implementation translates it into native SQL.
>>>>> Try this:
>>>>>
>>>>> graph.query().labels(className).has( key, value ).vertices();
>>>>>
>>>>> Lvc@
>>>>>
>>>>>
>>>>>
>>>>> On 18 July 2013 17:55, John Paul Lee <[email protected]> wrote:
>>>>>
>>>>>> Thanks Lvca for the page, wasn't quite what I was looking for. In the
>>>>>> end, I used a bit of a hodgepodge of blueprints/gremlin, and got what I
>>>>>> needed by doing:
>>>>>>
>>>>>> return ( new GremlinPipeline() ).start(graph.getVertices("@class",
>>>>>> className)).has( key, value );
>>>>>>
>>>>>>
>>>>>> I'm not entirely sure if this is the "correct" way, but it was able
>>>>>> to retrieve the vertex of CLASS1, with the properties I defined in
>>>>>> key/value. I'm wondering if there is a better way to do this, but right
>>>>>> now, am going to try this solution
>>>>>>
>>>>>> I'm a bit worried this won't be very efficient, but I am working
>>>>>> around getting a few million vertexes/edges into my test case and seeing
>>>>>> how the performance holds up.
>>>>>>
>>>>>>
>>>>>> On Monday, 15 July 2013 16:26:19 UTC-4, John Paul Lee wrote:
>>>>>>>
>>>>>>> Orientdb:1.4.1
>>>>>>> Blueprints: 2.4-snapshot
>>>>>>>
>>>>>>> Is there any way to search the vertexes by a vertex class type?
>>>>>>>
>>>>>>> ie.
>>>>>>> Vertex Class Person
>>>>>>> Vertex Class OtherPerson
>>>>>>> Person 1 = name = John
>>>>>>> OtherPerson 1 = name = John
>>>>>>>
>>>>>>> Search for Person with name = John
>>>>>>>
>>>>>>> I can see here:
>>>>>>> https://groups.google.com/forum/#!topic/orient-database/ej4UbfaDYV4
>>>>>>>
>>>>>>> Previously Luca suggested using:
>>>>>>> // BROWSE ALL THE VERTICES OF TYPE "CUSTOMER"
>>>>>>> for( Vertex v : graph.query().labels("Customer").vertex() ){
>>>>>>> ...
>>>>>>> }
>>>>>>>
>>>>>>> but currently using blueprints, using a simple:
>>>>>>> OrientGraph graph = graph = new OrientGraph("local:/opt/orient
>>>>>>> db/databases/testdb");
>>>>>>> graph.(??)
>>>>>>>
>>>>>>> OrientGraph, or even Graph does not have a labels function (looking
>>>>>>> at the old Javadocs for blueprints, it seems like it hasn't had one in
>>>>>>> a
>>>>>>> while).
>>>>>>>
>>>>>>> I can see that VertexQuery has a label function, but this seems tied
>>>>>>> to labels of edges which makes sense.
>>>>>>>
>>>>>>> It seems to be a pretty simple query, so I'm pretty sure I'm just
>>>>>>> missing it, any one have a clue how to do this?
>>>>>>>
>>>>>> --
>>>>>>
>>>>>> ---
>>>>>> 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/groups/opt_out.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>
>>> ---
>>> 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/groups/opt_out.
>>>
>>>
>>>
>>
>>
--
---
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.