Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ternary operator/default value in neo4j cypher
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Robin Kc  
View profile  
 More options Jul 24 2012, 8:09 am
From: Robin Kc <arora.k.ro...@gmail.com>
Date: Tue, 24 Jul 2012 05:09:57 -0700 (PDT)
Local: Tues, Jul 24 2012 8:09 am
Subject: ternary operator/default value in neo4j cypher

I need to implement something of a ternary operator that can help me return
some default values from cypher query itself.

Scenario is -

if an employee's city is Delhi, return 5 else return 10

Something like a ternary operator.

start employee = node(5)
return employee.city == 'DELHI' ? 5 : 10 as val;

I tried things like

start employee = node(5)
return coalesce (employee.city == 'DELHI', 5)

but no luck.

Is there a way to implement such a scenario in neo4j be it Cypher or
Traversal.

I have posted the same question on stackoverflow -
http://stackoverflow.com/questions/11629913/ternary-operator-default-...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andres Taylor  
View profile  
 More options Jul 24 2012, 11:44 am
From: Andres Taylor <andres.tay...@neotechnology.com>
Date: Tue, 24 Jul 2012 17:44:51 +0200
Local: Tues, Jul 24 2012 11:44 am
Subject: Re: [Neo4j] ternary operator/default value in neo4j cypher

Nothing like this exists. It's a really good suggestion though.

As a side note - this is something I would love help with. There are a
number of different ways to do this though, and it would be really helpful
if someone could research the topic a bit an make a suggestion. I come from
a T-SQL background, and there you use
CASE<http://msdn.microsoft.com/en-us/library/ms181765.aspx>.
C# has the ternary operator. I'm very fond of Scala's match operator. What
is a good fit for Cypher?

Andrés

--
The best way to ask for Cypher help: http://console.neo4j.org/usage.html

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jim Webber  
View profile  
 More options Jul 27 2012, 12:17 pm
From: Jim Webber <j...@neotechnology.com>
Date: Fri, 27 Jul 2012 17:17:02 +0100
Local: Fri, Jul 27 2012 12:17 pm
Subject: Re: [Neo4j] ternary operator/default value in neo4j cypher
Forgive my meddling in this one, but I confess to being a little wary of this notion.

I rather like that Cypher is very graph focussed, and addresses the domain of the database. If we choose to add in functionality like this, Cypher becomes more and more like a general-purpose programming language. I don't think that's helpful because:

1. We know it's not a good idea to encode business logic in queries..
2. There are lots of good programming languages out there already which can easily handle the return val = "DELHI" ? 5 : 10 case. Note that neither 5 nor 10 are actually about data access and manipulation here, they're domain things.

Even if those features existed in Cypher today, I don't think in good conscience I would use them to develop a  business information system - I think it conflates concerns.

Just my £0.02.

Jim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Max De Marzi Jr.  
View profile  
 More options Jul 27 2012, 6:15 pm
From: "Max De Marzi Jr." <maxdema...@gmail.com>
Date: Fri, 27 Jul 2012 15:15:51 -0700 (PDT)
Local: Fri, Jul 27 2012 6:15 pm
Subject: Re: [Neo4j] ternary operator/default value in neo4j cypher

People put all kinds of business logic in SQL queries.  If cypher is to be the graph equivalent of SQL it needs to be able to handle business logic.  

It needs to.  Will it make cypher less pure? Absolutely, but we have to be pragmatic here.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Jul 28 2012, 8:50 am
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Sat, 28 Jul 2012 14:50:30 +0200
Local: Sat, Jul 28 2012 8:50 am
Subject: Re: [Neo4j] ternary operator/default value in neo4j cypher
Agree w/ Max

We should enable people to solve their problems easily and kick ass doing so

Sent from mobile device

Am 28.07.2012 um 00:15 schrieb "Max De Marzi Jr." <maxdema...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »