Unfortunately not directly,

you can use a workaround, e.g. a multipass:

> LOAD CSV WITH HEADERS FROM "file:///csv/user-data.csv" AS row
> WHERE row.roleLabel = "LabelA"
> CREATE (n:Person:LabelA);


or a pseudo conditional

> LOAD CSV WITH HEADERS FROM "file:///csv/user-data.csv" AS row
> FOREACH (x in case row.roleLabel when "LabelA" then [1] else [] end |
> CREATE (n:Person:LabelA))

> FOREACH (x in case row.roleLabel when "LabelB" then [1] else [] end |
> CREATE (n:Person:LabelB))


neo4j-import also supports setting labels directly from the CSV

you can also use my github.com/jexp/neo4j-shell-tools 
<http://github.com/jexp/neo4j-shell-tools> which allow a #{roleLabel} parameter 
substitution.

Michael

> Am 16.11.2015 um 19:34 schrieb [email protected]:
> 
> I am importing  via Load CSV where one column of data is a LABEL I want to 
> set for each person.  (e.g. the column represents role :MANAGER, :ENGINEER, 
> etc).
> 
> I have tried numerous variants, none works.  Here is the latest:
> 
> LOAD CSV WITH HEADERS FROM "file:///csv/user-data.csv" AS row
> WITH row, row.Role as roleLabel
> CREATE (n:Person:roleLabel)
> RETURN n
> 
> LABEL was set to roleLabel - not the value of roleLabel
> 
> LOAD CSV WITH HEADERS FROM "file:///csv/user-data.csv" AS row
> WITH row, row.Role as roleLabel
> CREATE (n:Person:toString(row.Role))
> RETURN n
> 
> Didn't run....doesn't like toString()
> 
> Can I use a field value as a LABEL?
> 
> Thanks
> 
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to