Interface Style

  • All Superinterfaces:
    Serializable, XMLizable
    All Known Implementing Classes:
    Style_impl

    public interface Style
    extends XMLizable, Serializable
    An indexing style. A set of indexing styles make up a IndexRule, which is then applied to an IndexBuildItem in order to assign indexing behavior to an annotation type.

    We support an open-ended schema for styles. Each style has a name and zero or more getAttributes(), where each attribute has a name and a value. Any given indexer implementation can declare which styles it implements, and which attributes it supports. An indexer should gracefully handle unknown styles or attributes and report them in an appropriate manner.

    The following styles and attributes are currently defined:

    • Term - the span of this annotation indicates a single token.
      • lemma - the value of this optional attribute is the name of the feature whose value should be taken as the token to index. If not specified, the covered text of the annotation will be indexed.
    • Breaking - the indexer should record a sentence boundary before and after the span of this annotation.
      • no attributes defined
    • Annotation - this annotation should be recorded in the index as a span that can be queried by the user.
      • fixedName - the value of this optional attribute is the name to assign to the span in the index. If neither this nor nameFeature is specified, the annotation's exact type name, without namespace, will be indexed.
      • nameFeature - the value of this optional attribute is the name to a feature whose value will be used as the name of the span in the index. If neither this nor fixedName is specified, the annotation's exact type name, without namespace, will be indexed. It is an error to give values for both nameFeature and fixedName.
      An annotation style can also have attribute mappings, which specify which how the features (properties) of the annotation should be indexed.
    This object implements the XMLizable interface and can be parsed from an XML representation.
    • Method Detail

      • getName

        String getName()
        Gets the name of this style. See the class comment for a list of defined style names. Implementations must make sure that all names are String.intern()ed so that they can be compared with the == operator.
        Returns:
        the name of this style
      • setName

        void setName​(String aName)
        Sets the name of this style. See the class comment for a list of defined style names. Implementations must make sure that all names are String.intern()ed so that they can be compared with the == operator.
        Parameters:
        aName - the name of this style
      • getAttributes

        Attribute[] getAttributes()
        Gets the Attributes for this style. See the class comment for a list of defined attributes for each style name.
        Returns:
        the attributes for this style.
      • setAttributes

        void setAttributes​(Attribute[] aAttributes)
        Sets the Attributes for this style. See the class comment for a list of defined attributes for each style name.
        Parameters:
        aAttributes - the attributes for this style.
      • getAttribute

        String getAttribute​(String aName)
        Gets the value of an attribute with the given name.
        Parameters:
        aName - name of an attribute
        Returns:
        the value of the named attribute, null if there is no such attribute declared on this style
      • getAttributeMappings

        Mapping[] getAttributeMappings()
        Gets the mappings that specify which features (properties) of the annotation should be indexed, and under which names.
        Returns:
        an array of objects that each specify a mapping from a CAS feature name to the name under which this feature should be recorded in the index.
      • setAttributeMappings

        void setAttributeMappings​(Mapping[] aMappings)
        Sets the mappings that specify which features (properties) of the annotation should be indexed, and under which names.
        Parameters:
        aMappings - an array of objects that each specify a mapping from a CAS feature name to the name under which this feature should be recorded in the index.