Class AnnotationTableManager


  • public class AnnotationTableManager
    extends Object
    • Constructor Detail

      • AnnotationTableManager

        public AnnotationTableManager​(de.julielab.costosys.dbconnection.DataBaseConnector dbc,
                                      String rawDocumentTableName,
                                      List<String> qualifiedAnnotationsToStore,
                                      boolean binaryAnnotationColumns,
                                      String documentTableSchema,
                                      Boolean storeAll,
                                      Boolean storeBaseDocument,
                                      String defaultAnnotationQualifier,
                                      String xmiMetaSchema)
                               throws de.julielab.costosys.dbconnection.util.TableSchemaMismatchException
        Throws:
        de.julielab.costosys.dbconnection.util.TableSchemaMismatchException
    • Method Detail

      • convertQualifiedAnnotationTypeToColumnName

        public static String convertQualifiedAnnotationTypeToColumnName​(String qualifiedAnnotationName,
                                                                        String defaultAnnotationColumnQualifier)

        Converts potentially qualified annotation types to Postgres-valid column names.

        Examples:

        de.julielab.jcore.types.Token -> de_julielab_types_token
        experiments:de.julielab.jcore.types.Gene -> experiments$de_julielab_jcore_types_gene

        Note that this method cannot handle the case where the annotation name was originally qualified but now only the unqualified name is passed. In this case, the default qualifier will be added even if the name was meant to have another specific qualifier in the UIMA descriptor. Use convertUnqualifiedAnnotationTypetoColumnName(String, boolean) for such cases.

        Parameters:
        qualifiedAnnotationName - The annotation name to convert, optionally with a qualification prefix.
        defaultAnnotationColumnQualifier -
        Returns:
        The Postgres compatible column name for this annotation name.
        See Also:
        convertUnqualifiedAnnotationTypetoColumnName(String, boolean)
      • convertUnqualifiedAnnotationTypetoColumnName

        public String convertUnqualifiedAnnotationTypetoColumnName​(String typeName,
                                                                   boolean storeAll)

        Normalizes type name by replacing dots "." with underscores "_" and prepending the default annotation qualifier prefix ONLY IF the option storeAll is set to FALSE. If storeAll is true, the table name is returned unchanged.

        This method also works when the typeName is unqualified but was given qualified to the constructor of this class.

        Parameters:
        typeName - the table name to normalize
        storeAll - whether or not the complete document XMI is supposed to be stored
        Returns:
        The normalized table name
        See Also:
        convertQualifiedAnnotationTypeToColumnName(String, String)