net.sourceforge.nite.nom.nomread.impl
Class NOMReadCorpus

java.lang.Object
  extended by net.sourceforge.nite.nom.nomwrite.impl.NOMWriteCorpus
      extended by net.sourceforge.nite.nom.nomread.impl.NOMReadCorpus
All Implemented Interfaces:
NOMControl, NOMCorpus, SearchableCorpus, org.xml.sax.ext.LexicalHandler

public class NOMReadCorpus
extends NOMWriteCorpus

Our first implementation of NOMReadCorpus is actually an extension of NOMWriteCorpus because we're a bit lazy that way. We just override the editing calls to disallow them. We allow serializing of the corpus, only edits are disallowed.

Author:
jonathan

Field Summary
 
Fields inherited from interface net.sourceforge.nite.nom.nomwrite.NOMCorpus
UNTIMED
 
Constructor Summary
NOMReadCorpus(NiteMetaData meta)
          Construct a NOM corpus ready to load data: this NOM will not be editable.
NOMReadCorpus(NiteMetaData meta, java.io.PrintStream log)
          Construct a NOM corpus ready to load data: this NOM will not be editable.
 
Method Summary
 boolean isEditSafe()
          Return true if the corpus can be edited safely - always return false as this is a read-only corpus.
 void loadReliability(NLayer top, NLayer top_common, java.lang.String coder_attribute_name, java.lang.String path, java.util.List observations)
          Load data for the purpose of comparing different coders' data.
 void loadReliability(NLayer top, NLayer top_common, java.lang.String coder_attribute_name, java.lang.String path, java.util.List observations, java.util.List other_layers)
          Load data for the purpose of comparing different coders' data.
 boolean lock(NOMView view)
          lock the corpus for edits - always return false as this is a read-only corpus.
 void removePointerIndex(NOMPointer point)
          remove the pointer - since we do not allow edits, just do nothing
 boolean unlock(NOMView view)
          unlock the corpus - always return false as teh corpus cannot be edited.
 
Methods inherited from class net.sourceforge.nite.nom.nomwrite.impl.NOMWriteCorpus
addDerivedAttribute, addDurations, clearData, clearDataForObservation, clearDataForObservation, comment, completeLoad, deregisterViewer, edited, endCDATA, endDTD, endEntity, forceAnnotatorCoding, generateID, getAttributeComparableValue, getBatchMode, getCenterComparableValue, getCodingFilename, getCorpusDuration, getCorpusEndTime, getCorpusStartTime, getDurationComparableValue, getElementByID, getElementByID, getElements, getElements, getElementsByName, getElementsDominatedBy, getElementsDominating, getElementsLoaded, getElementsOfSubgraph, getElementsPointedBy, getEndComparableValue, getErrorStream, getHrefAttr, getIdComparableValue, getLinkAfterID, getLinkBeforeID, getLinkFileSeparator, getLoadedObservations, getLogStream, getMaker, getMaxDepth, getMetaData, getNameOfElement, getPointersTo, getQueryRewriter, getRangeSeparator, getRootElements, getRootWithColour, getStartComparableValue, getText, isLazyLoading, isLoadingFromFile, isQueryRewriting, isValidating, loadData, loadData, loadData, NOMWalker, notifyChange, notifyChange, notifyChange, preferAnnotatorCoding, printStructure, registerID, registerViewer, resolveLink, resolveLink, serializeCorpus, serializeCorpus, serializeCorpusChanged, serializeInheritedTimes, serializeMaximalRanges, setDefaultAnnotator, setErrorStream, setForceStreamElementNames, setLazyLoading, setLogStream, setQueryRewriter, setQueryRewriting, setSchemaLocation, setSerializeInheritedTimes, setSerializeMaximalRanges, setValidation, startCDATA, startDTD, startEntity, testContactWith, testDominates, testDominates, testDominatesSubgraph, testDominatesSubgraph, testHasPointer, testHasPointer, testIncludes, testIsEqual, testIsInequal, testLeftAlignedWith, testOverlapsLeft, testOverlapsWith, testPrecedes, testPrecedesTemporal, testRightAlignedWith, testSameDuration, testSameExtend, testTimed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NOMReadCorpus

public NOMReadCorpus(NiteMetaData meta)
Construct a NOM corpus ready to load data: this NOM will not be editable. The argument is the ready-loaded metadata.


NOMReadCorpus

public NOMReadCorpus(NiteMetaData meta,
                     java.io.PrintStream log)
Construct a NOM corpus ready to load data: this NOM will not be editable. The arguments are the ready-loaded metadata and a printstream where all the status information will go (default is stdout).

Method Detail

isEditSafe

public boolean isEditSafe()
Return true if the corpus can be edited safely - always return false as this is a read-only corpus.

Specified by:
isEditSafe in interface NOMCorpus
Overrides:
isEditSafe in class NOMWriteCorpus

lock

public boolean lock(NOMView view)
lock the corpus for edits - always return false as this is a read-only corpus.

Specified by:
lock in interface NOMCorpus
Overrides:
lock in class NOMWriteCorpus

unlock

public boolean unlock(NOMView view)
unlock the corpus - always return false as teh corpus cannot be edited.

Specified by:
unlock in interface NOMCorpus
Overrides:
unlock in class NOMWriteCorpus

removePointerIndex

public void removePointerIndex(NOMPointer point)
remove the pointer - since we do not allow edits, just do nothing

Specified by:
removePointerIndex in interface NOMCorpus
Overrides:
removePointerIndex in class NOMWriteCorpus

loadReliability

public void loadReliability(NLayer top,
                            NLayer top_common,
                            java.lang.String coder_attribute_name,
                            java.lang.String path,
                            java.util.List observations)
                     throws NOMException
Load data for the purpose of comparing different coders' data. The layer 'top' is where we start the per-coder information and 'top_common' is the layer at which we expect everything to be common between coders. 'coder_attribute_name' is ised as the name of the attribute that gets the name of the coder and 'path' is where the coder data is. We assume the data will use standard NXT-filenames but be held in a directory per coder (the name of the coder is assumed to be the name of the directory) under 'path'. Note that if 'path' is null, the annotator-specific directories are assumed to be under the standard location of each coding. If 'observation' is null we attempt to load all the data, otherwise we only attempt to load the listed observations. loadReliability is now compatible with lazy loading, *but* you need to make sure you make all calls to loadReliability before any code that might cause data to be loaded via lazy loading.

Specified by:
loadReliability in interface NOMCorpus
Overrides:
loadReliability in class NOMWriteCorpus
Throws:
NOMException

loadReliability

public void loadReliability(NLayer top,
                            NLayer top_common,
                            java.lang.String coder_attribute_name,
                            java.lang.String path,
                            java.util.List observations,
                            java.util.List other_layers)
                     throws NOMException
Load data for the purpose of comparing different coders' data. This is the same as the other call except for the final argument which is a list of Strings: names of layers that should be loaded in 'gold-standard' mode

Specified by:
loadReliability in interface NOMCorpus
Overrides:
loadReliability in class NOMWriteCorpus
Throws:
NOMException