Beispiel #1
0
        public bool MergeRelationship(
            string uuidFrom,
            string uuidTo,
            RelationshipAttribute relationshipAttribute)
        {
            if (string.IsNullOrWhiteSpace(uuidFrom))
            {
                throw new ArgumentNullException("uuidFrom");
            }

            if (string.IsNullOrWhiteSpace(uuidTo))
            {
                throw new ArgumentNullException("uuidTo");
            }

            if (relationshipAttribute == null)
            {
                throw new ArgumentNullException("relationshipAttribute");
            }

            var query = new StringFormatter(QueryTemplates.TEMPLATE_MERGE_RELATIONSHIP);

            query.Add("@uuidFrom", uuidFrom);
            query.Add("@uuidTo", uuidTo);
            query.Add("@fromPartDirection", relationshipAttribute.Direction == DIRECTION.INCOMING ? "<-" : "-");
            query.Add("@toPartDirection", relationshipAttribute.Direction == DIRECTION.INCOMING ? "-" : "->");
            query.Add("@relationshipName", relationshipAttribute.Name);

            IStatementResult result = ExecuteQuery(query.ToString());

            return(result.Any());
        }