Package de.julielab.xml
Class AbstractXmiSplitter
- java.lang.Object
-
- de.julielab.xml.AbstractXmiSplitter
-
- All Implemented Interfaces:
XmiSplitter
- Direct Known Subclasses:
StaxXmiSplitter,VtdXmlXmiSplitter
public abstract class AbstractXmiSplitter extends Object implements XmiSplitter
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Set<JeDISVTDGraphNode>>annotationModulesprotected intcurrentSecondSofaMapKeyprotected Set<String>moduleAnnotationNamesprotected Map<Integer,JeDISVTDGraphNode>nodesByXmiIdprotected booleanrecursivelyprotected booleanstoreBaseDocument-
Fields inherited from interface de.julielab.xml.XmiSplitter
DOCUMENT_MODULE_LABEL
-
-
Constructor Summary
Constructors Constructor Description AbstractXmiSplitter(Set<String> moduleAnnotationNames, boolean recursively, boolean storeBaseDocument, Set<String> baseDocumentAnnotations)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidadaptSofaIdMap(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Map<String,Integer> updatedSofaIdMap)Sets the correct XMI:ID values to the Sofa nodes.protected org.apache.commons.lang3.tuple.ImmutablePair<Integer,Map<String,Integer>>assignNewXmiIds(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Map<String,Integer> existingSofaIdMap, int nextPossibleId)protected LinkedHashMap<String,ByteArrayOutputStream>createAnnotationModuleData(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Map<Integer,Integer> oldSofaXmiId2NewSofaXmiId, Map<String,Set<JeDISVTDGraphNode>> annotationModules, org.apache.uima.cas.TypeSystem ts)protected Map<String,Set<JeDISVTDGraphNode>>createAnnotationModules(Map<Integer,JeDISVTDGraphNode> nodesByXmiId)protected Stream<String>determineLabelsForNode(JeDISVTDGraphNode node, Set<String> moduleAnnotationNames, boolean recursively)protected abstract StringgetNodeXml(JeDISVTDGraphNode node)protected voidlabelNodes(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Set<String> moduleAnnotationNames, boolean recursively)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.julielab.xml.XmiSplitter
process
-
-
-
-
Field Detail
-
recursively
protected final boolean recursively
-
storeBaseDocument
protected final boolean storeBaseDocument
-
currentSecondSofaMapKey
protected int currentSecondSofaMapKey
-
nodesByXmiId
protected Map<Integer,JeDISVTDGraphNode> nodesByXmiId
-
annotationModules
protected Map<String,Set<JeDISVTDGraphNode>> annotationModules
-
-
Method Detail
-
assignNewXmiIds
protected org.apache.commons.lang3.tuple.ImmutablePair<Integer,Map<String,Integer>> assignNewXmiIds(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Map<String,Integer> existingSofaIdMap, int nextPossibleId)
-
adaptSofaIdMap
protected void adaptSofaIdMap(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Map<String,Integer> updatedSofaIdMap)
Sets the correct XMI:ID values to the Sofa nodes. The values are either derived from updatedSofaIdMap, if the sofaID value of the respective sofa is already contained there, or writes its own ID. For Sofas that are not known in the updatedSofaIdMap, their original XMI:ID value will be recorded, if the base document data is to be stored. Otherwise, these Sofa nodes will receive a new XMI:ID value equal toSOFA_UNKNOWNto indicate that no annotations referencing this sofa can be stored.- Parameters:
nodesByXmiId-updatedSofaIdMap- Should be a copy of the previous sofa ID map, if existing. When the base document is written, this should be an empty map that will be filled in this method.
-
createAnnotationModules
protected Map<String,Set<JeDISVTDGraphNode>> createAnnotationModules(Map<Integer,JeDISVTDGraphNode> nodesByXmiId)
-
labelNodes
protected void labelNodes(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Set<String> moduleAnnotationNames, boolean recursively)
-
determineLabelsForNode
protected Stream<String> determineLabelsForNode(JeDISVTDGraphNode node, Set<String> moduleAnnotationNames, boolean recursively)
-
getNodeXml
protected abstract String getNodeXml(JeDISVTDGraphNode node) throws XMISplitterException
- Throws:
XMISplitterException
-
createAnnotationModuleData
protected LinkedHashMap<String,ByteArrayOutputStream> createAnnotationModuleData(Map<Integer,JeDISVTDGraphNode> nodesByXmiId, Map<Integer,Integer> oldSofaXmiId2NewSofaXmiId, Map<String,Set<JeDISVTDGraphNode>> annotationModules, org.apache.uima.cas.TypeSystem ts) throws XMISplitterException
- Throws:
XMISplitterException
-
-