@@ -123,9 +123,16 @@ public class RosetteEntity : IEquatable<RosetteEntity>
123123 /// <summary>
124124 /// Gets or sets the dbpediaType of the extracted entity
125125 /// </summary>
126+ [ Obsolete ( "Use dbPediaTypes instead." ) ]
126127 [ JsonProperty ( "dbpediaType" , NullValueHandling = NullValueHandling . Ignore ) ]
127128 public String DBpediaType { get ; set ; }
128129
130+ /// <summary>
131+ /// Gets or sets the dbpediaTypes of the extracted entity
132+ /// </summary>
133+ [ JsonProperty ( "dbpediaTypes" , NullValueHandling = NullValueHandling . Ignore ) ]
134+ public List < String > DBpediaTypes { get ; set ; }
135+
129136 /// <summary>
130137 /// Gets or sets the offsets of the extracted entity
131138 /// </summary>
@@ -144,6 +151,12 @@ public class RosetteEntity : IEquatable<RosetteEntity>
144151 [ JsonProperty ( "salience" , NullValueHandling = NullValueHandling . Ignore ) ]
145152 public Nullable < double > Salience { get ; set ; }
146153
154+ /// <summary>
155+ /// Gets or sets the permId of the extracted entity
156+ /// </summary>
157+ [ JsonProperty ( "permId" , NullValueHandling = NullValueHandling . Ignore ) ]
158+ public String PermID { get ; set ; }
159+
147160 /// <summary>
148161 /// Creates an entity
149162 /// </summary>
@@ -154,12 +167,14 @@ public class RosetteEntity : IEquatable<RosetteEntity>
154167 /// <param name="count">The number of times this entity appeared in the input to the API</param>
155168 /// <param name="confidence">The confidence of this entity appeared in the input to the API</param>
156169 /// <param name="dbpediaType">The DBpedia type of the entity</param>
170+ /// <param name="dbpediaTypes">A list of DBpedia types of the entitiy</param>
157171 /// <param name="mentionOffsets">The mention offsets of the entity</param>
158172 /// <param name="linkingConfidence">The linking confidence of the entity</param>
159173 /// <param name="salience">The salience of the entity</param>
174+ /// <param name="permId">The Thomson Reuters Permanent Identifier of the entity</param>
160175 public RosetteEntity ( string mention , string normalizedMention , EntityID id , string entityType , int ? count ,
161- double ? confidence , string dbpediaType , List < MentionOffset > mentionOffsets , double ? linkingConfidence ,
162- double ? salience )
176+ double ? confidence , string dbpediaType , List < String > dbpediaTypes , List < MentionOffset > mentionOffsets ,
177+ double ? linkingConfidence , double ? salience , string permId )
163178 {
164179 this . Mention = mention ;
165180 this . NormalizedMention = normalizedMention ;
@@ -168,9 +183,25 @@ public RosetteEntity(string mention, string normalizedMention, EntityID id, stri
168183 this . EntityType = entityType ;
169184 this . Confidence = confidence ;
170185 this . DBpediaType = dbpediaType ;
186+ this . DBpediaTypes = dbpediaTypes ;
171187 this . MentionOffsets = mentionOffsets ;
172188 this . LinkingConfidence = linkingConfidence ;
173189 this . Salience = salience ;
190+ this . PermID = permId ;
191+ }
192+
193+ /// <summary>
194+ /// Method to compare Lists of Strings. SequenceEqual throws an exception
195+ /// if either argument is null.
196+ /// </summary>
197+ /// <param name="list1">List<String></param>
198+ /// <param name="list2">List<String></param>
199+ /// <returns>True if equal or both null</returns>
200+ private bool StringListsAreEqual ( List < String > list1 , List < String > list2 )
201+ {
202+ if ( list1 == null && list2 == null ) { return true ; }
203+ if ( list1 == null || list2 == null ) { return false ; } // only one is null
204+ return list1 . SequenceEqual ( list2 ) ;
174205 }
175206
176207 /// <summary>
@@ -187,9 +218,11 @@ public bool Equals(RosetteEntity other)
187218 && Count == other . Count
188219 && Confidence . Equals ( other . Confidence )
189220 && string . Equals ( DBpediaType , other . DBpediaType )
221+ && StringListsAreEqual ( DBpediaTypes , other . DBpediaTypes )
190222 && MentionOffsets . SequenceEqual ( other . MentionOffsets )
191223 && LinkingConfidence . Equals ( other . LinkingConfidence )
192- && Salience . Equals ( other . Salience ) ;
224+ && Salience . Equals ( other . Salience )
225+ && string . Equals ( PermID , other . PermID ) ;
193226 }
194227
195228 /// <summary>
@@ -220,9 +253,11 @@ public override int GetHashCode()
220253 hashCode = ( hashCode * 397 ) ^ Count . GetHashCode ( ) ;
221254 hashCode = ( hashCode * 397 ) ^ Confidence . GetHashCode ( ) ;
222255 hashCode = ( hashCode * 397 ) ^ ( DBpediaType != null ? DBpediaType . GetHashCode ( ) : 0 ) ;
256+ hashCode = ( hashCode * 397 ) ^ ( DBpediaTypes != null ? DBpediaTypes . GetHashCode ( ) : 0 ) ;
223257 hashCode = ( hashCode * 397 ) ^ ( MentionOffsets != null ? MentionOffsets . GetHashCode ( ) : 0 ) ;
224258 hashCode = ( hashCode * 397 ) ^ ( LinkingConfidence != null ? LinkingConfidence . GetHashCode ( ) : 0 ) ;
225259 hashCode = ( hashCode * 397 ) ^ ( Salience != null ? Salience . GetHashCode ( ) : 0 ) ;
260+ hashCode = ( hashCode * 397 ) ^ ( PermID != null ? PermID . GetHashCode ( ) : 0 ) ;
226261 return hashCode ;
227262 }
228263 }
0 commit comments