One other useful sources for examples: The test cases for UIMA, e.g. search the
uimaj-core projects *.java files for "getSofaDataStream".
-Marshall
On 10/24/2019 6:11 PM, Richard Eckart de Castilho wrote:
> Hi there,
>
> does somebody have an example of how to work with CASes that where the sofa
> data is not set using setDocumentText() but rather using setSofaDataURI(...)?
>
>
> It looks like the CAS text is then not accessible via the usual means:
>
> CAS cas = CasCreationUtils.createCas((TypeSystemDescription) null,
> null, null);
> cas.setSofaDataURI("https://www.apache.org/licenses/LICENSE-2.0.txt",
> "text/plain");
> CasIOUtils.save(cas, System.out, SerialFormat.XMI);
> System.out.println(cas.getDocumentText()); // -> prints "null"
> System.out.println(cas.getSofaDataString()); // -> prints "null"
>
> Apparently, one needs to call getSofaDataStream() - but even after calling
> that, getDocumentAnnotation().getCoveredText() returns null.
>
> So how is one expected to work with CASes that are using this data URI
> concept?
>
> Cheers,
>
> -- Richard