hi, not my area of expertise, but the docs say

  
http://uima.apache.org/d/uimaj-current/tutorials_and_users_guides.html#ugr.tug.aas.accessing_sofa_data

that if you're using a URI, then you use the cas.getSofaDataURI(), which returns
a string representation of the URI.

To get the data, the docs say you need to set up some standard Java I/O.

There's also a special cas method, getSofaDataStream, which returns an input
stream, and works with both local and remote data.

-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

Reply via email to