Class JCasFactory

java.lang.Object
org.apache.uima.fit.factory.JCasFactory

public final class JCasFactory extends Object
Convenience methods to create JCas objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.uima.jcas.JCas
    Creates a new JCas.
    static org.apache.uima.jcas.JCas
    createJCas(String... typeSystemDescriptorNames)
    Creates a new JCas from type system descriptor files found by name.
    static org.apache.uima.jcas.JCas
    createJCas(String fileName, org.apache.uima.resource.metadata.TypeSystemDescription typeSystemDescription)
    This method creates a new JCas and loads the contents of an XMI or XCAS file into it.
    static org.apache.uima.jcas.JCas
    createJCas(org.apache.uima.resource.metadata.TypeSystemDescription typeSystemDescription)
    Create a new JCas for the given type system description.
    static org.apache.uima.jcas.JCas
    createJCasFromPath(String... typeSystemDescriptorPaths)
    Creates a new JCas from type system descriptor files.
    static org.apache.uima.jcas.JCas
    Creates a new JCas with the given text.
    static org.apache.uima.jcas.JCas
    createText(String aText, String aLanguage)
    Creates a new JCas with the given text and language.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • createText

      public static org.apache.uima.jcas.JCas createText(String aText) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException
      Creates a new JCas with the given text. The type system is detected automatically using TypeSystemDescriptionFactory.createTypeSystemDescription(). Type priorities are detected automatically using TypePrioritiesFactory.createTypePriorities(). Indexes are detected automatically using FsIndexFactory.createFsIndexCollection().
      Parameters:
      aText - the document text to be set in the new JCas.
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
    • createText

      public static org.apache.uima.jcas.JCas createText(String aText, String aLanguage) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException
      Creates a new JCas with the given text and language. The type system is detected automatically using TypeSystemDescriptionFactory.createTypeSystemDescription(). Type priorities are detected automatically using TypePrioritiesFactory.createTypePriorities(). Indexes are detected automatically using FsIndexFactory.createFsIndexCollection().
      Parameters:
      aText - the document text to be set in the new JCas.
      aLanguage - the document language to be set in the new JCas.
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
    • createJCas

      public static org.apache.uima.jcas.JCas createJCas() throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException
      Creates a new JCas. The type system is detected automatically using TypeSystemDescriptionFactory.createTypeSystemDescription(). Type priorities are detected automatically using TypePrioritiesFactory.createTypePriorities(). Indexes are detected automatically using FsIndexFactory.createFsIndexCollection().
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
    • createJCas

      public static org.apache.uima.jcas.JCas createJCas(String... typeSystemDescriptorNames) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException
      Creates a new JCas from type system descriptor files found by name. No auto-detection for type priorities, or indexes is performed.
      Parameters:
      typeSystemDescriptorNames - names of the type system descriptors on the classpath used to initialize the JCas (in Java notation, e.g. "my.package.TypeSystem" without the ".xml" extension)
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
    • createJCasFromPath

      public static org.apache.uima.jcas.JCas createJCasFromPath(String... typeSystemDescriptorPaths) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException
      Creates a new JCas from type system descriptor files. No auto-detection for type priorities, or indexes is performed.
      Parameters:
      typeSystemDescriptorPaths - paths to type system descriptor files
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
    • createJCas

      public static org.apache.uima.jcas.JCas createJCas(org.apache.uima.resource.metadata.TypeSystemDescription typeSystemDescription) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException
      Create a new JCas for the given type system description. No auto-detection type priorities, or indexes is performed.
      Parameters:
      typeSystemDescription - a type system description to initialize the JCas
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
    • createJCas

      public static org.apache.uima.jcas.JCas createJCas(String fileName, org.apache.uima.resource.metadata.TypeSystemDescription typeSystemDescription) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.cas.CASException, IOException
      This method creates a new JCas and loads the contents of an XMI or XCAS file into it.
      Parameters:
      fileName - a file name for the serialized CAS data
      typeSystemDescription - a type system description to initialize the JCas
      Returns:
      a new JCas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if the CAS could not be initialized
      org.apache.uima.cas.CASException - if the JCas could not be initialized
      IOException - if there is a problem reading the file