public void DeleteRelation(int relationID)
    {
        BLORelation r;

        r = BLORelation.Edit(relationID);
        r.Delete();
    }
    public void EditRelation(int relationID, string relationName)
    {
        BLORelation r;

        r      = BLORelation.Edit(relationID);
        r.Name = relationName;
        r.Submit();
    }
    public string GetRelationWords(int relationID)
    {
        StringBuilder sb;
        BLORelation   r;

        sb = new StringBuilder();
        r  = BLORelation.Edit(relationID);
        sb.Append("<RelationWords>\r\n");
        foreach (BLORelation.WordsPair wordsPair in r.WordsPairs)
        {
            sb.Append(" <WordsPair>\r\n");
            sb.AppendFormat("  <Word1>{0}</Word1>\r\n", wordsPair.Word1);
            sb.AppendFormat("  <Word2>{0}</Word2>\r\n", wordsPair.Word2);
            sb.Append(" </WordsPair>\r\n");
        }
        sb.Append("</RelationWords>");
        return(sb.ToString());
    }
    public void SetRelationWords(int relationID, string value)
    {
        StringBuilder sb;
        BLORelation   r;

        string[] parts;

        sb = new StringBuilder();
        r  = BLORelation.Edit(relationID);
        r.WordsPairs.Clear();
        foreach (string s in value.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
        {
            parts = s.Split(new string[] { "+" }, StringSplitOptions.RemoveEmptyEntries);
            if (parts.Length == 2)
            {
                r.WordsPairs.Add(new BLORelation.WordsPair(parts[0], parts[1]));
            }
        }
        r.Submit();
    }
    public string GetRelationPairedWords(int relationID, string word)
    {
        StringBuilder sb;
        BLORelation   r;

        sb = new StringBuilder();
        r  = BLORelation.Edit(relationID);
        sb.Append("<PairedWords>\r\n");
        foreach (BLORelation.WordsPair wordsPair in r.WordsPairs)
        {
            if (wordsPair.Word1 == word)
            {
                sb.AppendFormat(" <Word>{0}</Word>\r\n", wordsPair.Word2);
            }
            if (wordsPair.Word2 == word)
            {
                sb.AppendFormat(" <Word>{0}</Word>\r\n", wordsPair.Word1);
            }
        }
        sb.Append("</PairedWords>");
        return(sb.ToString());
    }