Hi,
You should use the Graph API, then create a flat index against Company.name:

// CREATE THE SCHEMA FIRST
// ----
CREATE CLASS Company extends V
CREATE PROPERTY Company.name STRING
CREATE INDEX Company.name UNIQUE_HASH_INDEX

CREATE CLASS Employee extends V
CREATE PROPERTY Employee.name STRING
CREATE INDEX Employee.id UNIQUE_HASH_INDEX

CREATE CLASS employedBy extends E

// CREATE THE GRAPH
// ----
CREATE VERTEX Company set name = 'Commodore'
CREATE VERTEX Employee set id = '0', name = 'Jay Miner'
CREATE EDGE employedBy FROM (select from Employee where id = '0') TO
(select from Company where name = 'Commodore')

// QUERY ALL THE EMPLOYEES OF COMMODORE
// ----
SELECT expand( in('employedBy') ) FROM Company WHERE name = 'Commodore'

// QUERY WHERE JAY IS WORKING
// ----
SELECT expand( out('employedBy') ) FROM Employee WHERE id = '0'

Both query use indexes. To know more the shift between the relational model
to the graph one look at:
http://www.slideshare.net/lvca/why-relationships-are-cool-but-join-sucks-big-data-graphs-in-rome



Best Regards,

Luca Garulli
Founder & CEO
OrientDB <http://orientdb.com/>


On 4 August 2015 at 20:00, Team Xcelerator Inc. <[email protected]>
wrote:

> I am trying to introduce Orient at work but running into a challenge with
> indexes.  They can only be created on class-level properties, which means
> that linked child properties are not allowed.  For example, say I had an
> Employee class and Company class.  The Employee class could have a LINK to
> the Company class such as employedBy.  Let's say Employee has an id
> property and Company has a name property.   Currently, you can't create
> indexes that traverse links.  I would love to create an index using the
> following:  CREATE INDEX Employee.idCompanyName ON Employee (id,
> employedBy.name) NONUNIQUE
>
> If you try to create the index, it will fail because the employedBy.name
> property does not directly exist within Employee. In order to get around
> this, I would be forced to de-normalize and duplicate the data. That's a
> maintenance risk and hassle. Have you considered allowing indexes on linked
> child properties?
>
> Thanks and keep up the great work :)
>
> --
>
> ---
> 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.
>

-- 

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