Luca,
I tried to set the Id property in a subsequent call, but received an error
message stating something to the effect of "Id is a readonly field."
Here is the exact error:
gremlin> new File("/Users/sandro/vertices.csv").each({ line ->
>
> gremlin> (username, age) = line.split(",")
>
> gremlin> user = bg.addVertex("Class:user")
>
> gremlin> ElementHelper.setProperties(user,
> ["Class":"user",id:username,"username":username,"age":age.toInteger()])
>
> gremlin> })
>
> Property key is reserved for all elements: id
>
> Display stack trace? [yN]
>
Sandro
On Monday, February 17, 2014 3:32:50 PM UTC-8, Lvc@ wrote:
>
> Can you setup the id as field after having indexed it?
>
> Lvc@
>
>
>
> On 18 February 2014 00:28, Sandro <[email protected] <javascript:>> wrote:
>
>> Thank you for creating an issue for CREATE LINK functionality. Will retry
>> when it will become available.
>>
>> As workaround, we have been trying to upload the data using Gremlin, by
>> following this example:
>> http://stackoverflow.com/questions/19006616/how-to-import-a-csv-file-into-titan-graph-database
>>
>> Sample code:
>>
>>
>>
>>> g = new OrientGraph("remote:localhost/cars")
>>> bg = new BatchGraph(g, VertexIDType.STRING, 1000)
>>> new File("/Users/sandro/vertices.csv").each({ line ->
>>> (username, age) = line.split(",")
>>> user = bg.addVertex(username)
>>> ElementHelper.setProperties(user,
>>> ["username":username,"age":age.toInteger()])
>>> })
>>> bg.commit()
>>> new File("/Users/sandro/edges.csv").each({ line ->
>>> (source, label, target) = line.split(",")
>>> v1 = bg.getVertex(source)
>>> v2 = bg.getVertex(target)
>>> bg.addEdge(null, v1, v2, label,[weight:0.75f])
>>> })
>>> bg.commit()
>>
>>
>> However, we ran into a challenge with bg.addVertex(id).
>>
>> We need to pass an Id to bg.addVertex, so that we can reference this
>> vertex in the subsequent operation and bind it to an edge.
>>
>> However, if we pass an Id into addVertex(id), then all vertices are
>> created as generic V's. On the other hand, if we pass class name by
>> calling bg.addVertex("class:MyClass"), then we cannot pass an id, and
>> therefore cannot reference this vertex by Id in the subsequent call to bind
>> it to an edge.
>>
>> Is there a way in which we can load our graph using Gremlin, while still
>> retaining the inheritance class structure of Vertices?
>>
>> Sandro
>>
>>
>>
>>
>> On Monday, February 17, 2014 4:31:54 AM UTC-8, Lvc@ wrote:
>>
>>> I've created an issue for this: https://github.com/
>>> orientechnologies/orientdb/issues/2045
>>>
>>> Lvc@
>>>
>>>
>>> On 17 February 2014 13:25, Luca Garulli <[email protected]> wrote:
>>>
>>>> Hi,
>>>> I think the problem is that we don't have an equivalent of "create
>>>> link" that transform field values aka RDBMS foreign keys, into edges but
>>>> only "links".
>>>>
>>>> Lvc@
>>>>
>>>>
>>>>
>>>> On 17 February 2014 11:51, Andrey Lomakin <[email protected]> wrote:
>>>>
>>>>> Also I would be appreciate if you send me your db anyway ))) we will
>>>>> check why links were not created.
>>>>>
>>>>>
>>>>> On Mon, Feb 17, 2014 at 12:48 PM, Andrey Lomakin <[email protected]
>>>>> > wrote:
>>>>>
>>>>>> Hi Sandro,
>>>>>> Could you use "create edge" command instead create link
>>>>>> https://github.com/orientechnologies/orientdb/wiki/SQL-Create-Edge ?
>>>>>> if still will be an issue could you send me database in stage when data
>>>>>> inserted but edges are still not created.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Feb 16, 2014 at 7:05 PM, Sandro <[email protected]> wrote:
>>>>>>
>>>>>>> Would Luca or anyone with Bulk Insert experience be able to comment
>>>>>>> on our issue, please? Our inability to bulk insert multiple records is
>>>>>>> stopping us on our tracks
>>>>>>>
>>>>>>> Thank you,
>>>>>>> Sandro
>>>>>>>
>>>>>>>
>>>>>>> On Saturday, February 15, 2014 9:14:04 AM UTC-8, Sandro wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> We love the concept of OrientDB, however have been struggling with
>>>>>>>> uploading our graph data (with a massiveinsert operation).
>>>>>>>>
>>>>>>>> *Background*
>>>>>>>>
>>>>>>>> We would like to migrate OrientDB away from an RDBMS. In RDBMS, we
>>>>>>>> had 3 tables: Person, School, and Education. We successfully
>>>>>>>> imported
>>>>>>>> data from these three tables into OrientDB, however are struggling
>>>>>>>> with
>>>>>>>> linking them together by with creating (Person <-- [Education] -->
>>>>>>>> School)
>>>>>>>> edges in OrientDB.
>>>>>>>>
>>>>>>>> Here are details of the original RDBMS tables:
>>>>>>>>
>>>>>>>> *Person:*
>>>>>>>>
>>>>>>>> Fields: Id (int), Name (string)
>>>>>>>>
>>>>>>>> Record Count: 28M
>>>>>>>>
>>>>>>>> *School:*
>>>>>>>>
>>>>>>>> Fields: Id (int), Name (string)
>>>>>>>>
>>>>>>>> Record Count: 7M
>>>>>>>>
>>>>>>>> *Education:*
>>>>>>>>
>>>>>>>> Fields: Id (int), PersonId_FK, SchoolId_FK
>>>>>>>>
>>>>>>>> Record Count: 35M
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> *OrientDB release?*
>>>>>>>>
>>>>>>>> orientdb-community-1.7-rc2-SNAPSHOT
>>>>>>>>
>>>>>>>>
>>>>>>>> *What steps will reproduce the problem?*
>>>>>>>> 1. We followed the tutorial https://github.com/orientechno
>>>>>>>> logies/orientdb/wiki/Import-From-RDBMS
>>>>>>>>
>>>>>>>>
>>>>>>>> connect remote:localhost/db admin admin
>>>>>>>>
>>>>>>>> DECLARE INTENT massiveinsert
>>>>>>>>
>>>>>>>> DROP CLASS Person
>>>>>>>> CREATE CLASS Person
>>>>>>>>
>>>>>>>> DROP CLASS School
>>>>>>>> CREATE CLASS School
>>>>>>>>
>>>>>>>> DROP CLASS Education
>>>>>>>> CREATE CLASS Education
>>>>>>>>
>>>>>>>> INSERT INTO Person(Id, Name)
>>>>>>>> VALUES (1, 'John Doe')
>>>>>>>> ..
>>>>>>>> INSERT INTO School(Id, Name)
>>>>>>>> VALUES (1, 'State University')
>>>>>>>> ..
>>>>>>>> INSERT INTO Education(Id, PersonId, SchoolId)
>>>>>>>> VALUES (1, 1, 1)
>>>>>>>> ...
>>>>>>>> *>>Successfully imported all Person, School, and Education records
>>>>>>>> in respective OrientDB classes!*
>>>>>>>>
>>>>>>>>
>>>>>>>> 2. After successfully loading the raw data in OrientDB Classes, we
>>>>>>>> are unable to create Edge links in bulk.
>>>>>>>>
>>>>>>>>
>>>>>>>> CREATE LINK schools TYPE linkset FROM Education.PersonId To
>>>>>>>> Person.id INVERSE
>>>>>>>>
>>>>>>>> *>> Created 0 link(s) in 342.528992 sec(s).*
>>>>>>>> CREATE LINK students TYPE linkset FROM Education.SchoolId To
>>>>>>>> School.id INVERSE
>>>>>>>>
>>>>>>>> *>> Created 0 link(s) in 348.332344 sec(s).*
>>>>>>>> NOTE: We are expecting to build the graph from our data, so that
>>>>>>>> we can use .in() and .out() calls on edges and vertices. We have
>>>>>>>> doubts
>>>>>>>> that CREATE LINK operation builds proper graph linkages, because based
>>>>>>>> on
>>>>>>>> the documentation that we read CREATE LINK does not create a
>>>>>>>> bidirectional
>>>>>>>> Edge link.
>>>>>>>>
>>>>>>>>
>>>>>>>> *If you're using custom settings please provide them below*
>>>>>>>>
>>>>>>>> We are not using any custom settings for the OrientDB server or JVM
>>>>>>>>
>>>>>>>>
>>>>>>>> *What is the expected output? What do you see instead?*
>>>>>>>>
>>>>>>>> Our expected output is a proper graph compiled from our data,
>>>>>>>> stored in OrientDB. Instead, we are unable to create 2-way Education
>>>>>>>> edges
>>>>>>>> between Person and School vertices. Just to reiterate, all three
>>>>>>>> classes
>>>>>>>> are successfully populated, but we are unable to establish edge links.
>>>>>>>>
>>>>>>>>
>>>>>>>> *Additional notes:*
>>>>>>>>
>>>>>>>> After import, the current DB size is 20GB
>>>>>>>>
>>>>>>>> Indexes have not been created
>>>>>>>>
>>>>>>>> Currently, we are attempting this operation on a Mac with the
>>>>>>>> following specs
>>>>>>>>
>>>>>>>> 1.7 GHz Intel Core i7
>>>>>>>>
>>>>>>>> 8GB 1600 MHz DDR3 RAM
>>>>>>>>
>>>>>>>> 500GB SSD HD
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Please help,
>>>>>>>> Sandro
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>
>>>>>>> ---
>>>>>>> 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.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> Andrey Lomakin.
>>>>>>
>>>>>> Orient Technologies
>>>>>> the Company behind OrientDB
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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/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] <javascript:>.
>> 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.