org.xces.graf.uima.convert
Class Graf2CAS

java.lang.Object
  extended by org.xces.graf.uima.convert.Graf2CAS

public class Graf2CAS
extends Object

uses App.java to utilize command line input. This class is an updated version of example.java by Madhav Krishna of how one can use the CASFactory class to convert a Graph to a CAS: updated to work with xmlns="http://www.xces.org/ns/GrAF/1.0/

Version:
1.0
Author:
Cascio

Field Summary
protected static org.slf4j.Logger logger
           
 
Constructor Summary
Graf2CAS()
           
 
Method Summary
 void convert(File inputFile, File outputDirectory, File resourceHeaderFile, ArrayList<String> sOFileTypes)
          convert method, calls original convert method just accepts resource header as a file instead of resource header object this is the original convert header, however the method is new to UimaUtils 2.0.0.
 void convert(File inputFile, File outputDirectory, org.xces.graf.io.dom.ResourceHeader header, ArrayList<String> sOFileTypes)
          Runs Graf2CAS
 org.apache.uima.cas.CAS convertGraphToCas(org.xces.graf.api.IGraph graph, org.xces.graf.util.NameMap map)
          Converts a Graph to a CAS
protected  void copyIntoTypeSystem(org.apache.uima.cas.CAS cas, org.xces.graf.util.NameMap nameMap, org.xces.graf.api.IGraph aGraph)
          copies TypeSystem from CAS to the global variable Master Type System
 void dumpCasToXmi(org.apache.uima.cas.CAS aCas, File file, File outputDirectory)
          Serializes a CAS to XMI -- its representation in XML
 void generateTypeSystem(boolean generate)
          set to false to disable the generation of a UIMA Type system file.
static String getContents(String file)
          Returns the contents of a file in the form of a String object
 void saveTypeSystem(org.apache.uima.cas.CAS aCas, File destination)
          Creates an ECORE file for the type system used for a CAS object
 void saveTypeSystem(org.apache.uima.cas.TypeSystem typeSystem, File destination)
          Creates an ECORE file for all the GrAF files that were converted to CAS objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.slf4j.Logger logger
Constructor Detail

Graf2CAS

public Graf2CAS()
Method Detail

convertGraphToCas

public org.apache.uima.cas.CAS convertGraphToCas(org.xces.graf.api.IGraph graph,
                                                 org.xces.graf.util.NameMap map)
                                          throws SAXException,
                                                 IOException,
                                                 org.apache.uima.cas.CASException,
                                                 org.xces.graf.api.GrafException,
                                                 TypeSystemException
Converts a Graph to a CAS

Parameters:
graph -
Returns:
Throws:
IOException
SAXException
org.xces.graf.api.GrafException
org.apache.uima.cas.CASException
TypeSystemException

dumpCasToXmi

public void dumpCasToXmi(org.apache.uima.cas.CAS aCas,
                         File file,
                         File outputDirectory)
                  throws org.apache.uima.resource.ResourceProcessException,
                         IOException
Serializes a CAS to XMI -- its representation in XML

Parameters:
aCas -
Throws:
org.apache.uima.resource.ResourceProcessException
IOException

saveTypeSystem

public void saveTypeSystem(org.apache.uima.cas.CAS aCas,
                           File destination)
                    throws IOException,
                           SAXException
Creates an ECORE file for the type system used for a CAS object

Parameters:
aCas -
Throws:
IOException,SAXException
IOException
SAXException

saveTypeSystem

public void saveTypeSystem(org.apache.uima.cas.TypeSystem typeSystem,
                           File destination)
                    throws IOException,
                           SAXException
Creates an ECORE file for all the GrAF files that were converted to CAS objects

Parameters:
typeSystem -
destination -
Throws:
IOException
SAXException

generateTypeSystem

public void generateTypeSystem(boolean generate)
set to false to disable the generation of a UIMA Type system file. Disabling can be useful if one already exists

Parameters:
generate -

convert

public void convert(File inputFile,
                    File outputDirectory,
                    File resourceHeaderFile,
                    ArrayList<String> sOFileTypes)
             throws org.xces.graf.api.GrafException,
                    org.apache.uima.resource.ResourceInitializationException,
                    TypeSystemException,
                    IOException
convert method, calls original convert method just accepts resource header as a file instead of resource header object this is the original convert header, however the method is new to UimaUtils 2.0.0. it calls the original method, but ther original now takes a resource header object instead of a file object

Parameters:
inputFile -
outputDirectory -
resourceHeaderFile -
sOFileTypes -
Throws:
org.xces.graf.api.GrafException
org.apache.uima.resource.ResourceInitializationException
TypeSystemException
IOException

convert

public void convert(File inputFile,
                    File outputDirectory,
                    org.xces.graf.io.dom.ResourceHeader header,
                    ArrayList<String> sOFileTypes)
             throws org.xces.graf.api.GrafException,
                    org.apache.uima.resource.ResourceInitializationException,
                    TypeSystemException,
                    IOException
Runs Graf2CAS

Throws:
org.xces.graf.api.GrafException
org.apache.uima.resource.ResourceInitializationException
TypeSystemException
IOException

getContents

public static String getContents(String file)
                          throws Exception
Returns the contents of a file in the form of a String object

Parameters:
file -
Returns:
Throws:
IOException
Exception

copyIntoTypeSystem

protected void copyIntoTypeSystem(org.apache.uima.cas.CAS cas,
                                  org.xces.graf.util.NameMap nameMap,
                                  org.xces.graf.api.IGraph aGraph)
                           throws TypeSystemException
copies TypeSystem from CAS to the global variable Master Type System

Parameters:
cas -
nameMap -
aGraph -
Throws:
TypeSystemException


Copyright © 2012 American National Corpus. All Rights Reserved.