Hi kamal. thanks, thats also how i do it now.

Maybe one other question to the community

Is there an example of a cypher query using a *call apoc.do.case()*
procedure where you want to have multiple "condition,query" pairs and where
each "query" performs multiple operations such as a property SET operations
that are comma seperated (such as :  SET node.a = "bla1", node.b = "bla2")
.. or maybe even whole complex MATCH etc queries

What would be the exact syntax for that -- i guess something like ..

call apoc.do.case([testval=1,SET node.a = "bla1", node.b = "bla2"],[
testval=2, SET node.a = "bla3", node.b = "bla4"], SET node.a = "bla5",
node.b = "bla6" ??????

This is the "help" info ...

"apoc.do.case([condition, query, condition, query, ...], elseQuery:'',
params:{}) yield value - given a list of conditional / writing query pairs,
executes the query associated with the first conditional evaluating to true
(or the else query if none are true) with the given parameters"

It looks like the square brackets should be around a single condition /
query pair ?   And what about the ....elseQuery ", params:{} ...    part ..
is that correct in the help info ?

thanks koen

ps.. are there any plans to descibe the usage (with examples) / valid
paramaters and their values etc of most apoc functions and procedures in a
little more detail and consistency ?   imho that would make using several
of these more easy and also make more clear what hey are really meant for
in some cases..




2017-11-30 0:16 GMT+01:00 Kamal Murthy <ameyas...@gmail.com>:

> Hi Koen,
>
> If one GUUID for one machine name, then you can create unique constraint
> on name property and this avoids duplicate records.
>
> CREATE CONSTRAINT ON (s:Server) ASSERT s.name IS UNIQUE;
>
> After creating this constraint, I ran MERGE (server:Server { name: "Test",
> uuid: apoc.create.uuid() } statements twice and got only one  node with
> name "Test".
>
> I do not know if this satisfies your requirement.
>
> -Kamal
>
>
> On Wednesday, November 29, 2017 at 11:48:30 AM UTC-8, koen wrote:
>>
>> H kamal thanks, that works too. i guess the original problem was due to
>> the "call" statement being there .. removing that seems to work although i
>> thought i tested that already .. it also needed small rewrite to SET the
>> uuid property to avoid duplicate record conflicts
>>
>> so for apoc functions no call stetement in front i guess
>>
>> thanks
>>
>> 2017-11-29 20:30 GMT+01:00 Kamal Murthy <amey...@gmail.com>:
>>
>>> Hi Koen,
>>>
>>> It is missing WITH line statement. Try this:
>>>
>>> USING PERIODIC COMMIT
>>> LOAD CSV WITH HEADERS
>>> FROM "file:///test.csv" AS line FIELDTERMINATOR ';'
>>> *WITH line, * *apoc.create.uuid()  as uid*
>>> MERGE (server:Server { name: line.'Machine Name`, uuid: *uid* })
>>>
>>> Or,
>>>
>>> USING PERIODIC COMMIT
>>> LOAD CSV WITH HEADERS
>>> FROM "file:///test.csv" AS line FIELDTERMINATOR ';'
>>> *WITH line*
>>> MERGE (server:Server { name: line.'Machine Name`, uuid:
>>> *apoc.create.uuid()* })
>>>
>>> I prefer the first one.
>>>
>>> -Kamal
>>>
>>> On Wednesday, November 29, 2017 at 10:45:42 AM UTC-8, koen wrote:
>>>>
>>>> Hi, when using the following simple cypher query with the apoc function
>>>> apoc.create.uuid()
>>>>
>>>> USING PERIODIC COMMIT
>>>> LOAD CSV WITH HEADERS
>>>> FROM "file:///test.csv" AS line FIELDTERMINATOR ';'
>>>> MERGE (server:Server { name: line.`Machine Name`, uuid: call
>>>> apoc.create.uuid() })
>>>>
>>>> I keep getting an error message like
>>>>
>>>> Invalid input 'p': expected 'n/N' (line 4, column 63 (offset: 158))
>>>> "MERGE (server:Server { name: line.`Machine Name`, uuid: call 
>>>> apoc.create.uuid() })"
>>>>
>>>>
>>>> I am running latest version of desktop, all procedures and functions
>>>> are active and show in the browser (when running the list procedutes /
>>>> functions command) and without the   -- uuid: call apoc.create.uuid() --
>>>> part the query works fine
>>>>
>>>> Do i have to do / configure something so that i can use apoc functions
>>>> in queries ? Or is the query syntax not ok ?
>>>>
>>>> Thanks Koen
>>>>
>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Neo4j" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/neo4j/3OedUQ8P2i0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> neo4j+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Groeten / Best Regards,
>>
>> Koen
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Neo4j" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/neo4j/3OedUQ8P2i0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Groeten / Best Regards,

Koen

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to