/// <summary>
 /// Creates a new instance of an APConnection object between two existing APObjects.
 /// </summary>
 /// <param name="type">The name of the relation for which to create a new connection.</param>
 /// <param name="labelA">Label for the first endpoint in the connection.</param>
 /// <param name="objectIdA">Id of the existing object corresponding to the first endpoint in the connection.</param>
 /// <param name="labelB">Label for the second endpoint in the connection.</param>
 /// <param name="objectIdB">Id of the existing object corresponding to the second endpoint in the connection.</param>
 public APConnection(string type, string labelA, string objectIdA, string labelB, string objectIdB) 
     : base(type)
 {
     var ep1 = new Endpoint(labelA, objectIdA);
     var ep2 = new Endpoint(labelB, objectIdB);
     this.Endpoints = new EndpointPair(ep1, ep2);
 }
 /// <summary>
 /// Creates a new instance of an APConnection object between a new and an existing APObject instance.
 /// </summary>
 /// <param name="type">The name of the relation for which to create a new connection.</param>
 /// <param name="labelA">Label for the first endpoint in the connection.</param>
 /// <param name="objectA">The instance of the new object corresponding to the first endpoint in the connection.</param>
 /// <param name="labelB">Label for the second endpoint in the connection.</param>
 /// <param name="objectIdB">Id of the existing object corresponding to the second endpoint in the connection.</param>
 public APConnection(string type, string labelA, APObject objectA, string labelB, string objectIdB)
     : base(type)
 {
     Endpoint ep1, ep2;
     if (objectA.IsNewInstance == false)
     {
         ep1 = new Endpoint(labelA, objectA.Id);
         ep2 = new Endpoint(labelB, objectIdB);
     }
     else
     {
         string nullId = null;
         ep1 = new Endpoint(labelA, nullId);
         ep2 = new Endpoint(labelB, objectIdB);
         ep1.Content = objectA;
     }
     this.Endpoints = new EndpointPair(ep1, ep2);
 }
        /// <summary>
        /// Creates a new instance of an APConnection object between two new APObject instances.
        /// </summary>
        /// <param name="type">The name of the relation for which to create a new connection.</param>
        /// <param name="labelA">Label for the first endpoint in the connection.</param>
        /// <param name="objectA">The instance of the new object corresponding to the first endpoint in the connection.</param>
        /// <param name="labelB">Label for the second endpoint in the connection.</param>
        /// <param name="objectB">The instance of the new object corresponding to the second endpoint in the connection.</param>
        public APConnection(string type, string labelA, APObject objectA, string labelB, APObject objectB)
            : base(type)
        {
            Endpoint ep1, ep2;
            string nullId = null;
            if (objectA.IsNewInstance == true)
            {
                ep1 = new Endpoint(labelA, nullId);
                ep1.Content = objectA;
            }
            else
                ep1 = new Endpoint(labelA, objectA.Id);

            if (objectB.IsNewInstance == true)
            {   
                ep2 = new Endpoint(labelB, nullId);
                ep2.Content = objectB;
            }
            else
                ep2 = new Endpoint(labelB, objectB.Id);

            this.Endpoints = new EndpointPair(ep1, ep2);
        }
 /// <summary>
 /// Creates a new EndpointPair with the given endpoints.
 /// </summary>
 /// <param name="ep1">Endpoint 1</param>
 /// <param name="ep2">Endpoint 2</param>
 public EndpointPair(Endpoint ep1, Endpoint ep2)
 {
     this.EndpointA = ep1;
     this.EndpointB = ep2;
 }
 public Connection(string type, string labelA, Article articleA, string labelB, string ArticleIdB)
     : base(type)
 {
     Endpoint ep1, ep2;
     if (articleA.IsNewInstance == false)
     {
         ep1 = new Endpoint(labelA, articleA.Id);
         ep2 = new Endpoint(labelB, ArticleIdB);
     }
     else
     {
         string nullId = null;
         ep1 = new Endpoint(labelA, nullId);
         ep2 = new Endpoint(labelB, ArticleIdB);
         ep1.Content = articleA;
     }
     this.Endpoints = new EndpointPair(ep1, ep2);
 }
 public Connection(string type, string labelA, string articleIdA, string labelB, string ArticleIdB) 
     : base(type)
 {
     var ep1 = new Endpoint(labelA, articleIdA);
     var ep2 = new Endpoint(labelB, ArticleIdB);
     this.Endpoints = new EndpointPair(ep1, ep2);
 }
        public Connection(string type, string labelA, Article articleA, string labelB, Article articleB)
            : base(type)
        {
            Endpoint ep1, ep2;
            string nullId = null;
            if (articleA.IsNewInstance == true)
            {
                ep1 = new Endpoint(labelA, nullId);
                ep1.Content = articleA;
            }
            else
                ep1 = new Endpoint(labelA, articleA.Id);

            if (articleB.IsNewInstance == true)
            {   
                ep2 = new Endpoint(labelB, nullId);
                ep2.Content = articleB;
            }
            else
                ep2 = new Endpoint(labelB, articleB.Id);

            this.Endpoints = new EndpointPair(ep1, ep2);
        }