wiki:cypher_queries

Cypher examples for use in Neo4j Browser

1) List of all titles for an author. This should include variant versions for a title.

MATCH (texts:TEXT)-[was_created_by]->(author:PERSON)
WHERE author.name_translit = "Šihāb al-Dīn Abū al-ʿAbbās Aḥmad ibn Rajab ibn Ṭaybuġā al-Majdī al-Šāfiʿī"
RETURN author, texts

2) List of all witnesses for a title (the list should distinguish which witnesses go with a particular title version)

MATCH (witnesses:WITNESS)-[is_part_of]->(title:TEXT)
WHERE title.label = "Risāla fī al-barāhīn ʿalā masāʾil al-jabr wa-ʾl-muqābala"
RETURN title, witnesses

3) List of all commentaries and super-commentaries on a given title

MATCH (texts:TEXT)-[rel:is_commentary_on*]->(primary:TEXT)
WHERE primary.label = "Kitāb al-Išārāt wa-ʾl-tanbīhāt"
RETURN primary, texts

  • Graph of all commentaries of all texts
    match (t1:TEXT)-[r:is_commentary_on]->(t2:TEXT) return t1,r,t2
    
  • Graph of all commentaries of all texts and their authors
    MATCH (p1:PERSON)<-[r1:was_created_by]-(t1:TEXT)-[r2:is_commentary_on*]->(t2:TEXT)-[r3:was_created_by]->(p2:PERSON)
    RETURN p1,r1,t1,r2,t2,r3,p2
    

4) List of all authors who wrote in connection with a particular title (commentaries, super-commentaries)

MATCH (authors:PERSON)<-[was_created_by]-(commentaries:TEXT)-[rel:is_commentary_on*]->(primary:TEXT)
WHERE primary.label = "Kitāb al-Išārāt wa-ʾl-tanbīhāt" 
RETURN primary, commentaries, authors

5) List of all people who had other “roles” associated with a title (e.g. copyists , owners, patrons, teachers, students, etc.)

  • currently no specialised interface (PERSON -*- TITLE)

6) Bring up people associated with a particular title (not just one huge list of people, but be able to distinguish author, student, teacher)

  • see 5)?

7) Bring up people associated with a particular witness (not just one huge list of people, but be able to distinguish owner, say, from commentator)

  • currently no specialised interface (PERSON -*- WITNESS)

8) Bring up all the works dedicated to a particular “patron” (e.g., Ulugh Beg)

  • possible with OpenMind?, Drupal and Popoto (TEXT was-dedicated-to PERSON)

9) Bring up all owners of a particular codex

  • possible with OpenMind?, Drupal and Popoto (PERSON <was-owned-by CODEX)

10) Bring up all codices owned by a single person

  • possible with OpenMind?, Drupal and Popoto (CODEX was-owned-by PERSON)

11) Create a Table of contents for a particular codex

  • list of witnesses possible with OpenMind?, Drupal and Popoto (WITNESS part-of CODEX)

12) Bring up all works studied in a madrasa (institution event)

13) Search for specific words in incipits, explicits and colophons

  • full text search necessary

14) Find copying dates in a certain range

More Cypher queries

  • texts sorted by number of commentaries
    • match (c:TEXT)-[r:is_commentary_on]->(t:TEXT) return count(c), t.ismi_id order by count(c) desc
  • distribution of number of commentaries of texts
    • match (c:TEXT)-[r:is_commentary_on]->(t:TEXT) with count(c) as rels, t.ismi_id as iid return count(rels), rels order by rels asc
  • graph of all commentaries and higher-level commentaries of the Mulakhas [161559]
    • match (t:TEXT)-[r:is_commentary_on]->(t2:TEXT) where (t)-[:is_commentary_on*]->({ismi_id:161559}) return t,r,t2
Last modified 7 years ago Last modified on Sep 21, 2017, 5:06:32 PM