MCPcopy Create free account
hub / github.com/GateNLP/gate-core / DocumentImpl

Class DocumentImpl

src/main/java/gate/corpora/DocumentImpl.java:173–2565  ·  view source on GitHub ↗

Represents the commonalities between all sorts of documents. Editing The DocumentImpl class implements the Document interface. The DocumentContentImpl class models the textual or audio-visual materials which are the source and content of Documents. The AnnotationSetImpl class supplies

Source from the content-addressed store, hash-verified

171 * </PRE>
172 */
173@CreoleResource(name = "GATE Document", interfaceName = "gate.Document",
174 comment = "GATE transient document.", icon = "document",
175 helpURL = "http://gate.ac.uk/userguide/sec:developer:documents")
176public class DocumentImpl extends AbstractLanguageResource implements
177 TextualDocument,
178 CreoleListener,
179 DatastoreListener {
180 /** Debug flag */
181 private static final boolean DEBUG = false;
182
183 /**
184 * If you set this flag to true the original content of the document will be
185 * kept in the document feature. <br>
186 * Default value is false to avoid the unnecessary waste of memory
187 */
188 private Boolean preserveOriginalContent = Boolean.FALSE;
189
190 /**
191 * If you set this flag to true the repositioning information for the document
192 * will be kept in the document feature. <br>
193 * Default value is false to avoid the unnecessary waste of time and memory
194 */
195 private Boolean collectRepositioningInfo = Boolean.FALSE;
196
197 /**
198 * This is a variable which contains the latest crossed over annotation found
199 * during export with preserving format, i.e., toXml(annotations) method.
200 */
201 private Annotation crossedOverAnnotation = null;
202
203
204 /** Flag to determine whether to serialize namespace information held as
205 * annotation features into namespace prefix and URI in the XML
206 */
207 private boolean serializeNamespaceInfo = false;
208 /** Feature name used for namespace uri in namespaced elements */
209 private String namespaceURIFeature = null;
210 /** Feature name used for namespace prefix in namespaced elements */
211 private String namespacePrefixFeature = null;
212
213
214 /** Default construction. Content left empty. */
215 public DocumentImpl() {
216 content = new DocumentContentImpl();
217 stringContent = "";
218
219 /** We will attempt to serialize namespace if
220 * three parameters are set in the global or local config file:
221 * ADD_NAMESPACE_FEATURES: boolean flag
222 * ELEMENT_NAMESPACE_URI: feature name used to hold namespace URI
223 * ELEMENT_NAMESPACE_PREFIX: feature name used to hold namespace prefix
224 */
225 OptionsMap configData = Gate.getUserConfig();
226
227 boolean addNSFeature = Boolean.parseBoolean((String)configData.get(GateConstants.ADD_NAMESPACE_FEATURES));
228 namespaceURIFeature = (String) configData.get(GateConstants.ELEMENT_NAMESPACE_URI);
229 namespacePrefixFeature = (String) configData.get(GateConstants.ELEMENT_NAMESPACE_PREFIX);
230

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected