Class AnnotationTableManager
- java.lang.Object
-
- de.julielab.jcore.consumer.xmi.AnnotationTableManager
-
public class AnnotationTableManager extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringANNOTATION_LIST_TABLEstatic StringTABLE_NAME
-
Constructor Summary
Constructors Constructor Description AnnotationTableManager(de.julielab.costosys.dbconnection.DataBaseConnector dbc, String rawDocumentTableName, List<String> qualifiedAnnotationsToStore, boolean binaryAnnotationColumns, String documentTableSchema, Boolean storeAll, Boolean storeBaseDocument, String defaultAnnotationQualifier, String xmiMetaSchema)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringconvertQualifiedAnnotationTypeToColumnName(String qualifiedAnnotationName, String defaultAnnotationColumnQualifier)Converts potentially qualified annotation types to Postgres-valid column names.StringconvertUnqualifiedAnnotationTypetoColumnName(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.
-
-
-
Field Detail
-
ANNOTATION_LIST_TABLE
public static final String ANNOTATION_LIST_TABLE
- See Also:
- Constant Field Values
-
TABLE_NAME
public static final String TABLE_NAME
- See Also:
- Constant Field Values
-
-
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 normalizestoreAll- whether or not the complete document XMI is supposed to be stored- Returns:
- The normalized table name
- See Also:
convertQualifiedAnnotationTypeToColumnName(String, String)
-
-