Hi Valentin,
Sorry it is my fault give me sometime I will come up with working approach.


On Mon, Mar 24, 2014 at 10:44 AM, Valentin Popov <[email protected]>wrote:

> Andrey, hello
>
> I execute such code, to move documents to new classes
>
>  final ODatabaseDocumentTx database = new ODatabaseDocumentTx("local:"+
> dbLocation);
>
> database.open("admin", "admin");
>
>   ORecordIteratorClass<ODocument> record = database.browseClass("V");
>
>  for (ODocument oDocument : record) {
>
> Integer itemTypei = (Integer) oDocument.field("itemtype");
>
> ItemType type = BluePrintDatabase.getItemTypeFromInt(itemTypei);
>
>  ODocument copy = new ODocument();
>
> oDocument.copyTo(copy);
>
>  copy.setClassName(type.getClassName());
>
> copy.removeField("itemtype");
>
> copy.save();
>
> }
>
>  ORecordIteratorClass<ODocument> folders = database.browseClass("v_folder"
> );
>
>  for (ODocument oDocument : folders) {
>
> System.out.print(oDocument.toJSON());
>
> }
>
>
> I see documents on 1st loop are created and saved 
> (v_folder#9:1{out_folder:[4],OID:80d7ca29f40e8b50,itemname:Top
> of Personal Folders,cat:email,version_id:b821ec2b,in_folder:#12:0} v11)
>
>
> but check loop, return 0 result.
>
>
> Do I need some how insert copy document to database?
>
>
> Also output of folder contains new created files begins with v_*
>
>
> database.ocf e.och index.odh manindex.och orole.och user.0.ocl
> v_folder.0.ocl
>
> default.0.ocl folder.0.ocl internal.0.ocl ofunction.0.ocl oschedule.0.ocl
> user.och v_folder.och
>
> default.0.oda folder.och internal.och ofunction.och oschedule.och v.0.ocl
> v_root.0.ocl
>
> default.och index.0.ocl item.0.ocl orids.0.ocl ouser.0.ocl v.och
> v_root.och
>
> default.odh index.0.oda item.och orids.och ouser.och v_blob.0.ocl
> v_user.0.ocl
>
> e.0.ocl index.och manindex.0.ocl orole.0.ocl txlog.otx v_blob.och
> v_user.och
>
>
> Regards
> Valentin
>
>
>
>
> пятница, 21 марта 2014 г., 15:55:29 UTC+4 пользователь Andrey Lomakin
> написал:
>
>> Yes, sure.
>> It is possible but there is no toll for it.
>> You should create one which match you needs.
>>
>> I you need to copy document content you can use com.orientechnologies.
>> orient.core.record.impl.ODocument#copyTo and then set document class to
>> the one you need.
>> After that you can save document.
>>
>>
>> On Fri, Mar 21, 2014 at 1:39 PM, Valentin Popov <[email protected]>wrote:
>>
>>> 1. We have DB created by 1.5 library with local engine. It is schema
>>> free, so all records are V type and E type. All indexes are manual
>>> 2. Is it possible covert exist DB to 1.7 plocal with schema hybrid and
>>> auto indexes.
>>>
>>> For each record we know which class it must be, cause each record
>>> contains itemtype property.
>>>
>>>
>>> Still can not get it.
>>>>
>>>> Do you mean that you need to create classes and move records to the
>>>> classes ?
>>>>
>>>
>>> Yup, for vertexes also all edge's connections. And remove records from
>>> default class V.
>>>
>>>
>>>>
>>>>
>>>> On Fri, Mar 21, 2014 at 12:09 PM, Valentin Popov <[email protected]>wrote:
>>>>
>>>>> I mean we have a database 1.5.1 with manual indexes schema less on
>>>>> local engine. So all vertexes and edges are type V and E.
>>>>>
>>>>> We need using 1.7.x libs convert schema to schema hybrid and export
>>>>> it, after import it to plocal engine.
>>>>>
>>>>>
>>>>> Regards
>>>>>
>>>>>
>>>>>
>>>>> Sorry, I did not understand.
>>>>>> What do you mean ?
>>>>>>
>>>>>>
>>>>>> On Fri, Mar 21, 2014 at 11:55 AM, Valentin Popov 
>>>>>> <[email protected]>wrote:
>>>>>>
>>>>>>> Moving from 1.5.x (manual indexes, local, schema less) to 1.7.x
>>>>>>> (schema hybrid, auto index).
>>>>>>>
>>>>>>> My plan is change scheme on 1.5.x from schema less to schema hybrid
>>>>>>> follow such code and after export it:
>>>>>>>
>>>>>>>  String dbLocation = "/Library/Application Support/MailArchiva/ROOT/
>>>>>>> database/archiva.db";
>>>>>>>
>>>>>>> String exportFile = "/Library/Application Support/MailArchiva/ROOT/
>>>>>>> database/export.json";
>>>>>>>
>>>>>>>  final ODatabaseDocumentTx database = new ODatabaseDocumentTx(
>>>>>>> "local:"+dbLocation);
>>>>>>>
>>>>>>> database.open("admin", "admin");
>>>>>>>
>>>>>>>   ORecordIteratorClass<ODocument> record = database.browseClass("V"
>>>>>>> );
>>>>>>>
>>>>>>> // database.begin();
>>>>>>>
>>>>>>>  for (ODocument oDocument : record) {
>>>>>>>
>>>>>>> Integer itemTypei = (Integer) oDocument.field("itemtype");
>>>>>>>
>>>>>>> ItemType type = BluePrintDatabase.getItemTypeFromInt(itemTypei);
>>>>>>>
>>>>>>> String className  = oDocument.getClassName();
>>>>>>>
>>>>>>> oDocument.setClassName(type.getClassName());
>>>>>>>
>>>>>>> oDocument.removeField("itemtype");
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> database.commit();
>>>>>>>
>>>>>>>   ODatabaseExport databaseExport = null;
>>>>>>>
>>>>>>> try {
>>>>>>>
>>>>>>> databaseExport = new ODatabaseExport(database, exportFile, 
>>>>>>> newOCommandOutputListener() {
>>>>>>>
>>>>>>> @Override
>>>>>>>
>>>>>>> public void onMessage(String arg0) {
>>>>>>>
>>>>>>> System.out.println(arg0);
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> });
>>>>>>>
>>>>>>> databaseExport.exportDatabase();
>>>>>>>
>>>>>>> databaseExport.close();
>>>>>>>
>>>>>>> } catch (IOException e) {
>>>>>>>
>>>>>>> e.printStackTrace();
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> database.close();
>>>>>>>
>>>>>>>  Orient.instance().shutdown();
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> But I get some issues with that approach, it looks like Vertexes
>>>>>>> classes are not converted.
>>>>>>>
>>>>>>>
>>>>>>> Started export of database 'archiva.db' to /Library/Application
>>>>>>> Support/MailArchiva/ROOT/database/export.json.gz...
>>>>>>>
>>>>>>>
>>>>>>> Exporting database info...
>>>>>>>
>>>>>>> OK
>>>>>>>
>>>>>>>
>>>>>>> Exporting clusters...
>>>>>>>
>>>>>>> OK (18 clusters)
>>>>>>>
>>>>>>>
>>>>>>> Exporting schema...
>>>>>>>
>>>>>>> OK (17 classes)
>>>>>>>
>>>>>>>
>>>>>>> Exporting records...
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'internal' (id=0)...
>>>>>>>
>>>>>>> OK (records=3/3)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'index' (id=1)...
>>>>>>>
>>>>>>> OK (records=4/4)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'manindex' (id=2)...
>>>>>>>
>>>>>>>
>>>>>>> OK (records=12/12)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'default' (id=3)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'orole' (id=4)...
>>>>>>>
>>>>>>> OK (records=3/3)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'ouser' (id=5)...
>>>>>>>
>>>>>>> OK (records=3/3)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'ofunction' (id=6)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'oschedule' (id=7)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'orids' (id=8)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'v' (id=9)...
>>>>>>>
>>>>>>>
>>>>>>> OK (records=395/395)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'e' (id=10)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'user' (id=11)...
>>>>>>>
>>>>>>> OK (records=1/1)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'folder' (id=12)...
>>>>>>>
>>>>>>>
>>>>>>> OK (records=15/15)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'item' (id=13)...
>>>>>>>
>>>>>>>
>>>>>>> OK (records=378/378)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'v_root' (id=14)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'v_folder' (id=15)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'v_user' (id=16)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>> - Cluster 'v_blob' (id=17)...
>>>>>>>
>>>>>>> OK (records=0/0)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Done. Exported 814 of total 814 records
>>>>>>>
>>>>>>> Any ideas how to do export with schema modification from 1.5.x local
>>>>>>> correct, and import such export to new 1.7. plocal
>>>>>>>
>>>>>>> Regards
>>>>>>> Valentin
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> ---
>>>>>>> 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.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> Andrey Lomakin.
>>>>>>
>>>>>> Orient Technologies
>>>>>> the Company behind OrientDB
>>>>>>
>>>>>>   --
>>>>>
>>>>> ---
>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Andrey Lomakin.
>>>>
>>>> Orient Technologies
>>>> the Company behind OrientDB
>>>>
>>>>   --
>>>
>>> ---
>>> 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.
>>>
>>
>>
>>
>> --
>> Best regards,
>> Andrey Lomakin.
>>
>> Orient Technologies
>> the Company behind OrientDB
>>
>>   --
>
> ---
> 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.
>



-- 
Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

-- 

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