uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pablo N. Mendes" <pablomen...@gmail.com>
Subject No sofaFS for specified sofaRef found
Date Fri, 06 May 2016 22:30:22 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message