Class ResultSpecification_impl

java.lang.Object
org.apache.uima.resource.metadata.impl.MetaDataObject_impl
org.apache.uima.analysis_engine.impl.ResultSpecification_impl
All Implemented Interfaces:
Serializable, Cloneable, ResultSpecification, MetaDataObject, XMLizable

public final class ResultSpecification_impl extends MetaDataObject_impl implements ResultSpecification
Reference implementation of ResultSpecification. Notes on the implementation Result Specifications (result specs, rs) are closely tied to capability specifications. They consist of instances of TypeOrFeatures and associated languages for which they are set. This impl supports removing previously added types and features for particular languages. There are two forms of the data kept: The data as it was provided to set the items in the result spec This form is used when removing previously added things The data after a type system has been provided, expanded to cover the various implied settings, due to either all Features flag on a type or the type/subtype hierarchy in the type system TypesOrFeatures are: typeXXX:FeatureYYY - specifying a particular feature of a type (Corner case: typeXXX:FeatureYYY doesn't imply there's a typeXXX allFeat nor a typeXXX w/o allFeat. typeXXX with allFeatures - a shorthand for specifying typeXXX and typeXXX:FeatureYYY for all features YYY defined for typeXXX (Corner case: excludes features ZZZ defined only in subtype of typeXXX) typeXXX without allFeatures (w/o allFeat) - specifies a type, but says nothing about the features This is specifiable in the XML. It means: The type is produced/needed but there's no information about the features that are to be produced or used containsType typeXXX returns true if typeXXX is in the RS, with or without the allFeats flag returns false if only features involving typeXXX are specified Intersection is done on fully expanded representations. There are two kinds of inheritance used Assuming there's a type system (which must be present when intersection is used), there's type/subtype This means that if a resultSpec is set for typeXXX, then the containsType(typeYYY) returns true if typeYYY is a subtype of typeXXX. This also needs to work for typeXXX:featZZZ; containsFeature(typeYYY:featZZZ) returns true if type YYY is a subtype of typeXXX. Languages have a 3 level hierarchy: x-unspecified - the same as no language being specified. If the resultSpec contains typeXXX for language x-unspecified, containsType(typeXXX, languageLLL) returns true, for any languageLLL a "base" language, without a '-', e.g. "en" a sub-language, with one or more '-', e.g., "en-us" The rules for matching languages only handle these three levels of inheritance. (Corner case: 3 or more level language hierarchy are treated as 3 level hierarchies eg. zh-Hant-HK (Traditional Chinese as used in Hong Kong) See http://www.w3.org/International/articles/language-tags/Overview.en.php ) Design considerations and assumptions Many instances of this class are made, sometimes via cloning. Most uses only use types, not type:features Most don't use languages A small subset of the possible types and type:features is specified explicitly Sometimes types and/or features are deleted. (language capability flow deletes types and/or features) Types and Features are kept on a per-language basis. Language can include a special value, x-unspecified, which "matches" any other language. Set operations among different result specs: Union: done in aggregates over result-specs derived from input capabilities of delegates Intersection: done for primitive components, over result-spec derived from output capability of the primitive remove: one type or feature (used by language capability flow) (Corner cases removing typeXXX doesn't remove typeXXX:featureYYY removing typeXXX allFeat doesn't remove typeXXX w/o allFeat (may have different languages) removing typeXXX w/o allFeat doesn't remove typeXXX allFeat The compiled version is used in containsType, containsFeature testing, and is used when computing intersection.
See Also:
  • Field Details

    • EMPTY_TYPE_LIST

      public static final List<Type> EMPTY_TYPE_LIST
      used for empty type subsumption lists in subtype iterator
  • Constructor Details

    • ResultSpecification_impl

      public ResultSpecification_impl()
    • ResultSpecification_impl

      public ResultSpecification_impl(TypeSystem aTypeSystem)
      Constructor specifying the type system this should always be used in preference to the 0 argument version if the type system is available. Otherwise, the type system *must* be set via a method call prior to querying the result spec, with the one exception of the method getResultTypesAndFeaturesWithoutCompiling
      Parameters:
      aTypeSystem - -
  • Method Details