Esempio n. 1
0
        /// <summary>
        /// Generates the relationship string for the relationship object.
        /// </summary>
        /// <returns>The Cypher string representing the relationship object</returns>
        public string GetCypherRelationshipString()
        {
            SourceId = SourceId.Split(':')[1];
            TargetId = TargetId.Split(':')[1];

            string rolesPropertyString = "{roles:" + CypherQueryUtils.GetCypherStringArray(Roles) + "}";

            return($"({SourceId})-[:{CypherQueryUtils.GetCypherRelationshipType(Type)} {rolesPropertyString}]-({TargetId})");
        }
Esempio n. 2
0
        /// <summary>
        /// Generates the full query string for the data file and executes it.
        /// </summary>
        public void RunMergeQuery()
        {
            // Get the merge queries for the data file
            string mediaStatements        = CypherQueryUtils.CreateMergeQuery(dataObject.GetMediaCypherStrings());
            string peopleStatements       = CypherQueryUtils.CreateMergeQuery(dataObject.GetPeopleCypherStrings());
            string companyStatements      = CypherQueryUtils.CreateMergeQuery(dataObject.GetCompaniesCypherStrings());
            string relationshipStatements = CypherQueryUtils.CreateMergeQuery(dataObject.GetRelationshipStrings());
            string fullQuery = $"{mediaStatements}{peopleStatements}{companyStatements}{relationshipStatements}";

            Console.WriteLine($"Full Query:\n{fullQuery}");
            Console.WriteLine("Executing query...");
            IStatementResult result = CypherQueryUtils.ExecuteQuery(fullQuery);

            Console.WriteLine("Query execution complete!");
        }
Esempio n. 3
0
 /// <summary>
 /// Generates the Cypher property string for the MediaNode.
 /// </summary>
 /// <returns>The Cypher property string for the MediaNode</returns>
 public override string GetCypherPropertyString()
 {
     // Get the base string
     return($"{base.GetCypherPropertyString()}, releaseDate:\"{ReleaseDate.ToShortDateString()}\", franchise:\"{Franchise}\", genres:{CypherQueryUtils.GetCypherStringArray(Genres)}");
 }
Esempio n. 4
0
 /// <summary>
 /// Generates and returns the Cyper property string for the base
 /// node. The returned string is not formated with brackets '{'.
 /// </summary>
 /// <returns>A string representing the properties of the node
 /// for use in cypher queries</returns>
 public virtual string GetCypherPropertyString()
 {
     return($"names:{CypherQueryUtils.GetCypherStringArray(Names)}");
 }