Package de.julielab.xml
Class WholeXmiStaxSplitter
- java.lang.Object
-
- de.julielab.xml.WholeXmiStaxSplitter
-
- All Implemented Interfaces:
XmiSplitter
public class WholeXmiStaxSplitter extends Object implements XmiSplitter
-
-
Field Summary
-
Fields inherited from interface de.julielab.xml.XmiSplitter
DOCUMENT_MODULE_LABEL
-
-
Constructor Summary
Constructors Constructor Description WholeXmiStaxSplitter(String tableName)Creates an StaxXmiSplitter that returns the whole xmi data.WholeXmiStaxSplitter(String tableName, int attribute_size)Creates an StaxXmiSplitter that returns the whole xmi data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdetermineMaxXmiId(byte[] ba)Determines the maximum XMI ID assigned in the XMI data given by bais plus one.List<String>getAnnotationsToStore()Returns the specified annotations to select.StringgetFirstAnnotationtype()Return the first annotation type that is not an element of the base document.XmiSplitterResultprocess(byte[] ba, org.apache.uima.cas.TypeSystem ts, int nextPossibleId, Map<String,Integer> existingSofaIdMap)Processes the xmi data according to the parameters set for the StaxXmiSplitter.voidsetAllJavaNames(ByteArrayInputStream bais)Retrieves the types namespace uri from the xmi element in order to create the fully qualified java name for all annotations that have not been given in this form.
-
-
-
Constructor Detail
-
WholeXmiStaxSplitter
public WholeXmiStaxSplitter(String tableName, int attribute_size)
Creates an StaxXmiSplitter that returns the whole xmi data. It will also return the highest xmi id assigned so far. This is optimal if the xmi data contains only the base document which has to be stored for the first time.- Parameters:
tableName- The table to store the xmi data.attribute_size- The maximum attribute size accepted by the employed StAX parser.
-
WholeXmiStaxSplitter
public WholeXmiStaxSplitter(String tableName)
Creates an StaxXmiSplitter that returns the whole xmi data. It will also return the highest xmi id assigned so far. This is optimal if the xmi data contains only the base document which has to be stored for the first time.- Parameters:
tableName- The table to store the xmi data.
-
-
Method Detail
-
process
public XmiSplitterResult process(byte[] ba, org.apache.uima.cas.TypeSystem ts, int nextPossibleId, Map<String,Integer> existingSofaIdMap) throws XMISplitterException
Processes the xmi data according to the parameters set for the StaxXmiSplitter.- Specified by:
processin interfaceXmiSplitter- Parameters:
ba- The current xmi data.ts- The type system of the serialized CASnextPossibleId- The next xmi id that can be assigned to the new annotations. If the base document has not yet been stored this should be 0.- Returns:
- A list containing the xmi data (only unless the complete XMI
document should be stored), i.e. separate annotations and
optionally the base document, as output streams mapped to the
table names - a
HashMap<String, ByteArrayOutputStream>- the next possible xmi id - anInteger- to store in the database and a namespace map derived from XMI opening element where each namespace prefix is mapped to the namespace URI (only unless the complete XMI document should be stored). - Throws:
IOExceptionXMISplitterException
-
determineMaxXmiId
public int determineMaxXmiId(byte[] ba)
Determines the maximum XMI ID assigned in the XMI data given by bais plus one.- Parameters:
ba- The current xmi data as input stream.
-
setAllJavaNames
public void setAllJavaNames(ByteArrayInputStream bais)
Retrieves the types namespace uri from the xmi element in order to create the fully qualified java name for all annotations that have not been given in this form.- Parameters:
bais- The current xmi data as input stream.
-
getAnnotationsToStore
public List<String> getAnnotationsToStore()
Returns the specified annotations to select.- Returns:
-
getFirstAnnotationtype
public String getFirstAnnotationtype()
Return the first annotation type that is not an element of the base document.- Returns:
-
-