Neo4j Graph DB: How to do time-based datamodelling for User->SecurityHoldings relationship










0















I am new to Neo4j Graph database and I am trying to do data-modelling of below User Investment holding information into the Graph DB:



I have a User entity:



(n:User)

"user_id": "1000001", "account_number":"1234500"



And a Securities entity:



(n:Security)

"security_id": "12001", "cusip_number":"NH0000909", "ISIN":"US61760X7782"



And I have a relationship between those 2 entities:



(User "user_id": "1000001")-[:HOLDS quatity: 150]->(Security "security_id": "12001")


It looks like this in Graphical format:
enter image description here



Now here is the major problem in this data model:



  1. This relationship between the User and Securities is dynamic over time. Meaning the Security Quantity a User holds changes each day. But in above Graph the Quantity is fixed so some way needs to be added to show Quantity changing everyday for User's Securities.



  2. There is another relationship between Security and DailyPrice. Meaning each Security's price will change each day. So how can I model this history information too? :



    (Security "security_id": "12001")-[:HAS]->(DailyPrice date: 10/22/2018, price: 55.20, currency: USD)



Could you please help me with the correct data-modelling so that above 2 problems can be solved?










share|improve this question
























  • How is quantity determined? Do you need a historical record or just the current state? (1) is only a problem if you need the history, and (2) is stated as a fact, not a problem. In what way is your current model failing you?

    – Tezra
    Nov 15 '18 at 21:32











  • Hi @Tezra. Ofcourse as the title of this Question suggests, this is a Time based or History based data modelling problem. And yes I updated #2 so that it clearly states that both #1 and #2 requires storing History information for each Day i.e. in #1 I want Quatity information for each day and for #2 I want Seurity Price for each day.

    – sunny_dev
    Nov 16 '18 at 9:47















0















I am new to Neo4j Graph database and I am trying to do data-modelling of below User Investment holding information into the Graph DB:



I have a User entity:



(n:User)

"user_id": "1000001", "account_number":"1234500"



And a Securities entity:



(n:Security)

"security_id": "12001", "cusip_number":"NH0000909", "ISIN":"US61760X7782"



And I have a relationship between those 2 entities:



(User "user_id": "1000001")-[:HOLDS quatity: 150]->(Security "security_id": "12001")


It looks like this in Graphical format:
enter image description here



Now here is the major problem in this data model:



  1. This relationship between the User and Securities is dynamic over time. Meaning the Security Quantity a User holds changes each day. But in above Graph the Quantity is fixed so some way needs to be added to show Quantity changing everyday for User's Securities.



  2. There is another relationship between Security and DailyPrice. Meaning each Security's price will change each day. So how can I model this history information too? :



    (Security "security_id": "12001")-[:HAS]->(DailyPrice date: 10/22/2018, price: 55.20, currency: USD)



Could you please help me with the correct data-modelling so that above 2 problems can be solved?










share|improve this question
























  • How is quantity determined? Do you need a historical record or just the current state? (1) is only a problem if you need the history, and (2) is stated as a fact, not a problem. In what way is your current model failing you?

    – Tezra
    Nov 15 '18 at 21:32











  • Hi @Tezra. Ofcourse as the title of this Question suggests, this is a Time based or History based data modelling problem. And yes I updated #2 so that it clearly states that both #1 and #2 requires storing History information for each Day i.e. in #1 I want Quatity information for each day and for #2 I want Seurity Price for each day.

    – sunny_dev
    Nov 16 '18 at 9:47













0












0








0








I am new to Neo4j Graph database and I am trying to do data-modelling of below User Investment holding information into the Graph DB:



I have a User entity:



(n:User)

"user_id": "1000001", "account_number":"1234500"



And a Securities entity:



(n:Security)

"security_id": "12001", "cusip_number":"NH0000909", "ISIN":"US61760X7782"



And I have a relationship between those 2 entities:



(User "user_id": "1000001")-[:HOLDS quatity: 150]->(Security "security_id": "12001")


It looks like this in Graphical format:
enter image description here



Now here is the major problem in this data model:



  1. This relationship between the User and Securities is dynamic over time. Meaning the Security Quantity a User holds changes each day. But in above Graph the Quantity is fixed so some way needs to be added to show Quantity changing everyday for User's Securities.



  2. There is another relationship between Security and DailyPrice. Meaning each Security's price will change each day. So how can I model this history information too? :



    (Security "security_id": "12001")-[:HAS]->(DailyPrice date: 10/22/2018, price: 55.20, currency: USD)



Could you please help me with the correct data-modelling so that above 2 problems can be solved?










share|improve this question
















I am new to Neo4j Graph database and I am trying to do data-modelling of below User Investment holding information into the Graph DB:



I have a User entity:



(n:User)

"user_id": "1000001", "account_number":"1234500"



And a Securities entity:



(n:Security)

"security_id": "12001", "cusip_number":"NH0000909", "ISIN":"US61760X7782"



And I have a relationship between those 2 entities:



(User "user_id": "1000001")-[:HOLDS quatity: 150]->(Security "security_id": "12001")


It looks like this in Graphical format:
enter image description here



Now here is the major problem in this data model:



  1. This relationship between the User and Securities is dynamic over time. Meaning the Security Quantity a User holds changes each day. But in above Graph the Quantity is fixed so some way needs to be added to show Quantity changing everyday for User's Securities.



  2. There is another relationship between Security and DailyPrice. Meaning each Security's price will change each day. So how can I model this history information too? :



    (Security "security_id": "12001")-[:HAS]->(DailyPrice date: 10/22/2018, price: 55.20, currency: USD)



Could you please help me with the correct data-modelling so that above 2 problems can be solved?







java graph neo4j cypher






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 9:46







sunny_dev

















asked Nov 14 '18 at 6:41









sunny_devsunny_dev

3693623




3693623












  • How is quantity determined? Do you need a historical record or just the current state? (1) is only a problem if you need the history, and (2) is stated as a fact, not a problem. In what way is your current model failing you?

    – Tezra
    Nov 15 '18 at 21:32











  • Hi @Tezra. Ofcourse as the title of this Question suggests, this is a Time based or History based data modelling problem. And yes I updated #2 so that it clearly states that both #1 and #2 requires storing History information for each Day i.e. in #1 I want Quatity information for each day and for #2 I want Seurity Price for each day.

    – sunny_dev
    Nov 16 '18 at 9:47

















  • How is quantity determined? Do you need a historical record or just the current state? (1) is only a problem if you need the history, and (2) is stated as a fact, not a problem. In what way is your current model failing you?

    – Tezra
    Nov 15 '18 at 21:32











  • Hi @Tezra. Ofcourse as the title of this Question suggests, this is a Time based or History based data modelling problem. And yes I updated #2 so that it clearly states that both #1 and #2 requires storing History information for each Day i.e. in #1 I want Quatity information for each day and for #2 I want Seurity Price for each day.

    – sunny_dev
    Nov 16 '18 at 9:47
















How is quantity determined? Do you need a historical record or just the current state? (1) is only a problem if you need the history, and (2) is stated as a fact, not a problem. In what way is your current model failing you?

– Tezra
Nov 15 '18 at 21:32





How is quantity determined? Do you need a historical record or just the current state? (1) is only a problem if you need the history, and (2) is stated as a fact, not a problem. In what way is your current model failing you?

– Tezra
Nov 15 '18 at 21:32













Hi @Tezra. Ofcourse as the title of this Question suggests, this is a Time based or History based data modelling problem. And yes I updated #2 so that it clearly states that both #1 and #2 requires storing History information for each Day i.e. in #1 I want Quatity information for each day and for #2 I want Seurity Price for each day.

– sunny_dev
Nov 16 '18 at 9:47





Hi @Tezra. Ofcourse as the title of this Question suggests, this is a Time based or History based data modelling problem. And yes I updated #2 so that it clearly states that both #1 and #2 requires storing History information for each Day i.e. in #1 I want Quatity information for each day and for #2 I want Seurity Price for each day.

– sunny_dev
Nov 16 '18 at 9:47












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294438%2fneo4j-graph-db-how-to-do-time-based-datamodelling-for-user-securityholdings-re%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53294438%2fneo4j-graph-db-how-to-do-time-based-datamodelling-for-user-securityholdings-re%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kleinkühnau

Makov (Slowakei)

Deutsches Schauspielhaus