GateNLP / gate-core

The GATE Embedded core API and GATE Developer application
GNU Lesser General Public License v3.0
76 stars 29 forks source link

should the default annotation set have a name? #18

Closed greenwoodma closed 7 years ago

greenwoodma commented 7 years ago

Currently a call to getName() on the default set returns null. Unfortunately it also returns null in any case where an annotation set isn't tied directly to a document (i.e. if you ask an annotation set for a subset). This means from code it is impossible to tell these sets apart. It also causes problems if the name of the default set is stored in a FeatureMap as this causes an issue when saving as JSON.

The obvious solution would be to give the default set a name. As currently a call to getAnnotations(String) passing either null or the empty string returns the default set, then setting the name of the default set to the empty string seems to make the most sense.

johann-petrak commented 7 years ago

I would be strongly in favour of getting rid of null by all means. Ideally the default set would have a non-empty name, but that may not be feasible without a lot of design changes and backwards compatibility issues. So I agree, maybe it is possible to at least replace null with the empty string? getAnnotations(String) could still accept null for backwards compatibility, but all methods that return the name should return the empty string instead.

greenwoodma commented 7 years ago

From an admittedly very quick test, the only thing I can see that returning the empty string as the name of the default set breaks is the coreference editor.

ianroberts commented 7 years ago

getAnnotations(String) could still accept null for backwards compatibility

It does - both getAnnotations(null) and getAnnotations("") already return the default set.