Git Product home page Git Product logo

Comments (15)

drd0rk avatar drd0rk commented on July 17, 2024

Hi,

I would be pleased by this feature being available.

greets

from node-neo4j.

mypark avatar mypark commented on July 17, 2024

+1 for me to, would be simple to add I would think..

from node-neo4j.

freeeve avatar freeeve commented on July 17, 2024

I think this is pretty easily handled in Cypher nowadays (1.8+), but I could be wrong about the specifics.

from node-neo4j.

aseemk avatar aseemk commented on July 17, 2024

Cypher supports that notion relative to a relationship (create this node connected to foo if no other node is connected to foo), while unique indexing is relative to a property (create this node with foo:bar if no other node has foo:bar). It's an interesting difference.

from node-neo4j.

freeeve avatar freeeve commented on July 17, 2024

Yeah, I played around with it for a bit (even using just plain CREATE instead of CREATE UNIQUE), but I think you're right. Might warrant adding some sort of similar functionality to Cypher in 1.9--seems like a good use case.

from node-neo4j.

aseemk avatar aseemk commented on July 17, 2024

Some great discussion on this subject with @flipside in issue #36:

#36 (comment) (GitHub shows this URL as just going to the issue, but it'll go to the specific comment that starts this discussion)

Thoughts/feedback welcome, in particular your use case -- is it more for creating nodes uniquely or indexing them uniquely?

from node-neo4j.

alexeichemenda avatar alexeichemenda commented on July 17, 2024

Hey guys,
Just wanted to get an update on whether this feature (creating new node only if a node with same properties does not exist) is going to be implemented ? (Or if it is already implemented by now ?)

And I mean not looking at any relationships. Basically what I would love is doing :
START user=node(1)
CREATE UNIQUE user-[:friend]-(otherUser {name:"Alexei", type:"user"})
and it would only create a node (otherUser {name:"Alexei", type:"user"}) if it doesn't exist yet, regardless of any relationships.

How could I do that ?

Thanks !

from node-neo4j.

aseemk avatar aseemk commented on July 17, 2024

Hey @alexeichemenda, sorry this hasn't been implemented yet! There's a pull request open that I've been meaning to finish up (it could use some tests and a bit of cleaning up). I'd love to get to that soon.

from node-neo4j.

alexeichemenda avatar alexeichemenda commented on July 17, 2024

Thanks for the reply @aseemk. Is there any way I can help make this process faster ? I would love to see this feature implemented really quickly (within the next 10 days ?). If we both work on this issue, when do you think it would be possible to make it available ?

And do you see any bypass for a temporary solution ? I am interacting with neo4j through javascript, sending cypher queries through REST api. Thanks ;)

from node-neo4j.

aseemk avatar aseemk commented on July 17, 2024

Oh man, sorry for the delay @alexeichemenda. Your help would be great. The pull request is #55. You could pull that branch locally, rebase to the latest develop here, and run that locally and make sure it works for you. (And run the tests too and make sure they work for you?)

If it works for you and you have no issues, I can prioritize merging it in and pushing a new release out later this week! That also means then that in the meantime, you can push that branch to your own fork of this project, and update your npm to point to your fork until this release is live. That way you don't have to wait for me either. =)

Let me know, and thanks for your offer to help!

from node-neo4j.

alexeichemenda avatar alexeichemenda commented on July 17, 2024

Great !
I won't have much time until Saturday, but I'll definitely do that before next Wednesday.

I'll mail you if I have any problems.
Take care !

Sent from Mailbox for iPhone

On Mon, May 6, 2013 at 9:28 PM, Aseem Kishore [email protected]
wrote:

Oh man, sorry for the delay @alexeichemenda. Your help would be great. The pull request is #55. You could pull that branch locally, rebase to the latest develop here, and run that locally and make sure it works for you. (And run the tests too and make sure they work for you?)
If it works for you and you have no issues, I can prioritize merging it in and pushing a new release out later this week! That also means then that in the meantime, you can push that branch to your own fork of this project, and update your npm to point to your fork until this release is live. That way you don't have to wait for me either. =)

Let me know, and thanks for your offer to help!

Reply to this email directly or view it on GitHub:
#14 (comment)

from node-neo4j.

aleksandrenko avatar aleksandrenko commented on July 17, 2024

I kinnda' fix it, for me.
You have to use neo4j 1.9, and small correction you have to do is in index methods for node and relationship. Here is my change for the node index method:

from line 204:
else {
var urlToPost = ((("" + services.node_index) + "/") + index + '?uniqueness=create_or_fail');
/* 123 _/ return __this.request.post({
/
124 */ url: urlToPost,

/* 125 / json: {
/
126 / key: key,
/
127 / value: value,
/
128 / uri: __this.self
}
}, __cb(
, __frame, 17, 21, function ___(__0, _4) {
/
123 */ response = __4;
__then();
}, true));

from node-neo4j.

alexeichemenda avatar alexeichemenda commented on July 17, 2024

That's great! I'll definitely give it a try tomorrow. Sorry I have been very
busy lately and didn't have a chance to do it myself.

I'll keep you posted ASAP.

From: Nikolai [email protected]
Reply-To: thingdom/node-neo4j
<reply+i-3012883-eb344cd3c4493a057236ec19baef1b3898b067b3-1675106@reply.gith
ub.com>
Date: Thu, 30 May 2013 08:56:14 -0700
To: thingdom/node-neo4j [email protected]
Cc: Alexei Chemenda [email protected]
Subject: Re: [node-neo4j] Neo4j 1.6: support unique index "put if
absent"(#14)

I kinnda' fix it, for me.
You have to use neo4j 1.9, and small correction you have to do is in index
methods for node and relationship. Here is my change for the node index
method:

from line 204:
else {
var urlToPost = ((("" + services.node_index) + "/") + index +
'?uniqueness=create_or_fail');
/* 123 / return __this._request.post({
/ 124 */ url: urlToPost,

/* 125 / json: {
/ 126 / key: key,
/ 127 / value: value,
/ 128 / uri: this.self
}
}, __cb(_, __frame, 17, 21, function ___(0, __4) {
/ 123 */ response = __4;
__then();
}, true));


Reply to this email directly or view it on GitHub
#14 (comment) .

from node-neo4j.

aseemk avatar aseemk commented on July 17, 2024

In case you missed the notification, this feature was unfortunately removed from Neo4j 1.9, so we can't support it. Neo4j 2.0's auto-indexing improvements should make this automatic though.

from node-neo4j.

alexeichemenda avatar alexeichemenda commented on July 17, 2024

Thanks for the update ! I'll have a look pretty soon. 

Regards,


Alexei Chemenda
MotionLead - CoFounder
http://www.motionlead.com
+33.6.15.94.18.81

Sent from my iPhone

On Thu, Oct 3, 2013 at 12:00 AM, Aseem Kishore [email protected]
wrote:

In case you missed the notification, this feature was unfortunately removed from Neo4j 1.9, so we can't support it. Neo4j 2.0's auto-indexing improvements should make this automatic though.

Reply to this email directly or view it on GitHub:
#14 (comment)

from node-neo4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.