/** * @return the sofa. */ public Object getSofa() { return cas.getSofa(); } }
} else { if (getCas().getSofaDataArray() != null) { text = "Sofa array with mime type = " + getCas().getSofa().getSofaMime();
/** * Return a label to identify the view. */ public String toString() { SofaFS sofaFS = cas.getSofa(); if (null == sofaFS) return "No Sofa"; return sofaFS.getSofaID(); }
@Override public void itemStateChanged(ItemEvent e) { // a new sofa was selected. Switch to that view and update // display String sofaId = (String) e.getItem(); this.main.setCas(this.main.getCas().getView(sofaId)); String text = this.main.getCas().getDocumentText(); if (text == null) { text = this.main.getCas().getSofaDataURI(); if (text != null) { text = "SofaURI = " + text; } else { if (null != this.main.getCas().getSofaDataArray()) { text = "Sofa array with mime type = " + this.main.getCas().getSofa().getSofaMime(); } } } String oldText = this.main.getTextArea().getText(); if ((oldText == null) || (text == null) || !oldText.equals(text)) { this.main.setText(text); } if (text == null) { this.main.getTextArea().repaint(); } this.main.updateIndexTree(true); } }
/** * Constructor which takes the destination view. Initializes the {@code FsCopiers} and {@code * FsConstructors} fields using new objects. Initializes the queue using {@link ArrayDeque} and * the map using {@link HashMap}. * * @param destinationView the */ FeatureStructureCopyingQueue(CAS sourceView, CAS destinationView) { fsCopiers = new FsCopiers(this::enqueue); fsConstructors = new FsConstructors(destinationView); fsQueue = new ArrayDeque<>(); fsMap = new HashMap<>(); fsMap.put(sourceView.getSofa(), destinationView.getSofa()); }
public void process(CAS aCAS) throws AnalysisEngineProcessException { // get handle to CAS view containing XML document CAS xmlCas = aCAS.getView("xmlDocument"); InputStream xmlStream = xmlCas.getSofa().getSofaDataStream(); // parse with detag handler DetagHandler handler = new DetagHandler(); try { SAXParser parser = parserFactory.newSAXParser(); parser.parse(xmlStream, handler); } catch (Exception e) { throw new AnalysisEngineProcessException(e); } // create the plain text view and set its document text CAS plainTextView = aCAS.createView("plainTextDocument"); plainTextView.setDocumentText(handler.getDetaggedText()); plainTextView.setDocumentLanguage(aCAS.getView("_InitialView").getDocumentLanguage()); // Index the SourceDocumentInformation object, if there is one, in the new sofa. // This is needed by the SemanticSearchCasIndexer Iterator iter = xmlCas.getAnnotationIndex(sourceDocInfoType).iterator(); if (iter.hasNext()) { FeatureStructure sourceDocInfoFs = (FeatureStructure) iter.next(); plainTextView.getIndexRepository().addFS(sourceDocInfoFs); } }
FeatureStructure sofa = fsCopy.getFeatureValue(mDestSofaFeature); if (sofa == null) { fsCopy.setFeatureValue(mDestSofaFeature, targetView.getSofa());
return getOrCreateView(mDestCas, sofaId).getSofa();