uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <...@apache.org>
Subject Re: No sofaFS for specified sofaRef found
Date Sat, 07 May 2016 20:30:59 GMT
The CasCopier was not rewritten for DKPro Core - there are just a few
copies of an old UIMA CasCopier with minor modifications sprinkled
around the DKPro Core source base. At some point, these will be removed
and the canonical UIMA CasCopier will be used.

The CasCopier may not set the sofa in some circumstances, e.g. when
feature structures are copied one-by-one instead of copying whole views.

Marshall recently had started a thread on the developers list about
improving the CasCopier while maintaining backwards compatibility.

See also: https://cwiki.apache.org/confluence/display/UIMA/CasCopier+and+Views

Cheers,

-- Richard

> On 07.05.2016, at 22:15, Pablo N. Mendes <pablomendes@gmail.com> wrote:
> 
> Thanks for your reply. I did not generate the XMI. It was provided to me in
> a file and I could not for the life of me figure out why it wasn't parsing.
> Only after I added the sofa="1" it deserialized perfectly.
> 
> So I figured I'd send a comment here to:
> 1) make it easier for others searching for this error message;
> 2) see if the community feels like it's worth changing the error message
> (so it's clearer) or the parsing code so that this is not an issue in the
> future (e.g. couldn't we assume sofa=1 when not specified?)
> 
> Is CasCopier known to omit sofa=1 when generating XMI? I noticed you
> rewrote it for DKPro.
> 
> Cheers,
> Pablo
> 
> 
> On Sat, May 7, 2016 at 6:46 AM, Richard Eckart de Castilho <rec@apache.org>
> wrote:
> 
>> Were you using a CasCopier for the generation of this XMI?
>> 
>> Cheers,
>> 
>> -- Richard
>> 
>>> On 07.05.2016, at 00:30, Pablo N. Mendes <pablomendes@gmail.com> wrote:
>>> 
>>> Folks,
>>> I am getting "No sofaFS for specified sofaRef found" while trying to
>>> deserialize an XMI. I found the message a bit cryptic and didn't find
>> much
>>> help on the lazyweb, so I bit the bullet and spent a few hours poking
>>> around. It seems to be a missing "sofa" attribute. If the sofa attribute
>>> has the wrong value, then you get "xmi id <id> is referenced but not
>>> defined" which is very nice and clear. But if you omit the sofa attribute
>>> you get "No sofaFS for specified sofaRef found" which is less informative
>>> IMHO.
>>> 
>>> Extra info below.
>>> 
>>> Cheers,
>>> Pablo
>>> 
>>> $ diff cas1.xmi cas2.xmi
>>> 9c9
>>> < <ls:DocumentMetadata xmi:id="18" sofa="1" source="file001.txt"
>>> documentId="001"/>
>>> ---
>>>> <ls:DocumentMetadata xmi:id="18" source="file001.txt" documentId="001"/>
>>> 
>>> 
>>> 
>>> 
>>> VERSIONS
>>> 
>>>   <uima.version>2.8.1</uima.version>
>>>   <uimafit.version>2.1.0</uimafit.version>
>>> 
>>> JAVA CODE SNIPPET
>>> 
>>> org.apache.uima.util.XmlCasDeserializer.deserialize(inputStream,
>>> jCas.getCas());
>>> 
>>> STACK TRACE
>>> 
>>> Exception in thread "main" org.apache.uima.cas.CASRuntimeException: No
>>> sofaFS for specified sofaRef found.
>>> at org.apache.uima.cas.impl.CASImpl.getSofa(CASImpl.java:806)
>>> at
>>> 
>> org.apache.uima.cas.impl.FSIndexRepositoryImpl.ll_addFS_common(FSIndexRepositoryImpl.java:2781)
>>> at
>>> 
>> org.apache.uima.cas.impl.FSIndexRepositoryImpl.ll_addFS(FSIndexRepositoryImpl.java:2763)
>>> at
>>> 
>> org.apache.uima.cas.impl.FSIndexRepositoryImpl.addFS(FSIndexRepositoryImpl.java:2068)
>>> at
>>> 
>> org.apache.uima.cas.impl.XmiCasDeserializer$XmiCasDeserializerHandler.endDocument(XmiCasDeserializer.java:1486)
>>> at
>>> 
>> org.apache.uima.util.XmlCasDeserializer$XmlCasDeserializerHandler.endDocument(XmlCasDeserializer.java:127)
>>> at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
>> Source)
>>> at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
>> Source)
>>> at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
>>> at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
>>> at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
>>> at
>>> 
>> org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
>>> Source)
>>> at
>>> 
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
>>> Source)
>>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>>> at
>>> 
>> org.apache.uima.util.XmlCasDeserializer.deserialize(XmlCasDeserializer.java:83)
>>> at
>>> 
>> org.apache.uima.util.XmlCasDeserializer.deserialize(XmlCasDeserializer.java:58)
>>> ...
>>> 
>>> 
>>> CAS1.xmi
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI
>>> xmlns:cas="http:///uima/cas.ecore"
>>> xmlns:tcas="http:///uima/tcas.ecore"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:ls="http:///com/example.ecore"
>>> xmi:version="2.0">
>>> <cas:NULL xmi:id="0"/>
>>> <ls:DocumentMetadata xmi:id="18" sofa="1" source="file001.txt"
>>> documentId="001"/>
>>> <cas:Sofa xmi:id="1" sofaNum="1" sofaID="_InitialView" mimeType="text"
>>> sofaString="This is a test."/>
>>> <cas:View sofa="1" members="18"/>
>>> </xmi:XMI>
>>> 
>>> 
>>> CAS2.xmi
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI
>>> xmlns:cas="http:///uima/cas.ecore"
>>> xmlns:tcas="http:///uima/tcas.ecore"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:ls="http:///com/example.ecore"
>>> xmi:version="2.0">
>>> <cas:NULL xmi:id="0"/>
>>> <ls:DocumentMetadata xmi:id="18" source="file001.txt" documentId="001"/>
>>> <cas:Sofa xmi:id="1" sofaNum="1" sofaID="_InitialView" mimeType="text"
>>> sofaString="This is a test."/>
>>> <cas:View sofa="1" members="18"/>
>>> </xmi:XMI>
>>> 
>>> 
>>> TYPESYSTEM
>>> 
>>> <?xml version="1.0" encoding="UTF-8" ?>
>>> 
>>> <typeSystemDescription  xmlns="http://uima.apache.org/resourceSpecifier
>> ">
>>>       <name>ExampleTypeSystem</name>
>>>       <description>Just an example</description>
>>>       <vendor>example.com</vendor>
>>>       <version>1.0</version>
>>>       <types>
>>>               <typeDescription>
>>>                       <name>com.example.DocumentMetadata</name>
>>>                       <description></description>
>>> 
>>> <supertypeName>uima.tcas.DocumentAnnotation</supertypeName>
>>>                       <features>
>>>                               <featureDescription>
>>>                                       <name>source</name>
>>>                                       <description>Source</description>
>>> 
>>> <rangeTypeName>uima.cas.String</rangeTypeName>
>>>                               </featureDescription>
>>>                               <featureDescription>
>>>                                       <name>documentId</name>
>>>                                       <description>Source</description>
>>> 
>>> <rangeTypeName>uima.cas.String</rangeTypeName>
>>>                               </featureDescription>
>>>                       </features>
>>>               </typeDescription>
>>> 
>>>       </types>
>>> </typeSystemDescription>
>>> 
>>> 
>>> --
>>> Pablo N. Mendes
>>> http://pablomendes.com
>> 
>> 
> 
> 
> -- 
> 
> Pablo N. Mendes
> http://pablomendes.com


Mime
View raw message