GraphGists

The Royal families generaly have long histories and are often closely related. This citation from wikipedia can give you better idea:

Maternally, Nicholas was the nephew of several monarchs, including King Frederick VIII of Denmark, Queen Alexandra of the United Kingdom (queen consort of King Edward VII), and King George I of Greece. Nicholas, his wife, Alexandra, and Kaiser Wilhelm II of Germany were all first cousins of King George V of the United Kingdom. Nicholas was also a first cousin of both King Haakon VII and Queen Maud of Norway, as well as King Constantine I of Greece. While not first cousins, Nicholas and Kaiser Wilhelm II were second cousins, once removed, as each descended from King Frederick William III of Prussia, as well as third cousins, as they were both great-great-grandsons of Emperor Paul I of Russia.

The rulers of Great Britain, Germany and Russia at the beginning of World War I were actually cousins!

Model

Simple family relationships may be represented by following model

Model

Sample data

This sample data set is far from complete but it allows to demonstrate the main point. It contains monarch of Great Britain, Sweden, Denmark and Norway in 18th century.

Country relations

How were the countries related through royal families?

START c1=node(*),c2=node(*)
MATCH path =(c1<-[:REIGNED]-r1-[:HAD_DAUGHTER|MARRIED*0..]-r2-[:REIGNED]->c2)
WHERE c1.name="Great Britain" AND c2.name = 'Denmark and Norway'
RETURN path

There are also other posibilities to query.

Successors

This query will get all successors on the throne

start anne=node(*)
match anne<-[:SUCCEEDED*0..]-suc
where anne.name="Anne"
return suc

Predecessor

This retrieves just one predecessor.

start g=node(*)
match g-[:SUCCEEDED]->pre
where g.name="George II"
return pre

Improvements

  • index names for better performance

  • crawl wikipedia (or wikidata) to get comprehensive database