Skip to main content Skip to complementary content

Creating actor-movie relationship in Neo4j

Procedure

  1. Double-click the third tFileInputDelimited component to open its Basic settings view on the Component tab.
  2. In the File name/Stream field, specify the path to the CSV file that describes the actors' roles in the movies.
    The input CSV file used in this example is as follows:
    Actor;Movie;Role
    Keanu Reeves;The Matrix;Neo
    Keanu Reeves;The Matrix Reloaded;Neo
    Keanu Reeves;The Matrix Revolutions;Neo
    Laurence Fishburne;The Matrix;Morpheus
    Laurence Fishburne;The Matrix Reloaded;Morpheus
    Laurence Fishburne;The Matrix Revolutions;Morpheus
    Carrie-Anne Moss;The Matrix;Trinity
    Carrie-Anne Moss;The Matrix Reloaded;Trinity
    Carrie-Anne Moss;The Matrix Revolutions;Trinity
  3. In the Header field, specify the number of rows to skip as header rows. In this example, the first row of the CSV file is the header row.
  4. Click the [...] button next to Edit schema to open the Schema dialog box, and define the input schema based on the structure of the input file. In this example, the input schema is composed of three columns, actor, movie, and role, all of type String.
    When done, click OK to close the Schema dialog box and propagate the schema to the next component.
  5. Double-click the tNeo4jOutputRelationship component to open its Basic settings view.
  6. Select the Use an existing connection check box to reuse the Neo4j database connection opened by the tNeo4jConnection component, which is the only connection component used in this example.
  7. In the Relationship type field, enter the type of relationship to be created, between double quotation marks. In this example, the relationship type is ACTED_IN, which will appear as the label of the relationship between nodes.
  8. Define the start and end nodes and the direction of the relationship to be created. In this example, the relationship will be created from Actors nodes, on which an index called name has been defined, to Movies nodes, on which an index called title has been defined.
    • Start node: enter name between double quotation marks in the Index name and Index key fields, and select the schema column name from the Index value list. As the Value field is left blank in index creation, the index value will be the value of column name for each row.

    • From the Relationship direction list, select Outgoing.

    • End node: enter title between double quotation marks in the Index name and Index key fields, and select the schema column title from the Index value list. As the Value field is left blank in index creation, the index value will be the value of column title for each row.

  9. Click the [+] button three times to add three rows in the Mapping table to define three properties of the relationship:

    Property

    Value taken from...

    Actor

    actor column of the schema

    Movie

    movie column of the schema

    Role

    role column of the schema

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!