Discussion:
[jira] [Created] (UIMA-3219) Simpler XMI writing than XWriter
(too old to reply)
Richard Eckart de Castilho (JIRA)
2013-08-25 08:23:52 UTC
Permalink
Richard Eckart de Castilho created UIMA-3219:
------------------------------------------------

Summary: Simpler XMI writing than XWriter
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT


The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.

We should instead leverage our users' existing understanding of the annotator API. If they're going to have to write a new class every time, we should let them write an annotator class like they're already used to. We should provide a simple static method that makes it easy to write such a class, something like:

{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}

(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)

More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Richard Eckart de Castilho (JIRA)
2013-08-25 08:45:01 UTC
Permalink
[ https://issues.apache.org/jira/browse/UIMA-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13749574#comment-13749574 ]

Richard Eckart de Castilho commented on UIMA-3219:
--------------------------------------------------

There are also several loadJCas methods in JCasFactory which should be moved or adapted in this process.
Post by Richard Eckart de Castilho (JIRA)
Simpler XMI writing than XWriter
--------------------------------
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT
The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.
{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}
(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)
More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Richard Eckart de Castilho (JIRA)
2013-08-25 08:46:51 UTC
Permalink
[ https://issues.apache.org/jira/browse/UIMA-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13749574#comment-13749574 ]

Richard Eckart de Castilho commented on UIMA-3219:
--------------------------------------------------

There are also several loadJCas methods in JCasFactory which should be moved or adapted in this process.
Post by Richard Eckart de Castilho (JIRA)
Simpler XMI writing than XWriter
--------------------------------
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT
The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.
{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}
(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)
More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Richard Eckart de Castilho (JIRA)
2013-08-25 09:42:54 UTC
Permalink
[ https://issues.apache.org/jira/browse/UIMA-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Eckart de Castilho resolved UIMA-3219.
----------------------------------------------

Resolution: Fixed

The new class is called CasIOUtil and handles JCas and CAS. Corresponding methods from JCasFactory have been moved/renamed.
Post by Richard Eckart de Castilho (JIRA)
Simpler XMI writing than XWriter
--------------------------------
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT
The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.
{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}
(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)
More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Marshall Schor
2013-08-27 14:00:12 UTC
Permalink
I searched the rc3 docs for mention of CasIOUtil, but didn't get a hit. Is this
something that's overlooked, or intentional?

-Marshall
Post by Richard Eckart de Castilho (JIRA)
[ https://issues.apache.org/jira/browse/UIMA-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Eckart de Castilho resolved UIMA-3219.
----------------------------------------------
Resolution: Fixed
The new class is called CasIOUtil and handles JCas and CAS. Corresponding methods from JCasFactory have been moved/renamed.
Post by Richard Eckart de Castilho (JIRA)
Simpler XMI writing than XWriter
--------------------------------
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT
The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.
{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}
(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)
More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Richard Eckart de Castilho
2013-08-27 14:11:45 UTC
Permalink
I'm afraid the docs are not covering each and every aspect of uimaFIT.
It's intentional with the background that uimaFIT needs to be released soon
because we have other products are waiting on it. The documentation should be
improved in future releases, as should be the educational value of the examples.

There is a mention of the new class in the migration guide which is part of the
XWriter removed. The XWriter and associated file namers have been removed as they were much more complex then acutally needed. As an alternative, CasIOUtil has been introduced providing several convenience methods to read/write JCas/CAS data.
Mind, we have seen in the past that there's also the occasional undocumented
class in UIMA-SDK ;) Something we should also work on in the future.

-- Richard
I searched the rc3 docs for mention of CasIOUtil, but didn't get a hit. Is this
something that's overlooked, or intentional?
-Marshall
Post by Richard Eckart de Castilho (JIRA)
[ https://issues.apache.org/jira/browse/UIMA-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Eckart de Castilho resolved UIMA-3219.
----------------------------------------------
Resolution: Fixed
The new class is called CasIOUtil and handles JCas and CAS. Corresponding methods from JCasFactory have been moved/renamed.
Post by Richard Eckart de Castilho (JIRA)
Simpler XMI writing than XWriter
--------------------------------
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT
The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.
{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}
(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)
More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Marshall Schor
2013-08-27 18:35:23 UTC
Permalink
Post by Richard Eckart de Castilho
I'm afraid the docs are not covering each and every aspect of uimaFIT.
It's intentional with the background that uimaFIT needs to be released soon
because we have other products are waiting on it. The documentation should be
improved in future releases, as should be the educational value of the examples.
There is a mention of the new class in the migration guide which is part of the
because I searched in the PDF docs :-) .

I think this is fine - docs can be improved (by the community, even!)

-Marshall
Post by Richard Eckart de Castilho
XWriter removed. The XWriter and associated file namers have been removed as they were much more complex then acutally needed. As an alternative, CasIOUtil has been introduced providing several convenience methods to read/write JCas/CAS data.
Mind, we have seen in the past that there's also the occasional undocumented
class in UIMA-SDK ;) Something we should also work on in the future.
-- Richard
I searched the rc3 docs for mention of CasIOUtil, but didn't get a hit. Is this
something that's overlooked, or intentional?
-Marshall
Post by Richard Eckart de Castilho (JIRA)
[ https://issues.apache.org/jira/browse/UIMA-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Eckart de Castilho resolved UIMA-3219.
----------------------------------------------
Resolution: Fixed
The new class is called CasIOUtil and handles JCas and CAS. Corresponding methods from JCasFactory have been moved/renamed.
Post by Richard Eckart de Castilho (JIRA)
Simpler XMI writing than XWriter
--------------------------------
Key: UIMA-3219
URL: https://issues.apache.org/jira/browse/UIMA-3219
Project: UIMA
Issue Type: Improvement
Components: uimaFIT
Reporter: Steven Bethard
Assignee: Richard Eckart de Castilho
Fix For: 2.0.0uimaFIT
The whole FileNamer thing in XWriter is more complexity than most users need. You have to declare a new FileNamer class every time you create an XWriter. But that FileNamer class, even though it takes a JCas just like an annotator would, isn't actually an annotator, it's a totally different API.
{noformat}
public class XUtil {
public static void writeXMI(JCas jCas, File outputFile) throws IOException, SAXException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
ContentHandler handler = new XMLSerializer(outputStream).getContentHandler();
XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
serializer.serialize(jCas.getCas(), handler);
}
finally {
outputStream.close();
}
}
}
{noformat}
(The new XUtil class could also grow methods for writing XCAS, and for reading XMI and XCAS.)
More discussion here: https://code.google.com/p/uimafit/issues/detail?id=121
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Loading...