/**
         * <summary>Returns true if specified semantic relation type presents in the relations list.</summary>
         *
         * <param name="semanticRelationType">element whose presence in the list is to be tested</param>
         * <returns>true if specified semantic relation type presents in the relations list</returns>
         */
        public bool ContainsRelationType(SemanticRelationType semanticRelationType)
        {
            foreach (var relation in _relations)
            {
                if (relation is SemanticRelation semanticRelation &&
                    semanticRelation.GetRelationType().Equals(semanticRelationType))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        /**
         * <summary>Returns the reverse of a specific semantic relation type.</summary>
         *
         * <param name="semanticRelationType">semantic relation type to be reversed</param>
         * <returns>reversed version of the semantic relation type</returns>
         */
        public static SemanticRelationType Reverse(SemanticRelationType semanticRelationType)
        {
            switch (semanticRelationType)
            {
            case SemanticRelationType.HYPERNYM:
                return(SemanticRelationType.HYPONYM);

            case SemanticRelationType.HYPONYM:
                return(SemanticRelationType.HYPERNYM);

            case SemanticRelationType.ANTONYM:
                return(SemanticRelationType.ANTONYM);

            case SemanticRelationType.INSTANCE_HYPERNYM:
                return(SemanticRelationType.INSTANCE_HYPONYM);

            case SemanticRelationType.INSTANCE_HYPONYM:
                return(SemanticRelationType.INSTANCE_HYPERNYM);

            case SemanticRelationType.MEMBER_HOLONYM:
                return(SemanticRelationType.MEMBER_MERONYM);

            case SemanticRelationType.MEMBER_MERONYM:
                return(SemanticRelationType.MEMBER_HOLONYM);

            case SemanticRelationType.PART_MERONYM:
                return(SemanticRelationType.PART_HOLONYM);

            case SemanticRelationType.PART_HOLONYM:
                return(SemanticRelationType.PART_MERONYM);

            case SemanticRelationType.SUBSTANCE_MERONYM:
                return(SemanticRelationType.SUBSTANCE_HOLONYM);

            case SemanticRelationType.SUBSTANCE_HOLONYM:
                return(SemanticRelationType.SUBSTANCE_MERONYM);

            case SemanticRelationType.DOMAIN_TOPIC:
                return(SemanticRelationType.MEMBER_TOPIC);

            case SemanticRelationType.MEMBER_TOPIC:
                return(SemanticRelationType.DOMAIN_TOPIC);

            case SemanticRelationType.DOMAIN_REGION:
                return(SemanticRelationType.MEMBER_REGION);

            case SemanticRelationType.MEMBER_REGION:
                return(SemanticRelationType.DOMAIN_REGION);

            case SemanticRelationType.DOMAIN_USAGE:
                return(SemanticRelationType.MEMBER_USAGE);

            case SemanticRelationType.MEMBER_USAGE:
                return(SemanticRelationType.DOMAIN_USAGE);

            case SemanticRelationType.DERIVATION_RELATED:
                return(SemanticRelationType.DERIVATION_RELATED);
            }

            return(SemanticRelationType.NONE);
        }
Beispiel #3
0
 /**
  * <summary>Mutator for the semantic relation type.</summary>
  *
  * <param name="relationType">semantic relation type.</param>
  */
 public void SetRelationType(SemanticRelationType relationType)
 {
     this._relationType = relationType;
 }
Beispiel #4
0
 /**
  * <summary>Another constructor that initializes relation type, relation name, and the index.</summary>
  *
  * <param name="name">        name of the relation</param>
  * <param name="relationType">semantic dependency tag</param>
  * <param name="toIndex">     index of the relation</param>
  */
 public SemanticRelation(string name, SemanticRelationType relationType, int toIndex) : base(name)
 {
     this._relationType = relationType;
     this._toIndex      = toIndex;
 }
Beispiel #5
0
 /**
  * <summary>Another constructor that initializes relation type and relation name.</summary>
  *
  * <param name="name">        name of the relation</param>
  * <param name="relationType">semantic dependency tag</param>
  */
 public SemanticRelation(string name, SemanticRelationType relationType) : base(name)
 {
     this._relationType = relationType;
 }
Beispiel #6
0
 /**
  * <summary>Another constructor that initializes relation type, relation name, and the index.</summary>
  *
  * <param name="name">        name of the relation</param>
  * <param name="relationType">string semantic dependency tag</param>
  * <param name="toIndex">     index of the relation</param>
  */
 public SemanticRelation(string name, string relationType, int toIndex) : base(name)
 {
     this._relationType = GetSemanticTag(relationType);
     this._toIndex      = toIndex;
 }
Beispiel #7
0
 /**
  * <summary>A constructor to initialize relation type and the relation name.</summary>
  *
  * <param name="name">        name of the relation</param>
  * <param name="relationType">string semantic dependency tag</param>
  */
 public SemanticRelation(string name, string relationType) : base(name)
 {
     this._relationType = GetSemanticTag(relationType);
 }