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

Vanhempien löytyminen Cypher-lauseella #1

@PeterJPower

Description

@PeterJPower

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 :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions