Class CasSerializerSupport

java.lang.Object
org.apache.uima.cas.impl.CasSerializerSupport

public class CasSerializerSupport extends Object
CAS serializer support for XMI and JSON formats. There are multiple use cases. 1) normal - the consumer is independent of UIMA - (maybe) support for delta serialization 2) service calls: - support deserialization with out-of-type-system set-aside, and subsequent serialization with re-merging - guarantee of using same xmi:id's as were deserialized when serializing - support for delta serialization There is an outer class (one instance per "configuration" - reusable after configuration, and an inner class - one per serialize call. These classes are the common parts of serialization between XMI and JSON, mainly having to do with 1) enquuing the FS to be serialized 2) serializing according to their types and features Methods marked public are not for public use but are that way to permit other users of this class in other packages to "see" these methods. XmiCasSerializer JsonCasSerializer Instance Instance css ref -------> CasSerializerSupport <------ css ref XmiDocSerializer JsonDocSerializer Instance Instance (1 per serialize action) (1 per serialize action) cds ref -------> CasDocSerializer <------- cds ref csss points back Construction: new Xmi/JsonCasSerializer initializes css with new CasSerializerSupport serialize method creates a new Xmi/JsonDocSerializer inner class constructor creates a new CasDocSerializer, Use Cases and Algorithms Support set-aside for out-of-type-system FS on deserialization (record in shareData) implies can't determine sharing status of things ref'd by features; need to depend on multiple-refs-allowed flag. If multiple-refs found during serialization for feat marked non-shared, unshare these (make 2 serializations, one or more inplace, for example. Perhaps not considered an error. implies need (for non-delta case) to send all FSs that were deserialized - some may be ref'd by oots elements ** Could ** not do this if no oots elements, but could break some assumptions and this only would apply to non-delta - not worth doing
  • Field Details

    • TYPE_CLASS_INTLIST

      public static final int TYPE_CLASS_INTLIST
      See Also:
    • TYPE_CLASS_FLOATLIST

      public static final int TYPE_CLASS_FLOATLIST
      See Also:
    • TYPE_CLASS_STRINGLIST

      public static final int TYPE_CLASS_STRINGLIST
      See Also:
    • TYPE_CLASS_FSLIST

      public static final int TYPE_CLASS_FSLIST
      See Also:
    • PP_LINE_LENGTH

      public static int PP_LINE_LENGTH
    • PP_ELEMENTS

      public static int PP_ELEMENTS
    • errorCount

      public static AtomicInteger errorCount
    • COMPARATOR_SHORT_TYPENAME

      static final Comparator<TypeImpl> COMPARATOR_SHORT_TYPENAME
    • filterTypeSystem

      TypeSystemImpl filterTypeSystem
    • errorHandler

      ErrorHandler errorHandler
    • logger

      Logger logger
    • isFormattedOutput

      public boolean isFormattedOutput
  • Constructor Details

    • CasSerializerSupport

      public CasSerializerSupport()
      C O N S T R U C T O R S *
  • Method Details

    • setPrettyPrint

      public CasSerializerSupport setPrettyPrint(boolean pp)
      set or reset the pretty print flag (default is false)
      Parameters:
      pp - true to do pretty printing of output
      Returns:
      the original instance, possibly updated
    • setFilterTypes

      public CasSerializerSupport setFilterTypes(TypeSystemImpl ts)
      pass in a type system to use for filtering what gets serialized; only those types and features which are defined this type system are included.
      Parameters:
      ts - the filter
      Returns:
      the original instance, possibly updated
    • getFilterTypes

      public TypeSystemImpl getFilterTypes()
    • setErrorHandler

      public CasSerializerSupport setErrorHandler(ErrorHandler eh)
      set an error handler to receive information about errors
      Parameters:
      eh - the error handler
      Returns:
      the original instance, possibly updated