Hi Hartmut,

There is no specific configuration to specify that an index is unique at
class level, but you can just avoid to define the index on the superclass,
as the query engine will use the subclasses index if needed (first level
inheritance only)

Thanks

Luigi



2016-07-28 7:07 GMT+02:00 hartmut bischoff <[email protected]>:

> As mentioned before, my test-suite-Vertices have the following structure:
> - V
>   - - - Contract
>     - - ContractDetail
>     - - Sector
>       - - Category
>         - Industry
>         - Subcategory
>
> Contracts got an unique Index "Con_id" and Sector "name".
>
>
> names are unique on class-level only.
> My "quick&dirty" solution was to extend the index on Sector to "name, k",
> where k is a shortcut of the class.
>
>  93         orientdb.create_properties( :Sector, name: {type: :string}, k:
> {type: :string})
>  94         orientdb.create_index( :Sector,  name: 'sectorindex', on:
> [:name, :k], type: :unique  )
>
>
>
>
> Then I can use the atomic upsert  (with ruby code:)
>
> 136             sub_cat_record = ActiveOrient::Model::Subcategory.upsert(
> set: { :k => 'S' },
> 137                                  where: { :name =>
> contract.contract_detail.subcategory }) do | new_sub_cat |
> 138                 category_record =
>  ActiveOrient::Model::Category.upsert( set: { :k => 'C' },
> 139                                         where: { :name =>
> contract.contract_detail.category }) do | new_category |
> 140                         industry_record =
> ActiveOrient::Model::Industry.upsert( set: { :k => 'I' },
> 141                                               where: { :name =>
> contract.contract_detail.industry }) do | new_industry |
>
>
> Obviously this is a sloppy workaround.
>
> Is there a way to specify an Index which is unique on class-level ?
>
> --
>
> ---
> 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