Package net.sf.okapi.filters.xliff.its
Class ITSStandoffManager
- java.lang.Object
-
- net.sf.okapi.filters.xliff.its.ITSStandoffManager
-
public class ITSStandoffManager extends Object
Handles resolving standoff annotation references without loading the entire XLIFF into memory.
-
-
Constructor Summary
Constructors Constructor Description ITSStandoffManager()Use default in-memory HashMap of ITS standoff annotations.ITSStandoffManager(IITSDataStore dataStore)Use specified storage for ITS standoff annotations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends GenericAnnotations>
voidaddLQIAnnotation(T anns, String uri)Resolve a LQI reference using the specified URI and add it to the specified annotations.<T extends GenericAnnotations>
voidaddProvAnnotation(T anns, String uri)Resolve a provenance reference using the specified URI and add it to the specified annotations.booleanalreadyParsed(String resource)Check if the named resource has already been parsed for ITS metadata.IITSDataStoregetDataStore()Collection<String>getStoredLQIRefs()Collection<String>getStoredProvRefs()voidparseXLIFF(XMLEventReader reader, String resource, String encoding)Saves input reader into a temporary file and returns a reference for additional parsing of the same content.
-
-
-
Constructor Detail
-
ITSStandoffManager
public ITSStandoffManager()
Use default in-memory HashMap of ITS standoff annotations.
-
ITSStandoffManager
public ITSStandoffManager(IITSDataStore dataStore)
Use specified storage for ITS standoff annotations.
-
-
Method Detail
-
parseXLIFF
public void parseXLIFF(XMLEventReader reader, String resource, String encoding) throws XMLStreamException
Saves input reader into a temporary file and returns a reference for additional parsing of the same content.- Parameters:
reader- the reader for the document to parse.resource- an IRI reference without the fragment part.encoding- the encoding to use for the output.- Throws:
XMLStreamException
-
addLQIAnnotation
public <T extends GenericAnnotations> void addLQIAnnotation(T anns, String uri)
Resolve a LQI reference using the specified URI and add it to the specified annotations.- Parameters:
anns- annotations where to add.uri- URI of the reference.
-
addProvAnnotation
public <T extends GenericAnnotations> void addProvAnnotation(T anns, String uri)
Resolve a provenance reference using the specified URI and add it to the specified annotations.- Parameters:
anns- the annotations where to add.uri- URI of the reference.
-
alreadyParsed
public boolean alreadyParsed(String resource)
Check if the named resource has already been parsed for ITS metadata. Naming consistency is expected for the resource; ie if the resource is referred to using the entire URI, all references to the same resource must do the same.- Parameters:
resource- An IRI reference without the fragment part
-
getStoredLQIRefs
public Collection<String> getStoredLQIRefs()
-
getStoredProvRefs
public Collection<String> getStoredProvRefs()
-
getDataStore
public final IITSDataStore getDataStore()
-
-