Skip to content
This repository has been archived by the owner on Mar 3, 2019. It is now read-only.

Vanhempien löytyminen Cypher-lauseella #1

Open
PeterJPower opened this issue Oct 31, 2014 · 0 comments
Open

Vanhempien löytyminen Cypher-lauseella #1

PeterJPower opened this issue Oct 31, 2014 · 0 comments

Comments

@PeterJPower
Copy link

Oletaan perustetuksi lapsen syntymätapahtuma ja siihen liitetyt henkilöt, rooleineen:

MERGE (I127:Person { id: 'I127', name: 'Johan Johanpoika /Sihvola/', gender: 'M' });
MERGE (I149:Person { id: 'I149', name: 'Johan Johanpoika /Sihvola/', gender: 'M' });
MERGE (I150:Person { id: 'I150', name: 'Maria/Matintytär/', gender: 'F' });
MERGE (E798:Event { id: 'E394', type: 'Birth', date: '1783-04-26' });
MATCH (p:Person { id:'I127' }),(e:Event { id:'E394' })
MERGE (p)-[R215:Birth{role: 'child'}]->(e);
MATCH (p:Person { id:'I149' }),(e:Event { id:'E394' })
MERGE (p)-[R216:Birth{role: 'father'}]->(e);
MATCH (p:Person { id:'I150' }),(e:Event { id:'E394' })
MERGE (p)-[R215:Birth{role: 'mother'}]->(e);

niin ymmärtääkseni v. 1783 syntyneen Johanin vanhemmat löytyvät Cypher-lauseella

MATCH (p:Person) -[b:Event]->() <--[b:Event]-(v:Person);
WHERE p.id= "I127", b.type="Birth" , b:role="child";
RETURN v;

ja hänen isovanhempansa lauseella

MATCH (p:Person) -[b:Event_2]->() <--[b:Event_2]-(v:Person);
WHERE p.id= "I127", b.type="Birth" , b:role="child";
RETURN v;

Testaamalla saa varmistuksen, onko edellä esitetty oikein :-)

@jpek-m jpek-m assigned jorma-h and unassigned jorma-h Nov 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants