Hi, I am trying to develop a simple analysis engine component where it
would take two XMI files and use XmiCasDeserializer to extract the
objects in the XMI files into two collections, and then I can compare
the two sets of objects in memory for evaluation purpose.
What I am thinking right now is to create two views, and pass each
view's underlying CAS to the XmiCasDeserializer so it can populate the
CAS with objects extracted from the XMI file.
However, I am having trouble to get it to work. It works if I use the
"_InitialView" but it does not work with the two new views that I
created on the spot. I wonder if anybody here has some experience or
advice on how to get this done. I would really appreciate that.
More details:
Here is how I created the views.
JCas defaultView = null;
JCas goldView = null;
JCas engineView = null;
try {
defaultView = aJCas.getView("_InitialView");
goldView = aJCas.createView("goldTokens");
engineView = aJCas.createView("engineTokens");
} catch (CASException e) {
e.printStackTrace();
}
Here is how I used XmiCasDeserializer to extract objects from XMI file
and populate the CASes.
try {
goldInputStream = new FileInputStream(goldXmiFile);
engineInputStream = new FileInputStream(engineXmiFile);
XmiCasDeserializer.deserialize(goldInputStream,
goldView.getCas(), false);
XmiCasDeserializer.deserialize(engineInputStream,
engineView.getCas(), false);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
return;
} catch (SAXException saxe) {
saxe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
goldInputStream.close();
engineInputStream.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
--
James