# Problem with property list

**URL:** <https://community.neo4j.com/t/problem-with-property-list/13557>\
**Category:** Neo4j Graph Platform\
**Created:** [January 11, 2020, 7:01pm UTC](https://community.neo4j.com/t/problem-with-property-list/13557 "2020-01-11T19:01:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![f.bergamin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/f.bergamin/32/5995_2.png) [@f.bergamin](https://community.neo4j.com/u/f.bergamin)\
**Post date:** [January 11, 2020, 7:01pm UTC](https://community.neo4j.com/t/problem-with-property-list/13557/1 "2020-01-11T19:01:16Z")

</div>

Hi,  
i'am new in neo4j, and i have a problem. I have two nodes type, Authors and Articles.  
Authors' property are(name, surname, ScopusId), and Articles' property are (title, source,idScopusArticle,AuthorsId). AuthorsId is a list, and it contains the authors' idScopus that had wrote the article. How can i create a label (authors)-[:publicate]-\>(Articles) for all authors in the list ?  
please help me

---

<div class="post-metadata">

**Author:** ![Estelle](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/estelle/32/33070_2.png) [@Estelle](https://community.neo4j.com/u/Estelle)\
**Post date:** [January 11, 2020, 8:22pm UTC](https://community.neo4j.com/t/problem-with-property-list/13557/2 "2020-01-11T20:22:29Z")

</div>

Hi,

If AuthorsIds is a list, you need to [UNWIND](https://neo4j.com/docs/cypher-manual/current/clauses/unwind/) it to get each id individually. Then you can get the corresponding Author node, and create the relationship from there.

```auto
MATCH (article:Article)
UNWIND article.AuthorsIds as authorId
WITH article, authorId
MATCH (author:Author {id: authorId})
CREATE (author)-[:PUBLICATE]->(article)

```

If for some reason, AuthorsIds is a string, you can transform it to a list with [split](https://neo4j.com/docs/cypher-manual/current/functions/string/#functions-split)

---

<div class="post-metadata">

**Author:** ![f.bergamin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/f.bergamin/32/5995_2.png) [@f.bergamin](https://community.neo4j.com/u/f.bergamin)\
**Post date:** [January 11, 2020, 9:04pm UTC](https://community.neo4j.com/t/problem-with-property-list/13557/3 "2020-01-11T21:04:13Z")

</div>

thank you for your help.  
i try it, but match only with the first element's list.

---

<div class="post-metadata">

**Author:** ![ameyasoft](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ameyasoft/32/32639_2.png) [@ameyasoft](https://community.neo4j.com/u/ameyasoft)\
**Post date:** [January 11, 2020, 9:17pm UTC](https://community.neo4j.com/t/problem-with-property-list/13557/4 "2020-01-11T21:17:55Z")

</div>

I created a sample scenario:

MERGE (a:Authors {ScopusID: 'SID1'})  
MERGE (a1:Authors {ScopusID: 'SID2'})  
MERGE (a2:Authors {ScopusID: 'SID3'})

MERGE (b:Articles {title: 'Title1', idScopusArticle: 'A1', AuthorsId: ['SID1', 'SID2']})

Return a, a1, a2, b;  
Result:  
 ![berg2](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/5/5e3223e7c8bcc3d5eb16cf0e6024caa41153acd6.png)

Select authors that match:

MATCH (b:Articles)  
MATCH (a:Authors) WHERE a.ScopusID IN b.AuthorsId  
Return a, b  
Result:  
 ![berg3](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/7/77a4262f39fb8c6f089b0d40cd2291a285e4405b.png)

Create a relationship between matched authors and articles:  
MATCH (b:Articles)  
MATCH (a:Authors) WHERE a.ScopusID IN b.AuthorsId  
MERGE (a)-[:PUBLICATE]-\>(b)  
Return a, b  
Result:  
 ![berg1](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/c/cae43d7dd6df57aea88fa8d50196435ddca8b540.png)

---

<div class="post-metadata">

**Author:** ![f.bergamin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/f.bergamin/32/5995_2.png) [@f.bergamin](https://community.neo4j.com/u/f.bergamin)\
**Post date:** [January 11, 2020, 11:05pm UTC](https://community.neo4j.com/t/problem-with-property-list/13557/5 "2020-01-11T23:05:35Z")

</div>

i try, but it doesn't works.  
this is code for the nodes Authors and Articles  
the code matchs only with the first element of the list

Authors:  
load csv with headers from 'file:///Authors.csv' as line  
merge(n:Authors{idScopus:line.idScopus,lastName:line.LastName,Name:line.FirstName,email:line.email,numberDoc:line.nDoc,numberCitiations:line.nCitations,nuberDocCitiation:line.nDocCitation,subjectArea:split(line.subjarea,",")})

Articles:  
load csv with headers from 'file:///Scopus\_article.csv' as line  
create(n:Article{Authors:line.Authors,IdAuthors:split(line.AuthorsID,";"),Source:line.SourceTitle,title:line.Title,Year:toInteger(line.Year),Volume:toInteger(line.Volume),pageStart:line.PageStart,pageEnd:line.PageEnd,numberPage:line.PageCount,CitedBy:line.CitedBy,scopusID:line.EID})

In Articles i use CREATE because there are some "null" value in the csv.

---

<div class="post-metadata">

**Author:** ![ameyasoft](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ameyasoft/32/32639_2.png) [@ameyasoft](https://community.neo4j.com/u/ameyasoft)\
**Post date:** [January 12, 2020, 12:02am UTC](https://community.neo4j.com/t/problem-with-property-list/13557/6 "2020-01-12T00:02:22Z")

</div>

Please send me one line from your Scopus\_article.csv or at lease the value in column line.AuthorsID so that I can offer better solution.

---

<div class="post-metadata">

**Author:** ![f.bergamin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/f.bergamin/32/5995_2.png) [@f.bergamin](https://community.neo4j.com/u/f.bergamin)\
**Post date:** [January 12, 2020, 12:52am UTC](https://community.neo4j.com/t/problem-with-property-list/13557/7 "2020-01-12T00:52:43Z")

</div>

Authors,AuthorsID,Title,Year,SourceTitle,Volume,Issue,ArtNo,PageStart,PageEnd,PageCount,CitedBy,DOI,Link,DocumentType,PublicationStage,AccessType,Source,EID  
"Bianco, S., Buzzelli, M., Ciocca, G., Schettini, R.",55511749108; 55744003800; 6603733325; 56235309600,Neural architecture search for image saliency fusion,2020,Information Fusion,57,,,89,101,,,10.1016/j.inffus.2019.12.007,[https://www.scopus.com/inward/record.url?eid=2-s2.0-85076853749&partnerID=40&md5=c8e29ac5494986cf3cf61c3ff5989be7,Article,Final,,Scopus,2-s2.0-85076853749](https://www.scopus.com/inward/record.url?eid=2-s2.0-85076853749&partnerID=40&md5=c8e29ac5494986cf3cf61c3ff5989be7,Article,Final,,Scopus,2-s2.0-85076853749)

---

<div class="post-metadata">

**Author:** ![ameyasoft](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ameyasoft/32/32639_2.png) [@ameyasoft](https://community.neo4j.com/u/ameyasoft)\
**Post date:** [January 12, 2020, 4:03am UTC](https://community.neo4j.com/t/problem-with-property-list/13557/8 "2020-01-12T04:03:50Z")

</div>

This IdAuthors:split(line.AuthorsID,";") stores the property value as an array. Here you need to use UNWIND to get all the author ids.

I created a scenario with your line.AuthorsID.

MERGE (a:Author {ScopusID: '55744003800'})  
MERGE (a1:Author {ScopusID: ' 56235309600'})  
MERGE (a2:Author {ScopusID: '55511749108'})  
MERGE (a3:Author {ScopusID: ' 6603733325'})

MERGE (b:Article {title: 'TitleA', idScopusArticle: 'AA2', AuthorsId: split('55511749108; 55744003800; 6603733325', ';')})  
MERGE (b1:Article {title: 'TitleB', idScopusArticle: 'AA3', AuthorsId: split('55744003800; 56235309600', ';')})

Select Article with a particular title, get all the matching authors and create the [:PUBLICATE] relationship between articles and authors. Here are the Cypher queries.

MATCH (b:Article)  
WHERE b.title = "TitleA"  
WITH b.AuthorsId as Authr, b  
UNWIND Authr as Authrs  
MATCH (a:Author) WHERE trim(a.ScopusID) = trim(Authrs)  
MERGE (a)-[:PUBLICATE]-\>(b)  
Return a, b  
Resault: ![berg5](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/9/9bdda81b67ddb651681887dfb38428a0b2e20d1e.png)

MATCH (b:Article)  
WHERE b.title = "TitleB"  
WITH b.AuthorsId as Authr, b  
UNWIND Authr as Authrs  
MATCH (a:Author) WHERE trim(a.ScopusID) = trim(Authrs)  
MERGE (a)-[:PUBLICATE]-\>(b)  
Return a, b  
Result:  
 ![berg6](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/3/35d1c759c6c58b03bf795c9e0ebf94ea11fae092.png)

---

<div class="post-metadata">

**Author:** ![f.bergamin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/f.bergamin/32/5995_2.png) [@f.bergamin](https://community.neo4j.com/u/f.bergamin)\
**Post date:** [January 12, 2020, 10:42am UTC](https://community.neo4j.com/t/problem-with-property-list/13557/9 "2020-01-12T10:42:39Z")

</div>

thank you verry much ! it works !  
is there a way to make it with all elements with one query ?
