Collection

18 views
Skip to first unread message

sandra haddad

unread,
May 13, 2015, 9:15:11 AM5/13/15
to ne...@googlegroups.com
hello ,

I would like to model the following, s1 and s2 are related by a link and this link have 2 types:type1 and type2 and 2 fields :field1,field2
I tried to run this query

CREATE (s1)-[:LINKED_TO{Type:'type1',Field:'Field1'}]->(s2)
CREATE (s1)-[:LINKED_TO{Type:'type2',Field:'Field2'}]->(s2)

 but the second one override the first one and i need to maintain this structure for the 2 types and the 2 fields . to explain more i want to have something like that
CREATE (s1)-[:LINKED_TO{Type:'type1',Field:'Field1'},{Type:'type2',Field:'Field2'}]->(s2)
and i may have several types and everal fields such as 
CREATE (s1)-[:LINKED_TO{Type:'type1',Field:'Field1'},{Type:'type2',Field:'Field2'},......{Type:'typen',Field:'Fieldn}]->(s2)

so i decided to use a collection with a key, value but i don't know how to use it and can't find any useful reference. Help !

Regards

Michael Hunger

unread,
May 13, 2015, 7:10:40 PM5/13/15
to ne...@googlegroups.com
Not sure I understand.

What is the problem with creating multiple links? And I would also encode the type in the relationship-type.

Otherwise you could also use two arrays one for types and one for fields

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sandra haddad

unread,
May 19, 2015, 5:15:35 AM5/19/15
to ne...@googlegroups.com
i can not use the array because this way i will have all types mixed in one array , however i have many other fields and they are related to a type for examaple i have similarity 0.8(example) for type1 and same for the other types, if i represent the similarity field using an array ;{0.8,0.7,0.6} i can not differenciate which number is for type 1 and which one for type2.... therefore i thought that use a key value synatx within the same link will help solving this issue! any other suggestions

Michael Hunger

unread,
May 19, 2015, 7:12:01 AM5/19/15
to ne...@googlegroups.com
The other thing I didn't get was:

CREATE (s1)-[:LINKED_TO{Type:'type1',Field:'Field1'}]->(s2)
CREATE (s1)-[:LINKED_TO{Type:'type2',Field:'Field2'}]->(s2)

 but the second one override the first one and i need to maintain this structure for the 2 types and the 2 fields

How does it override the first one? Both relationships should exist after you ran that query.

Michael

Reply all
Reply to author
Forward
0 new messages