You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2007/02/03 18:19:14 UTC
svn commit: r503265 [6/6] - /incubator/uima/uimacpp/trunk/src/test/src/
Added: incubator/uima/uimacpp/trunk/src/test/src/test_sofa.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_sofa.cpp?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_sofa.cpp (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_sofa.cpp Sat Feb 3 09:19:12 2007
@@ -0,0 +1,464 @@
+/** \file sofatest.cpp .
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Include dependencies */
+/* ----------------------------------------------------------------------- */
+#include "uima/api.hpp"
+#include "uima/xmlwriter.hpp"
+#include "uima/xcasdeserializer.hpp"
+#include "uima/internal_casserializer.hpp"
+#include "uima/internal_casdeserializer.hpp"
+
+#include <fstream>
+
+#ifndef NDEBUG
+#define ASSERT_OR_THROWEXCEPTION(x) assert(x)
+#else
+#define ASSERT_OR_THROWEXCEPTION(x) if (!(x)) { cerr << __FILE__ << ": Error in line " << __LINE__ << endl; exit(1); }
+#endif
+
+#define LOG(x) cout << __FILE__ << __LINE__ << ": " << x << endl
+
+using namespace uima;
+
+
+/* ----------------------------------------------------------------------- */
+/* Main routine */
+/* ----------------------------------------------------------------------- */
+
+int main(int argc, char * argv[]) /*
+---------------------------------- */
+{
+ LOG("UIMATEST_SOFATEST started");
+ int iRetVal = 0;
+
+ try {
+ char const * config =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<typeSystemDescription xmlns=\"http://uima.apache.org/resourceSpecifier\">"
+ " <types>"
+ " <typeDescription>"
+ " <name>sofa.test.CrossAnnotation</name>"
+ " <description></description>"
+ " <supertypeName>uima.tcas.Annotation</supertypeName>"
+ " <features>"
+ " <featureDescription>"
+ " <name>otherAnnotation</name>"
+ " <description></description>"
+ " <rangeTypeName>uima.tcas.Annotation</rangeTypeName>"
+ " </featureDescription>"
+ " </features>"
+ " </typeDescription>"
+ " </types>"
+ "</typeSystemDescription>";
+
+ ResourceManager::createInstance("test");
+
+ ErrorInfo errorInfo;
+ ofstream outputStream;
+
+ static TypeSystem *ts = Framework::createTypeSystemFromXMLBuffer(config, errorInfo );
+ CAS* cas = Framework::createCAS(*ts, errorInfo);
+ ASSERT_OR_THROWEXCEPTION( EXISTS(cas) );
+
+ Type annotationType = ts->getType(CAS::TYPE_NAME_ANNOTATION);
+ Type docAnnotationType = ts->getType(CAS::TYPE_NAME_DOCUMENT_ANNOTATION);
+ Type crossType = ts->getType("sofa.test.CrossAnnotation");
+ Feature otherFeat = crossType.getFeatureByBaseName("otherAnnotation");
+
+ // Create a Sofa (using old APIs for now)
+ SofaID * id = new SofaID;
+ id->setSofaId("EnglishDocument");
+ SofaFS es = cas->createSofa(*id, "text");
+ ASSERT_OR_THROWEXCEPTION(es.isValid());
+ // Initial View is #1!!!
+ ASSERT_OR_THROWEXCEPTION(2 == es.getSofaRef());
+
+ // Set the document text
+//TODO? es.setLocalSofaData("this beer is good");
+ es.setLocalSofaData(UnicodeString("this beer is good"));
+
+ // Test Multiple Sofas across XCAS serialization
+ outputStream.open("temp.xcas");
+ if ( !outputStream ) {
+ cerr << "Error opening output stream" << endl;
+ return 1;
+ }
+ // Serialize XCAS
+ XCASWriter writer(*cas, false);
+ writer.write(outputStream);
+ outputStream.close();
+
+ // Deserialize XCAS
+ cas->reset();
+ XCASDeserializer::deserialize("temp.xcas", *cas);
+
+ // Add a new Sofa
+ CAS* gerTcas = cas->createView("GermanDocument");
+ ASSERT_OR_THROWEXCEPTION(0 == gerTcas->getViewName().compare("GermanDocument"));
+ SofaFS gs = gerTcas->getSofa();
+
+ ASSERT_OR_THROWEXCEPTION(gs.isValid());
+ ASSERT_OR_THROWEXCEPTION(3 == gs.getSofaRef());
+
+ // Set the document text
+//TODO? gerTcas->setDocumentText("das bier ist gut");
+ gerTcas->setDocumentText(UnicodeString("das bier ist gut"));
+
+
+// Test Multiple Sofas across XCAS serialization
+ outputStream.open("temp.xcas");
+ if ( !outputStream ) {
+ cerr << "Error opening output stream" << endl;
+ return 1;
+ }
+ // Serialize XCAS
+// XCASWriter writer2(*cas, false);
+ writer.write(outputStream);
+ outputStream.close();
+
+ // Deserialize XCAS
+ cas->reset();
+ XCASDeserializer::deserialize("temp.xcas", *cas);
+
+
+ // Test multiple Sofas across binary serialization
+ internal::CASSerializer serializer(false);
+ internal::CASDeserializer deserializer;
+ size_t blobsz = serializer.getBlobSize(*cas);
+ char* blob = new char[blobsz];
+ size_t blobsz2 = serializer.getBlob(*cas, blob, blobsz);
+ ASSERT_OR_THROWEXCEPTION(blobsz == blobsz2);
+ cas->reset();
+ deserializer.deserializeBlob(blob, *cas);
+ delete[] blob;
+
+ // Add a new Sofa
+ CAS* frT = cas->createView("FrenchDocument");
+ ASSERT_OR_THROWEXCEPTION(0 == frT->getViewName().compare("FrenchDocument"));
+ SofaFS fs = frT->getSofa();
+ ASSERT_OR_THROWEXCEPTION(fs.isValid());
+ ASSERT_OR_THROWEXCEPTION(4 == fs.getSofaRef());
+
+ // Test multiple Sofas across blob serialization
+ blobsz = serializer.getBlobSize(*cas);
+ blob = new char[blobsz];
+ blobsz2 = serializer.getBlob(*cas, blob, blobsz);
+ ASSERT_OR_THROWEXCEPTION(blobsz == blobsz2);
+ cas->reset();
+ deserializer.deserializeBlob(blob, *cas);
+ delete[] blob;
+
+ // Open Cas views of some Sofas
+ CAS* engTcas = cas->getView(es);
+ ASSERT_OR_THROWEXCEPTION(0 == engTcas->getViewName().compare("EnglishDocument"));
+ CAS* frTcas = cas->getView("FrenchDocument");
+
+ // Set the document text off SofaFS after the CAS view exists
+// frTcas->setSofaDataString("cette biere est bonne", "text");
+ frTcas->setSofaDataString(UnicodeString("cette biere est bonne"), "text");
+
+ // Create standard annotations against one and cross annotations against the other
+ AnnotationFS engAnnot = engTcas->createAnnotation(annotationType, 0, 4);
+ engTcas->getIndexRepository().addFS(engAnnot);
+
+ AnnotationFS frAnnot = frTcas->createAnnotation(annotationType, 0, 5);
+ frTcas->getIndexRepository().addFS(frAnnot);
+
+ AnnotationFS gerAnnot = gerTcas->createAnnotation(crossType, 0, 3);
+ gerAnnot.setFeatureValue(otherFeat, engAnnot);
+ gerTcas->getIndexRepository().addFS(gerAnnot);
+
+ // Test that the annotations are in separate index spaces, and that Sofas are indexed
+ FSIterator sofaIter = cas->getSofaIterator();
+ int numSofas = 0;
+ while (sofaIter.isValid()) {
+ numSofas++;
+ sofaIter.moveToNext();
+ }
+
+ FSIndex engIndex = engTcas->getAnnotationIndex();
+ FSIndex gerIndex = gerTcas->getAnnotationIndex();
+ FSIndex frIndex = frTcas->getAnnotationIndex();
+ ASSERT_OR_THROWEXCEPTION(numSofas == 3);
+
+ ASSERT_OR_THROWEXCEPTION(engIndex.getSize() == 2); // 1 annots plus documentAnnotation
+ ASSERT_OR_THROWEXCEPTION(gerIndex.getSize() == 2); // 1 annots plus documentAnnotation
+ ASSERT_OR_THROWEXCEPTION(frIndex.getSize() == 2); // 1 annots plus documentAnnotation
+
+ // Test that the annotations are of the correct types
+ FSIterator engIt = engIndex.iterator();
+ FSIterator gerIt = gerIndex.iterator();
+ FSIterator frIt = frIndex.iterator();
+ engAnnot = (AnnotationFS)engIt.get();
+ gerAnnot = (AnnotationFS)gerIt.get();
+ frAnnot = (AnnotationFS)frIt.get();
+ ASSERT_OR_THROWEXCEPTION(0==docAnnotationType.getName().compare(engAnnot.getType().getName()));
+ ASSERT_OR_THROWEXCEPTION(0==docAnnotationType.getName().compare(gerAnnot.getType().getName()));
+ ASSERT_OR_THROWEXCEPTION(0==docAnnotationType.getName().compare(frAnnot.getType().getName()));
+
+ engIt.moveToNext();
+ gerIt.moveToNext();
+ frIt.moveToNext();
+ engAnnot = (AnnotationFS)engIt.get();
+ gerAnnot = (AnnotationFS)gerIt.get();
+ frAnnot = (AnnotationFS)frIt.get();
+ ASSERT_OR_THROWEXCEPTION(0==annotationType.getName().compare(engAnnot.getType().getName()));
+ ASSERT_OR_THROWEXCEPTION(0==engAnnot.getCoveredText().compare("this"));
+ ASSERT_OR_THROWEXCEPTION(0==annotationType.getName().compare(frAnnot.getType().getName()));
+ ASSERT_OR_THROWEXCEPTION(0==frAnnot.getCoveredText().compare("cette"));
+ ASSERT_OR_THROWEXCEPTION(0==crossType.getName().compare(gerAnnot.getType().getName()));
+ ASSERT_OR_THROWEXCEPTION(0==gerAnnot.getCoveredText().compare("das"));
+
+ // Test that the other annotation feature of cross annotations works
+ AnnotationFS crossAnnot = (AnnotationFS) gerAnnot.getFeatureValue(otherFeat);
+ ASSERT_OR_THROWEXCEPTION(0==annotationType.getName().compare(crossAnnot.getType().getName()));
+ ASSERT_OR_THROWEXCEPTION(0==crossAnnot.getCoveredText().compare("this"));
+
+
+
+ // --------------------------------------------------------
+ // Test that annotations accessed from a reference in the base CAS work correctly
+ // --------------------------------------------------------
+
+ ArrayFS anArray = cas->createArrayFS(3);
+ anArray.set(0, engAnnot);
+ anArray.set(1, frAnnot);
+ anArray.set(2, gerAnnot);
+ AnnotationFS tstAnnot = (AnnotationFS)anArray.get(0);
+ ASSERT_OR_THROWEXCEPTION(0==tstAnnot.getCoveredText().compare("this"));
+ tstAnnot = (AnnotationFS)anArray.get(1);
+ ASSERT_OR_THROWEXCEPTION(0==tstAnnot.getCoveredText().compare("cette"));
+ tstAnnot = (AnnotationFS)anArray.get(2);
+ ASSERT_OR_THROWEXCEPTION(0==tstAnnot.getCoveredText().compare("das"));
+
+
+ // --------------------------------------------------------
+ // Test that a FS can be indexed in multiple Views
+ // --------------------------------------------------------
+
+ CAS* marView = cas->createView("MartinView");
+ marView->getIndexRepository().addFS(engAnnot);
+
+ // Serialize XCAS
+ outputStream.open("temp.xcas");
+ if ( !outputStream ) {
+ cerr << "Error opening output stream" << endl;
+ return 1;
+ }
+ writer.write(outputStream);
+ outputStream.close();
+ // Deserialize XCAS
+ cas->reset();
+ XCASDeserializer::deserialize("temp.xcas", *cas);
+
+ marView = cas->getView("MartinView");
+ FSIndex mrIndex = marView->getAnnotationIndex(annotationType);
+ FSIterator mrIt = mrIndex.iterator();
+ ASSERT_OR_THROWEXCEPTION(mrIt.isValid());
+ engAnnot = (AnnotationFS)mrIt.get();
+ ASSERT_OR_THROWEXCEPTION(0==engAnnot.getCoveredText().compare("this"));
+
+
+ // --------------------------------------------------------
+ // Test reuse of views with createSofa
+ // --------------------------------------------------------
+
+ cas->reset();
+ cas->setDocumentText(UnicodeString("setDocumentText creates the _InitialView Sofa"));
+ CAS* testView = cas->createView("anotherView");
+ ASSERT_OR_THROWEXCEPTION(0 == testView->getViewName().compare("anotherView"));
+ ASSERT_OR_THROWEXCEPTION(0 == cas->getViewName().compare("_InitialView"));
+
+ cas->reset();
+ SofaID * nuid = new SofaID;
+ nuid->setSofaId("testView");
+ SofaFS tv = cas->createSofa(*nuid, "text");
+ testView = cas->getView(tv);
+ ASSERT_OR_THROWEXCEPTION(0 == testView->getViewName().compare("testView"));
+
+
+ // --------------------------------------------------------
+ // Test sofa data stream
+ // --------------------------------------------------------
+
+ char dest[100];
+ //Test reading sofa data set as String feature.
+ cas->reset();
+ CAS * stringView = cas->createView("StringSofaData");
+ UnicodeString ustrText("this beer is good");
+ stringView->setDocumentText(ustrText);
+ SofaDataStream * pStream = stringView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ int totsize = pStream->getTotalStreamSizeInBytes();
+ ASSERT_OR_THROWEXCEPTION(totsize > 0);
+ ASSERT_OR_THROWEXCEPTION(pStream->read(dest,1,totsize) == totsize);
+ ASSERT_OR_THROWEXCEPTION(strncmp(dest, "this beer is good", totsize) == 0);
+ delete pStream;
+
+ //read sofa data from SofaURI.
+ CAS * remoteView = cas->createView("remoteSofaData");
+ ustrText = "text";
+ std::string fn = "file://";
+ fn.append(UnicodeStringRef(ResourceManager::resolveFilename("example.txt", ".")).asUTF8());
+ remoteView->setSofaDataURI(fn.c_str(), "text");
+ pStream = remoteView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ totsize = pStream->getTotalStreamSizeInBytes();
+ ASSERT_OR_THROWEXCEPTION(totsize > 0);
+ ASSERT_OR_THROWEXCEPTION(pStream->read(dest,1,totsize) == totsize);
+ ASSERT_OR_THROWEXCEPTION(strncmp(dest, "This is a text document with a Dave for analysis.", totsize) == 0);
+ delete pStream;
+
+
+ //read sofa data set as int array FS.
+ IntArrayFS intArrayFS = cas->createIntArrayFS(5);
+ intArrayFS.set(0,1);
+ intArrayFS.set(1,2);
+ intArrayFS.set(2,3);
+ intArrayFS.set(3,4);
+ intArrayFS.set(4,5);
+ CAS * intArrayView = cas->createView("intArraySofaData");
+ intArrayView->setSofaDataArray(intArrayFS, "integers");
+ pStream = intArrayView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ int value;
+ int i=0;
+ while (pStream->read(&value, sizeof(int), 1) != -1) {
+ ASSERT_OR_THROWEXCEPTION(value == intArrayFS.get(i++));
+ }
+ delete pStream;
+
+ //read sofa data set as float array FS.
+ FloatArrayFS floatArrayFS = cas->createFloatArrayFS(5);
+ floatArrayFS.set(0,(float) 0.1);
+ floatArrayFS.set(1,(float) 0.2);
+ floatArrayFS.set(2,(float) 0.3);
+ floatArrayFS.set(3,(float) 0.4);
+ floatArrayFS.set(4,(float) 0.5);
+ CAS * floatArrayView = cas->createView("floatArraySofaData");
+ floatArrayView->setSofaDataArray(floatArrayFS,"floats");
+ pStream = floatArrayView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ float floatvalue;
+ i=0;
+ while (pStream->read(&floatvalue, sizeof(float), 1) != -1) {
+ ASSERT_OR_THROWEXCEPTION(floatvalue == floatArrayFS.get(i++));
+ }
+ delete pStream;
+
+ //create a Sofa and set the SofaArray feature to a short array FS.
+ ShortArrayFS shortArrayFS = cas->createShortArrayFS(5);
+ shortArrayFS.set(0,(short)128);
+ shortArrayFS.set(1,(short)127);
+ shortArrayFS.set(2,(short)126);
+ shortArrayFS.set(3,(short)125);
+ shortArrayFS.set(4,(short)124);
+ CAS * shortArrayView = cas->createView("shortArraySofaData");
+ shortArrayView->setSofaDataArray(shortArrayFS, "shorts");
+ pStream = shortArrayView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ short shortvalue;
+ i=0;
+ while (pStream->read(&shortvalue, sizeof(short), 1) != -1) {
+ //cout << shortvalue << " " << shortArrayFS.get(i << endl;
+ ASSERT_OR_THROWEXCEPTION(shortvalue == shortArrayFS.get(i++));
+ }
+ delete pStream;
+
+ //create a Sofa and set the SofaArray feature to a byte array FS.
+ ByteArrayFS byteArrayFS = cas->createByteArrayFS(4);
+ byteArrayFS.set(0, 'a' );
+ byteArrayFS.set(1, 'b');
+ byteArrayFS.set(2, 'c');
+ byteArrayFS.set(3, 'd');
+ CAS * byteArrayView = cas->createView("byteArraySofaData");
+ byteArrayView->setSofaDataArray(byteArrayFS, "bytes");
+ pStream = byteArrayView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ char bytevalue;
+ i=0;
+ while (pStream->read(&bytevalue, 1, 1) != -1) {
+ ASSERT_OR_THROWEXCEPTION(bytevalue == byteArrayFS.get(i++));
+ }
+ delete pStream;
+
+ //create a Sofa and set the SofaArray feature to a long array FS.
+ LongArrayFS longArrayFS = cas->createLongArrayFS(5);
+ longArrayFS.set(0,11);
+ longArrayFS.set(1,21);
+ longArrayFS.set(2,31);
+ longArrayFS.set(3,41);
+ longArrayFS.set(4,51);
+ CAS * longArrayView = cas->createView("longArraySofaData");
+ longArrayView->setSofaDataArray(longArrayFS, "longs");
+ pStream = longArrayView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ INT64 longvalue;
+ i=0;
+ while (pStream->read(&longvalue, sizeof(INT64), 1) != -1) {
+ ASSERT_OR_THROWEXCEPTION(longvalue == longArrayFS.get(i++));
+ }
+ delete pStream;
+
+ //create a Sofa and set the SofaArray feature to a Double Array FS.
+ DoubleArrayFS doubleArrayFS = cas->createDoubleArrayFS(5);
+ doubleArrayFS.set(0,21E10);
+ doubleArrayFS.set(1,31E10);
+ doubleArrayFS.set(2,41E10);
+ doubleArrayFS.set(3,51E10);
+ doubleArrayFS.set(4,61E10);
+ CAS * doubleArrayView = cas->createView("doubleArraySofaData");
+ doubleArrayView->setSofaDataArray(doubleArrayFS, "doubles");
+ pStream = doubleArrayView->getSofaDataStream();
+ ASSERT_OR_THROWEXCEPTION(pStream != NULL);
+ ASSERT_OR_THROWEXCEPTION( pStream->open()== 0);
+ i=0;
+ double doubleValue;
+ while (pStream->read(&doubleValue, sizeof(double), 1) != -1) {
+ ASSERT_OR_THROWEXCEPTION( doubleArrayFS.get(i++) == doubleValue);
+ }
+ delete pStream;
+
+ delete cas;
+ LOG("UIMATEST_SOFATEST finished");
+ } catch (Exception & exc) {
+ cerr << exc.asString() << endl;
+ iRetVal = 1;
+ }
+#ifdef NDEBUG
+ catch (...) {
+ cerr << "Unexpected exception " << endl;
+ iRetVal = 1;
+ }
+#endif
+ return iRetVal;
+}
+
+/* <EOF> */
Propchange: incubator/uima/uimacpp/trunk/src/test/src/test_sofa.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/uimacpp/trunk/src/test/src/test_sofa.vcproj
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_sofa.vcproj?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_sofa.vcproj (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_sofa.vcproj Sat Feb 3 09:19:12 2007
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="test_sofa"
+ ProjectGUID="{2A4A561A-F304-4280-9238-DD2C1C82F8AE}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(InputDir)\.."
+ IntermediateDirectory="..\Debug\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;"$(APR_HOME)\include";"$(ICU_HOME)\include";"$(XERCES_HOME)\include";"$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32";"$(UIMACPP_HOME)\include";"$(UIMACPP_HOME)\include\apr""
+ PreprocessorDefinitions="UIMA_SUPPRESS_TIMING;WIN32;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="xerces-c_2.lib icuuc.lib uimaD.lib"
+ OutputFile="$(OutDir)/test_sofa.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(APR_HOME)\Debug";"$(XERCES_HOME)\lib";"$(ICU_HOME)\lib";"$(UIMACPP_HOME)\lib""
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(InputDir)\.."
+ IntermediateDirectory="..\Release\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories=".;"$(APR_HOME)\include";"$(ICU_HOME)\include";"$(XERCES_HOME)\include";"$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32";"$(UIMACPP_HOME)\include";"$(UIMACPP_HOME)\include\apr""
+ PreprocessorDefinitions="UIMA_SUPPRESS_TIMING;TRACEOFF;NDEBUG;WIN32;_CONSOLE"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="xerces-c_2.lib icuuc.lib uima.lib"
+ OutputFile="$(OutDir)/test_sofa.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""$(APR_HOME)\Release";"$(XERCES_HOME)\lib";"$(ICU_HOME)\lib";"$(UIMACPP_HOME)\lib""
+ GenerateDebugInformation="FALSE"
+ ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="test_sofa.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Propchange: incubator/uima/uimacpp/trunk/src/test/src/test_sofa.vcproj
------------------------------------------------------------------------------
svn:eol-style = CRLF
Added: incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.cpp?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.cpp (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.cpp Sat Feb 3 09:19:12 2007
@@ -0,0 +1,276 @@
+/** \file test_typepriority.cpp .
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Include dependencies */
+/* ----------------------------------------------------------------------- */
+#include "uima/engine.hpp"
+#include "uima/typesystem.hpp"
+#include "uima/tt_types.hpp"
+#include "uima/cas.hpp"
+#include "uima/fsindexrepository.hpp"
+#include "uima/resmgr.hpp"
+
+/* ----------------------------------------------------------------------- */
+/* Constants */
+/* ----------------------------------------------------------------------- */
+#ifndef NDEBUG
+#define ASSERT_OR_THROWEXCEPTION(x) assert(x)
+#else
+#define ASSERT_OR_THROWEXCEPTION(x) if (!(x)) { cerr << __FILE__ << ": Error in line " << __LINE__ << endl; exit(1); }
+#endif
+
+#define LOG(x) cout << __FILE__ << __LINE__ << ": " << x << endl
+
+using namespace uima;
+/* ----------------------------------------------------------------------- */
+/* Forward declarations */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Types / Classes */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Implementation */
+/* ----------------------------------------------------------------------- */
+int findLastPosition(vector<uima::Type> const & types, Type t) {
+ int result = -1;
+ int i;
+ for (i=0; i<types.size(); ++i) {
+ if (t.subsumes( types[i] ) ) {
+ result = i;
+ }
+ }
+ return result;
+}
+
+
+void checkPriority(vector<uima::Type> const & types, Type t1, Type t2) {
+ LOG("Checking priority between " << t1.getName() << " and " << t2.getName() );
+ int iPos1 = findLastPosition(types, t1);
+ ASSERT_OR_THROWEXCEPTION( iPos1 >= 0);
+ int iPos2 = findLastPosition(types, t2);
+ ASSERT_OR_THROWEXCEPTION( iPos2 >= 0);
+ LOG("Last position of annotation of type " << t1.getName() << ": " << iPos1);
+ LOG("Last position of annotation of type " << t2.getName() << ": " << iPos2);
+
+ ASSERT_OR_THROWEXCEPTION( iPos1 < iPos2 );
+}
+
+void checkIndex(CAS const & rTCAS) {
+ uima::Type annType = rTCAS.getTypeSystem().getType(uima::CAS::TYPE_NAME_ANNOTATION);
+ uima::Type tokType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_TOKEN_ANNOTATION);
+ uima::Type sentType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_SENTENCE_ANNOTATION);
+ uima::Type parType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_PARAGRAPH_ANNOTATION);
+// uima::Type docType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_DOCUMENT_ANNOTATION);
+ uima::Type placeType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_PLACE_NAME_ANNOTATION);
+ uima::Type lexType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_LEXICAL_ANNOTATION);
+ uima::Type docStructType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_DOC_STRUCTURE_ANNOTATION);
+ uima::Type nameType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_NAME_ANNOTATION);
+ uima::Type mulTokType = rTCAS.getTypeSystem().getType(uima::TT::TYPE_NAME_MULTI_TOKEN_ANNOTATION);
+ FSIndex ix = rTCAS.getIndexRepository().getIndex("TestIndex", annType);
+ FSIterator it = ix.iterator();
+
+ size_t i=0;
+ vector<uima::Type> types;
+ for (it.moveToFirst(); it.isValid(); it.moveToNext() ) {
+ AnnotationFS annFS = (AnnotationFS) it.get();
+ LOG("Annotation " << annFS.getType().getName());
+ if (annFS.getBeginPosition() == 0) {
+ types.push_back( it.get().getType() );
+ LOG("Type " << i << ": " << types[i].getName() );
+ ++i;
+ }
+ }
+
+ /*
+ Normally longer annots come first when starting at same position.
+ Override this for token (lextype) over sent & para (docstructtype)
+ */
+ checkPriority( types, lexType, docStructType);
+
+ // Override again for sentence over paragraph
+ checkPriority( types, sentType, parType );
+
+}
+
+/* ----------------------------------------------------------------------- */
+/* Main routine */
+/* ----------------------------------------------------------------------- */
+
+int main(int argc, char * argv[]) /*
+---------------------------------- */
+{
+ LOG("UIMATEST_TYPE_PRIORITY started");
+ int iRetVal = 0;
+ try {
+ char const * config =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ "<taeDescription"
+ " xmlns=\"http://uima.apache.org/resourceSpecifier\""
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ " xsi:schemaLocation=\"http://uima.apache.org/resourceSpecifier http://uima.apache.org/resourceSpecifierSchema.xsd\""
+ " >"
+ " <frameworkImplementation>UIMA</frameworkImplementation>"
+ " <primitive>false</primitive>"
+ " <delegateAnalysisEngineSpecifiers>"
+ " <delegateAnalysisEngine key=\"frost\">"
+ //ee??? " <includeFile>tok.xml</includeFile>"
+ " <import location=\"tok.xml\" />"
+ " </delegateAnalysisEngine>"
+ /* ee - reducing number of annotators used for testing
+ " <delegateAnalysisEngine key=\"doxtract\">"
+ " <includeFile>doxtract.xml</includeFile>"
+ " </delegateAnalysisEngine>"
+ */
+ " <delegateAnalysisEngine key=\"dump\">"
+ //ee " <includeFile>dump.xml</includeFile>"
+ " <import location=\"dump.xml\" />"
+ " </delegateAnalysisEngine>"
+ " </delegateAnalysisEngineSpecifiers>"
+ " <analysisEngineMetaData>"
+ " <name>UIMAAnnotator</name>"
+ " <description></description>"
+ " <version>1.0</version>"
+ " <vendor>IBM Corporation</vendor>"
+ " <flowConstraints>"
+ " <fixedFlow>"
+ " <node>frost</node>"
+ //ee " <node>doxtract</node>"
+ " <node>dump</node>"
+ " </fixedFlow>"
+ " </flowConstraints>"
+ " <typePriorities>"
+
+ " <priorityList>"
+ " <type>uima.tt.LexicalAnnotation</type>"
+ " <type>uima.tt.DocStructureAnnotation</type>"
+ " </priorityList>"
+
+ " <priorityList>"
+ " <type>uima.tt.SentenceAnnotation</type> "
+ " <type>uima.tt.ParagraphAnnotation</type>"
+ " </priorityList>"
+ /*
+ " <priorityList>"
+ " <type>uima.tt.MultiTokenAnnotation</type>"
+ " <type>uima.tt.TokenAnnotation</type>"
+ " </priorityList>"
+ " <priorityList>"
+ " <type>uima.tt.TokenAnnotation</type>"
+ " <type>uima.tt.SentenceAnnotation</type>"
+ " <type>uima.tt.ParagraphAnnotation</type>"
+ " </priorityList>"
+ " <priorityList>"
+ " <type>uima.tt.TokenAnnotation</type>"
+ " <type>uima.tcas.DocumentAnnotation</type>"
+ " <type>uima.tt.ParagraphAnnotation</type>"
+ " </priorityList>"
+ " <priorityList>"
+ " <type>uima.tt.TokenAnnotation</type>"
+ " <type>uima.tt.PlaceName</type>"
+ " </priorityList>"
+ */
+ " </typePriorities>"
+ " <fsIndexCollection>"
+ " <imports> "
+ " <import location=\"tt_indexes.xml\"/>"
+ " </imports> "
+ " <fsIndexes> "
+ " <fsIndexDescription>"
+ " <label>TestIndex</label>"
+ " <typeName>uima.tcas.Annotation</typeName>"
+ " <kind>sorted</kind>"
+ " <keys>"
+ " <fsIndexKey>"
+ " <featureName>begin</featureName>"
+ " <comparator>standard</comparator>"
+ " </fsIndexKey>"
+ " <fsIndexKey>"
+ " <typePriority></typePriority>"
+ " </fsIndexKey>"
+ " </keys>"
+ " </fsIndexDescription>"
+ " </fsIndexes> "
+ " </fsIndexCollection> "
+ " <capabilities>"
+ " <capability>"
+ " <inputs></inputs>"
+ " <outputs>"
+ " <type>uima.tt.TokenAnnotation</type>"
+ " <type>uima.tt.SentenceAnnotation</type>"
+ " <type>uima.tt.ParagraphAnnotation</type>"
+ " <type>uima.tt.NameAnnotation</type>"
+ " </outputs>"
+ " <languagesSupported>"
+ " <language>en</language>"
+ " </languagesSupported>"
+ " </capability>"
+ " </capabilities>"
+ " </analysisEngineMetaData>"
+ "</taeDescription>";
+
+ icu::UnicodeString configUS(config);
+ UChar const * buf = configUS.getBuffer();
+ size_t len = configUS.length();
+
+ uima::ResourceManager::createInstance("test");
+
+ ErrorInfo errInfo;
+ uima::TextAnalysisEngine * pEngine = TextAnalysisEngine::createTextAnalysisEngine(buf, len, errInfo);
+ if (pEngine == NULL ) {
+ LOG("Error: " << errInfo.asString());
+ ASSERT_OR_THROWEXCEPTION(false);
+ }
+ ASSERT_OR_THROWEXCEPTION(EXISTS(pEngine));
+ ASSERT_OR_THROWEXCEPTION( errInfo.getErrorId() == UIMA_ERR_NONE );
+
+ CAS * tcas = pEngine->newCAS();
+ ASSERT_OR_THROWEXCEPTION( EXISTS(tcas) );
+
+ icu::UnicodeString us("London calling. The Clash.");
+ tcas->setDocumentText(us.getBuffer(), us.length());
+ tcas->getDocumentAnnotation().setLanguage("en");
+ TyErrorId err = pEngine->process(*tcas);
+ ASSERT_OR_THROWEXCEPTION( err == UIMA_ERR_NONE );
+
+ checkIndex( *tcas );
+
+ err = pEngine->destroy();
+ ASSERT_OR_THROWEXCEPTION( err == UIMA_ERR_NONE );
+
+ delete tcas;
+ delete pEngine;
+ LOG("UIMATEST_TYPE_PRIORITY finished");
+ } catch (Exception & exc) {
+ cerr << exc.asString() << endl;
+ iRetVal = 1;
+ } catch (...) {
+ cerr << "Unexpected exception " << endl;
+ iRetVal = 1;
+ }
+ return iRetVal;
+}
+
+/* <EOF> */
+
+
Propchange: incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.vcproj
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.vcproj?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.vcproj (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.vcproj Sat Feb 3 09:19:12 2007
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="test_typepriority"
+ ProjectGUID="{2A4A561A-F304-4280-9238-DD2C1C82F8AE}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(InputDir)\.."
+ IntermediateDirectory="..\Debug\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;"$(APR_HOME)\include";"$(ICU_HOME)\include";"$(XERCES_HOME)\include";"$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32";"$(UIMACPP_HOME)\include";"$(UIMACPP_HOME)\include\apr""
+ PreprocessorDefinitions="UIMA_SUPPRESS_TIMING;WIN32;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="xerces-c_2.lib icuuc.lib uimaD.lib"
+ OutputFile="$(OutDir)/test_typepriority.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(APR_HOME)\Debug";"$(XERCES_HOME)\lib";"$(ICU_HOME)\lib";"$(UIMACPP_HOME)\lib""
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(InputDir)\.."
+ IntermediateDirectory="..\Release\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories=".;"$(APR_HOME)\include";"$(ICU_HOME)\include";"$(XERCES_HOME)\include";"$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32";"$(UIMACPP_HOME)\include";"$(UIMACPP_HOME)\include\apr""
+ PreprocessorDefinitions="UIMA_SUPPRESS_TIMING;TRACEOFF;NDEBUG;WIN32;_CONSOLE"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="xerces-c_2.lib icuuc.lib uima.lib"
+ OutputFile="$(OutDir)/test_typepriority.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""$(APR_HOME)\Release";"$(XERCES_HOME)\lib";"$(ICU_HOME)\lib";"$(UIMACPP_HOME)\lib""
+ GenerateDebugInformation="FALSE"
+ ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="test_typepriority.cpp">
+ </File>
+ <File
+ RelativePath=".\tt_types.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Propchange: incubator/uima/uimacpp/trunk/src/test/src/test_typepriority.vcproj
------------------------------------------------------------------------------
svn:eol-style = CRLF
Added: incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.cpp?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.cpp (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.cpp Sat Feb 3 09:19:12 2007
@@ -0,0 +1,187 @@
+/** \file test_xcasdeserialization.cpp .
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Include dependencies */
+/* ----------------------------------------------------------------------- */
+#include "uima/api.hpp"
+#include "uima/xmlwriter.hpp"
+#include "uima/xcasdeserializer.hpp"
+#include "uima/casdefinition.hpp"
+
+#include <fstream>
+
+#ifndef NDEBUG
+#define ASSERT_OR_THROWEXCEPTION(x) assert(x)
+#else
+#define ASSERT_OR_THROWEXCEPTION(x) if (!(x)) { cerr << __FILE__ << ": Error in line " << __LINE__ << endl; exit(1); }
+#endif
+
+#define LOG(x) cout << __FILE__ << __LINE__ << ": " << x << endl
+
+using namespace uima;
+
+
+/* ----------------------------------------------------------------------- */
+/* Main routine */
+/* ----------------------------------------------------------------------- */
+
+int main(int argc, char * argv[]) /*
+---------------------------------- */
+{
+ LOG("UIMATEST_XCASSERIALIZATION started");
+ int iRetVal = 0;
+
+ try {
+
+ ResourceManager::createInstance("test");
+ ofstream outputStream;
+
+ TextAnalysisEngineSpecifierBuilder builder;
+ TextAnalysisEngineSpecifier apTAESpecifier;
+ UnicodeString dataFile("ExampleCas/testTae.xml");
+ UnicodeString datafn = ResourceManager::resolveFilename(dataFile, dataFile);
+ builder.buildTaeFromFile(apTAESpecifier, datafn);
+
+ internal::CASDefinition * casDef = internal::CASDefinition::createCASDefinition(*apTAESpecifier.getAnalysisEngineMetaData());
+ ErrorInfo errorInfo;
+ CAS* cas = Framework::createCAS(*casDef, errorInfo);
+ ASSERT_OR_THROWEXCEPTION( EXISTS(cas) );
+ CAS* v1cas = Framework::createCAS(*casDef, errorInfo);
+ ASSERT_OR_THROWEXCEPTION( EXISTS(v1cas) );
+
+ // get a v2 CAS
+ UnicodeString v2casFile("ExampleCas/cas.xml");
+ UnicodeString v2casfn = ResourceManager::resolveFilename(v2casFile, v2casFile);
+ XCASDeserializer::deserialize(v2casfn, *cas);
+
+ // get a v1.x version of the same CAS
+ UnicodeString v1casFile("ExampleCas/v1cas.xml");
+ UnicodeString v1casfn = ResourceManager::resolveFilename(v1casFile, v1casFile);
+ XCASDeserializer::deserialize(v1casfn, *v1cas);
+
+ // compare
+ ASSERT_OR_THROWEXCEPTION(cas->getAnnotationIndex().getSize() == v1cas->getAnnotationIndex().getSize());
+
+ // Serialize XCAS
+ outputStream.open("temp.xcas");
+ if ( !outputStream ) {
+ cerr << "Error opening output stream" << endl;
+ return 1;
+ }
+ XCASWriter writerx(*v1cas, false);
+ writerx.write(outputStream);
+ outputStream.close();
+
+ // Deserialize XCAS ...
+ v1cas->reset();
+ XCASDeserializer::deserialize("temp.xcas", *v1cas);
+
+ // ... and compare
+ ASSERT_OR_THROWEXCEPTION(cas->getAnnotationIndex().getSize() == v1cas->getAnnotationIndex().getSize());
+
+
+
+ //testNoInitialSofa
+ cas->reset();
+ // create non-annotation type so as not to create the _InitialView Sofa
+ IntArrayFS intArrayFS = cas->createIntArrayFS(5);
+ intArrayFS.set(0,1);
+ intArrayFS.set(1,2);
+ intArrayFS.set(2,3);
+ intArrayFS.set(3,4);
+ intArrayFS.set(4,5);
+ cas->getIndexRepository().addFS(intArrayFS);
+
+ // Serialize XCAS
+ outputStream.open("temp.xcas");
+ if ( !outputStream ) {
+ cerr << "Error opening output stream" << endl;
+ return 1;
+ }
+ XCASWriter writer(*cas, false);
+ writer.write(outputStream);
+ outputStream.close();
+
+ // Deserialize XCAS
+ cas->reset();
+ XCASDeserializer::deserialize("temp.xcas", *cas);
+
+ //TODO compare!
+
+
+
+// // now a v1.x version of a multiple Sofa CAS
+ v1cas->reset();
+ UnicodeString v1McasFile("ExampleCas/v1MultiSofaCas.xml");
+ UnicodeString v1Mcasfn = ResourceManager::resolveFilename(v1McasFile, v1McasFile);
+ XCASDeserializer::deserialize(v1Mcasfn, *v1cas);
+
+ // test it
+ CAS* engView = v1cas->getView("EnglishDocument");
+ ASSERT_OR_THROWEXCEPTION(0==engView->getDocumentText().compare("this beer is good"));
+ ASSERT_OR_THROWEXCEPTION(engView->getAnnotationIndex().getSize() == 5); // 4 annots plus documentAnnotation
+ CAS* gerView = v1cas->getView("GermanDocument");
+ ASSERT_OR_THROWEXCEPTION(0==gerView->getDocumentText().compare("das bier ist gut"));
+ ASSERT_OR_THROWEXCEPTION(gerView->getAnnotationIndex().getSize() == 5); // 4 annots plus documentAnnotation
+
+// // reserialize
+// StringWriter sw = new StringWriter();
+// XMLSerializer xmlSer = new XMLSerializer(sw, false);
+// XCASSerializer xcasSer = new XCASSerializer(v1cas.getTypeSystem());
+// xcasSer.serialize(v1cas, xmlSer.getContentHandler(), true);
+// String xml = sw.getBuffer().toString();
+
+// // deserialize into another CAS
+// cas.reset();
+// XCASDeserializer deser2 = new XCASDeserializer(cas.getTypeSystem());
+// ContentHandler deserHandler2 = deser2.getXCASHandler(cas);
+// xmlReader.setContentHandler(deserHandler2);
+// xmlReader.parse(new InputSource(new StringReader(xml)));
+
+// // test it
+// assertTrue(v1cas.getDocumentText().equals("some text for the default text sofa."));
+// engView = cas.getView("EnglishDocument");
+// assertTrue(engView.getDocumentText().equals("this beer is good"));
+// assertTrue(engView.getAnnotationIndex().size() == 5); // 4 annots plus documentAnnotation
+// gerView = cas.getView("GermanDocument");
+// assertTrue(gerView.getDocumentText().equals("das bier ist gut"));
+// assertTrue(gerView.getAnnotationIndex().size() == 5); // 4 annots plus documentAnnotation
+
+
+
+
+ delete cas;
+ delete v1cas;
+ LOG("UIMATEST_XCASSERIALIZATION finished");
+
+ } catch (Exception & exc) {
+ cerr << exc.asString() << endl;
+ iRetVal = 1;
+ } catch (...) {
+ cerr << "Unexpected exception " << endl;
+ iRetVal = 1;
+ }
+
+ return iRetVal;
+}
+
+/* <EOF> */
Propchange: incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.vcproj
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.vcproj?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.vcproj (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.vcproj Sat Feb 3 09:19:12 2007
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="test_xcasdeserialization"
+ ProjectGUID="{2A4A561A-F304-4280-9238-DD2C1C82F8AE}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(InputDir)\.."
+ IntermediateDirectory="..\Debug\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;"$(APR_HOME)\include";"$(ICU_HOME)\include";"$(XERCES_HOME)\include";"$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32";"$(UIMACPP_HOME)\include";"$(UIMACPP_HOME)\include\apr""
+ PreprocessorDefinitions="UIMA_SUPPRESS_TIMING;WIN32;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="xerces-c_2.lib icuuc.lib uimaD.lib"
+ OutputFile="$(OutDir)/test_xcasdeserialization.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(APR_HOME)\Debug";"$(XERCES_HOME)\lib";"$(ICU_HOME)\lib";"$(UIMACPP_HOME)\lib""
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(InputDir)\.."
+ IntermediateDirectory="..\Release\$(ProjectName)"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ AdditionalIncludeDirectories=".;"$(APR_HOME)\include";"$(ICU_HOME)\include";"$(XERCES_HOME)\include";"$(JAVA_HOME)\include";"$(JAVA_HOME)\include\win32";"$(UIMACPP_HOME)\include";"$(UIMACPP_HOME)\include\apr""
+ PreprocessorDefinitions="UIMA_SUPPRESS_TIMING;TRACEOFF;NDEBUG;WIN32;_CONSOLE"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="xerces-c_2.lib icuuc.lib uima.lib"
+ OutputFile="$(OutDir)/test_xcasdeserialization.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""$(APR_HOME)\Release";"$(XERCES_HOME)\lib";"$(ICU_HOME)\lib";"$(UIMACPP_HOME)\lib""
+ GenerateDebugInformation="FALSE"
+ ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="test_xcasdeserialization.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Propchange: incubator/uima/uimacpp/trunk/src/test/src/test_xcasdeserialization.vcproj
------------------------------------------------------------------------------
svn:eol-style = CRLF
Added: incubator/uima/uimacpp/trunk/src/test/src/tt_types.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/tt_types.cpp?view=auto&rev=503265
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/tt_types.cpp (added)
+++ incubator/uima/uimacpp/trunk/src/test/src/tt_types.cpp Sat Feb 3 09:19:12 2007
@@ -0,0 +1,293 @@
+/** \file tt_types.cpp .
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-------------------------------------------------------------------------- */
+
+
+/* ----------------------------------------------------------------------- */
+/* Include dependencies */
+/* ----------------------------------------------------------------------- */
+#include "uima/tt_types.hpp"
+#include "uima/cas.hpp"
+
+/* ----------------------------------------------------------------------- */
+/* Constants */
+/* ----------------------------------------------------------------------- */
+#define UIMA_NAMESPACE "uima"
+#define UIMA_TT_NAMESPACE UIMA_NAMESPACE UIMA_NAMESPACE_SEPARATOR "tt"
+#define UIMA_TT_PFX UIMA_TT_NAMESPACE UIMA_NAMESPACE_SEPARATOR
+
+// type defines
+#define DOCUMENT_ANNOTATION "uima.tcas.DocumentAnnotation"
+#define DOC_STRUCTURE_ANNOTATION UIMA_TT_PFX "DocStructureAnnotation"
+#define KEY_STRING_ENTRY UIMA_TT_PFX "KeyStringEntry"
+#define LEXICAL_ANNOTATION UIMA_TT_PFX "LexicalAnnotation"
+#define LANGUAGE_CONFIDENCE_PAIR UIMA_TT_PFX "LanguageConfidencePair"
+#define TOKEN_ANNOTATION UIMA_TT_PFX "TokenAnnotation"
+#define SENTENCE_ANNOTATION UIMA_TT_PFX "SentenceAnnotation"
+#define PARAGRAPH_ANNOTATION UIMA_TT_PFX "ParagraphAnnotation"
+#define LEMMA UIMA_TT_PFX "Lemma"
+#define CANONICAL_FORM UIMA_TT_PFX "CanonicalForm"
+#define CATEGORY_CONFIDENCE_PAIR UIMA_TT_PFX "CategoryConfidencePair"
+#define TT_ANNOTATION UIMA_TT_PFX "TTAnnotation"
+
+// feature defines
+#define DOCUMENT_ID "id"
+#define MARKUP_TAG "markupTag"
+#define DOCUMENT_CATEGORIES "categories"
+#define KEY "key"
+#define LEX_CANONICAL_FORM "lexCanonicalForm"
+#define LEX_CANONICAL_FORM_CONFIDENCE "lexCanonicalFormConfidence"
+#define DOCUMENT_LANGUAGE "language"
+#define DOCUMENT_LANGUAGE_AS_UIMA_NBR "languageAsUIMANbr"
+#define DOCUMENT_LANGUAGE_CANDIDATES "languageCandidates"
+#define LANGUAGE_CONFIDENCE "languageConfidence"
+#define LANGUAGE_ID "languageID"
+#define INFLECTED_FORMS "inflectedForms"
+#define SPELL_AID "spellAid"
+#define POSITIVE_SENTENCE_SCORES_LIST "positiveSentenceScoresList"
+#define NEGATIVE_SENTENCE_SCORES_LIST "negativeSentenceScoresList"
+#define POSITIVE_KEYWORD_SCORES_LIST "positiveKeywordScoresList"
+#define NEGATIVE_KEYWORD_SCORES_LIST "negativeKeywordScoresList"
+#define DOCUMENT_KEYWORDS "keywords"
+#define DOCUMENT_SUMMARY "summary"
+#define PART_OF_SPEECH "partOfSpeech"
+#define LEMMA_ENTRIES "lemmaEntries"
+#define CANONICAL_FORM_FREQUENCY "canonicalFormFrequency"
+#define STOPWORD_TOKEN "stopwordToken"
+#define CATEGORY_CONFIDENCE "categoryConfidence"
+#define CATEGORY_STRING "categoryString"
+#define SENTENCE_NUMBER "sentenceNumber"
+#define CANONICAL_FORM_KIND "canonicalFormKind"
+#define UNISYN "uniSyn"
+#define UNIMORPH "uniMorph"
+#define MORPHID "morphID"
+#define TOPIC_SEGMENT_ANNOTATION UIMA_TT_PFX "TopicSegmentAnnotation"
+
+
+namespace uima {
+ char const * TT::NAME_SPACE_UIMA = UIMA_NAMESPACE;
+ char const * TT::NAME_SPACE_UIMA_TT = UIMA_TT_NAMESPACE;
+
+ char const * TT::TYPE_NAME_TT_ANNOTATION = TT_ANNOTATION;
+ char const * TT::TYPE_NAME_TOKEN_ANNOTATION = TOKEN_ANNOTATION;
+ char const * TT::TYPE_NAME_SENTENCE_ANNOTATION = SENTENCE_ANNOTATION;
+ char const * TT::TYPE_NAME_PARAGRAPH_ANNOTATION = PARAGRAPH_ANNOTATION;
+ char const * TT::TYPE_NAME_KEY_STRING_ENTRY = KEY_STRING_ENTRY;
+ char const * TT::TYPE_NAME_LEMMA = LEMMA;
+ char const * TT::TYPE_NAME_TOPIC_SEGMENT_ANNOTATION= TOPIC_SEGMENT_ANNOTATION;
+ char const * TT::TYPE_NAME_CANONICAL_FORM = CANONICAL_FORM;
+ char const * TT::TYPE_NAME_TERM_ANNOTATION = UIMA_TT_PFX "TermAnnotation";
+ char const * TT::TYPE_NAME_ABBREVIATION_ANNOTATION = UIMA_TT_PFX "AbbreviationAnnotation";
+ char const * TT::TYPE_NAME_NAME_ANNOTATION = UIMA_TT_PFX "NameAnnotation";
+ char const * TT::TYPE_NAME_PERSON_NAME_ANNOTATION = UIMA_TT_PFX "PersonName";
+ char const * TT::TYPE_NAME_PLACE_NAME_ANNOTATION = UIMA_TT_PFX "PlaceName";
+ char const * TT::TYPE_NAME_ORG_NAME_ANNOTATION = UIMA_TT_PFX "OrgName";
+ char const * TT::TYPE_NAME_MISC_NAME_ANNOTATION = UIMA_TT_PFX "MiscName";
+ char const * TT::TYPE_NAME_EXPRESSION_ANNOTATION = UIMA_TT_PFX "ExpressionAnnotation";
+ char const * TT::TYPE_NAME_MONETARY_EXPRESSION_ANNOTATION = UIMA_TT_PFX "MonetaryExpression";
+ char const * TT::TYPE_NAME_DATE_EXPRESSION_ANNOTATION = UIMA_TT_PFX "DateExpression";
+ char const * TT::TYPE_NAME_TIME_EXPRESSION_ANNOTATION = UIMA_TT_PFX "TimeExpression";
+ char const * TT::TYPE_NAME_ORDINAL_EXPRESSION_ANNOTATION = UIMA_TT_PFX "OrdinalExpression";
+ char const * TT::TYPE_NAME_CARDINAL_EXPRESSION_ANNOTATION = UIMA_TT_PFX "CardinalExpression";
+ char const * TT::TYPE_NAME_PERCENT_EXPRESSION_ANNOTATION = UIMA_TT_PFX "PercentExpression";
+ char const * TT::TYPE_NAME_SECTION_ANNOTATION = UIMA_TT_PFX "SectionAnnotation";
+ char const * TT::TYPE_NAME_SYNONYM = UIMA_TT_PFX "Synonym";
+ char const * TT::TYPE_NAME_COMP_PART_ANNOTATION = UIMA_TT_PFX "CompPartAnnotation";
+ char const * TT::TYPE_NAME_LEXICAL_ANNOTATION = LEXICAL_ANNOTATION;
+ char const * TT::TYPE_NAME_SYNTACTIC_ANNOTATION = UIMA_TT_PFX "SyntacticAnnotation";
+ char const * TT::TYPE_NAME_DOC_STRUCTURE_ANNOTATION = DOC_STRUCTURE_ANNOTATION;
+ char const * TT::TYPE_NAME_DISCOURSE_ANNOTATION = UIMA_TT_PFX "DiscourseAnnotation";
+ char const * TT::TYPE_NAME_MARKUP_ANNOTATION = UIMA_TT_PFX "MarkupAnnotation";
+ char const * TT::TYPE_NAME_TITLE_MARKUP = UIMA_TT_PFX "TitleMarkup";
+ char const * TT::TYPE_NAME_HEADING_MARKUP = UIMA_TT_PFX "HeadingMarkup";
+ char const * TT::TYPE_NAME_LIST_MARKUP = UIMA_TT_PFX "ListMarkup";
+ char const * TT::TYPE_NAME_UNORDERED_LIST_MARKUP = UIMA_TT_PFX "UnorderedListMarkup";
+ char const * TT::TYPE_NAME_ORDERED_LIST_MARKUP = UIMA_TT_PFX "OrderedListMarkup";
+ char const * TT::TYPE_NAME_TABLE_MARKUP = UIMA_TT_PFX "TableMarkup";
+ char const * TT::TYPE_NAME_CAPTION_MARKUP = UIMA_TT_PFX "CaptionMarkup";
+ char const * TT::TYPE_NAME_MISC_MARKUP = UIMA_TT_PFX "MiscMarkup";
+ char const * TT::TYPE_NAME_MULTI_TOKEN_ANNOTATION = UIMA_TT_PFX "MultiTokenAnnotation";
+ char const * TT::TYPE_NAME_CATEGORY_CONFIDENCE_PAIR = CATEGORY_CONFIDENCE_PAIR;
+ char const * TT::TYPE_NAME_LANGUAGE_CONFIDENCE_PAIR = LANGUAGE_CONFIDENCE_PAIR;
+ char const * TT::TYPE_NAME_RELATION = UIMA_TT_PFX "Relation";
+
+ char const * TT::TYPE_NAME_UNILEX = UIMA_TT_PFX "Unilex";
+ char const * TT::TYPE_NAME_CLAUSAL_ANNOTATION = UIMA_TT_PFX "ClausalAnnotation";
+ char const * TT::TYPE_NAME_INTENDED_SUMMARY = UIMA_TT_PFX "SUM_IntendedSummary";
+
+
+ char const * TT::FEATURE_BASE_NAME_LEMMA_ENTRIES = LEMMA_ENTRIES;
+ char const * TT::FEATURE_FULL_NAME_LEMMA_ENTRIES = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR LEMMA_ENTRIES;
+
+#define TOKEN_NUMBER "tokenNumber"
+ char const * TT::FEATURE_BASE_NAME_TOKEN_NUMBER = TOKEN_NUMBER;
+ char const * TT::FEATURE_FULL_NAME_TOKEN_NUMBER = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR TOKEN_NUMBER ;
+
+#define TOKEN_PROPERTIES "tokenProperties"
+ char const * TT::FEATURE_BASE_NAME_TOKEN_PROPERTIES = TOKEN_PROPERTIES;
+ char const * TT::FEATURE_FULL_NAME_TOKEN_PROPERTIES = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR TOKEN_PROPERTIES;
+
+ char const * TT::FEATURE_BASE_NAME_STOPWORD_TOKEN = STOPWORD_TOKEN;
+ char const * TT::FEATURE_FULL_NAME_STOPWORD_TOKEN = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR STOPWORD_TOKEN;
+
+ char const * TT::FEATURE_BASE_NAME_SENTENCE_NUMBER = SENTENCE_NUMBER;
+ char const * TT::FEATURE_FULL_NAME_SENTENCE_NUMBER = SENTENCE_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR SENTENCE_NUMBER;
+
+#define PARAGRAPH_NUMBER "paragraphNumber"
+ char const * TT::FEATURE_BASE_NAME_PARAGRAPH_NUMBER = PARAGRAPH_NUMBER;
+ char const * TT::FEATURE_FULL_NAME_PARAGRAPH_NUMBER = PARAGRAPH_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR PARAGRAPH_NUMBER;
+
+ char const * TT::FEATURE_BASE_NAME_KEY = KEY;
+ char const * TT::FEATURE_FULL_NAME_KEY = KEY_STRING_ENTRY UIMA_TYPE_FEATURE_SEPARATOR KEY;
+
+ char const * TT::FEATURE_BASE_NAME_PART_OF_SPEECH = PART_OF_SPEECH;
+ char const * TT::FEATURE_FULL_NAME_PART_OF_SPEECH = LEMMA UIMA_TYPE_FEATURE_SEPARATOR PART_OF_SPEECH;
+
+ char const * TT::FEATURE_BASE_NAME_MORPH_ID = MORPHID;
+ char const * TT::FEATURE_FULL_NAME_MORPH_ID = LEMMA UIMA_TYPE_FEATURE_SEPARATOR MORPHID;
+
+ char const * TT::FEATURE_BASE_NAME_DOCUMENT_LANGUAGE_AS_UIMA_NBR = DOCUMENT_LANGUAGE_AS_UIMA_NBR;
+ char const * TT::FEATURE_FULL_NAME_DOCUMENT_LANGUAGE_AS_UIMA_NBR = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_LANGUAGE_AS_UIMA_NBR;
+
+ char const * TT::FEATURE_BASE_NAME_DOCUMENT_ID = DOCUMENT_ID;
+ char const * TT::FEATURE_FULL_NAME_DOCUMENT_ID = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_ID;
+
+ char const * TT::FEATURE_BASE_NAME_MARKUP_TAG = MARKUP_TAG;
+ char const * TT::FEATURE_FULL_NAME_MARKUP_TAG = DOC_STRUCTURE_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR MARKUP_TAG;
+
+#define SYNONYM_ENTRIES "synonymEntries"
+ char const * TT::FEATURE_BASE_NAME_SYNONYM_ENTRIES = SYNONYM_ENTRIES;
+ char const * TT::FEATURE_FULL_NAME_SYNONYM_ENTRIES = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR SYNONYM_ENTRIES;
+
+#define PARENT "parent"
+ char const * TT::FEATURE_BASE_NAME_PARENT = PARENT;
+ char const * TT::FEATURE_FULL_NAME_PARENT = TT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR PARENT;
+
+#define CHILDREN "children"
+ char const * TT::FEATURE_BASE_NAME_CHILDREN = CHILDREN;
+ char const * TT::FEATURE_FULL_NAME_CHILDREN = TT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR CHILDREN;
+
+ char const * TT::FEATURE_BASE_NAME_INFLECTED_FORMS = INFLECTED_FORMS;
+ char const * TT::FEATURE_FULL_NAME_INFLECTED_FORMS = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR INFLECTED_FORMS;
+
+ char const * TT::FEATURE_BASE_NAME_SPELL_AID = SPELL_AID;
+ char const * TT::FEATURE_FULL_NAME_SPELL_AID = TOKEN_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR SPELL_AID;
+
+ char const * TT::FEATURE_BASE_NAME_DOCUMENT_SUMMARY = DOCUMENT_SUMMARY;
+ char const * TT::FEATURE_FULL_NAME_DOCUMENT_SUMMARY = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_SUMMARY;
+
+ char const * TT::FEATURE_BASE_NAME_DOCUMENT_KEYWORDS = DOCUMENT_KEYWORDS;
+ char const * TT::FEATURE_FULL_NAME_DOCUMENT_KEYWORDS = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_KEYWORDS;
+
+ char const * TT::FEATURE_BASE_NAME_POSITIVE_SENTENCE_SCORES_LIST = POSITIVE_SENTENCE_SCORES_LIST;
+ char const * TT::FEATURE_FULL_NAME_POSITIVE_SENTENCE_SCORES_LIST = SENTENCE_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR POSITIVE_SENTENCE_SCORES_LIST;
+
+ char const * TT::FEATURE_BASE_NAME_NEGATIVE_SENTENCE_SCORES_LIST = NEGATIVE_SENTENCE_SCORES_LIST;
+ char const * TT::FEATURE_FULL_NAME_NEGATIVE_SENTENCE_SCORES_LIST = SENTENCE_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR NEGATIVE_SENTENCE_SCORES_LIST;
+
+ char const * TT::FEATURE_BASE_NAME_POSITIVE_KEYWORD_SCORES_LIST = POSITIVE_KEYWORD_SCORES_LIST;
+ char const * TT::FEATURE_FULL_NAME_POSITIVE_KEYWORD_SCORES_LIST = LEXICAL_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR POSITIVE_KEYWORD_SCORES_LIST;
+
+ char const * TT::FEATURE_BASE_NAME_NEGATIVE_KEYWORD_SCORES_LIST = NEGATIVE_KEYWORD_SCORES_LIST;
+ char const * TT::FEATURE_FULL_NAME_NEGATIVE_KEYWORD_SCORES_LIST = LEXICAL_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR NEGATIVE_KEYWORD_SCORES_LIST;
+
+ char const * TT::FEATURE_BASE_NAME_DOCUMENT_CATEGORIES = DOCUMENT_CATEGORIES;
+ char const * TT::FEATURE_FULL_NAME_DOCUMENT_CATEGORIES = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_CATEGORIES;
+
+ char const * TT::FEATURE_BASE_NAME_CATEGORY_STRING = CATEGORY_STRING;
+ char const * TT::FEATURE_FULL_NAME_CATEGORY_STRING = CATEGORY_CONFIDENCE_PAIR UIMA_TYPE_FEATURE_SEPARATOR CATEGORY_STRING;
+
+ char const * TT::FEATURE_BASE_NAME_CATEGORY_CONFIDENCE = CATEGORY_CONFIDENCE;
+ char const * TT::FEATURE_FULL_NAME_CATEGORY_CONFIDENCE = CATEGORY_CONFIDENCE_PAIR UIMA_TYPE_FEATURE_SEPARATOR CATEGORY_CONFIDENCE;
+
+ char const * TT::FEATURE_BASE_NAME_DOCUMENT_LANGUAGE_CANDIDATES = DOCUMENT_LANGUAGE_CANDIDATES;
+ char const * TT::FEATURE_FULL_NAME_DOCUMENT_LANGUAGE_CANDIDATES = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_LANGUAGE_CANDIDATES;
+
+ char const * TT::FEATURE_BASE_NAME_LANGUAGE_CONFIDENCE = LANGUAGE_CONFIDENCE;
+ char const * TT::FEATURE_FULL_NAME_LANGUAGE_CONFIDENCE = LANGUAGE_CONFIDENCE_PAIR UIMA_TYPE_FEATURE_SEPARATOR LANGUAGE_CONFIDENCE;
+
+ char const * TT::FEATURE_BASE_NAME_LANGUAGE_ID = LANGUAGE_ID;
+ char const * TT::FEATURE_FULL_NAME_LANGUAGE_ID = LANGUAGE_CONFIDENCE_PAIR UIMA_TYPE_FEATURE_SEPARATOR LANGUAGE_ID;
+
+#define TOPIC_SEGMENT_NUMBER "topicSegmentNumber"
+ char const * TT::FEATURE_BASE_NAME_TOPIC_SEGMENT_NUMBER= TOPIC_SEGMENT_NUMBER;
+ char const * TT::FEATURE_FULL_NAME_TOPIC_SEGMENT_NUMBER= TOPIC_SEGMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR TOPIC_SEGMENT_NUMBER;
+
+ char const * TT::FEATURE_BASE_NAME_LEX_CANONICAL_FORM = LEX_CANONICAL_FORM;
+ char const * TT::FEATURE_FULL_NAME_LEX_CANONICAL_FORM = LEXICAL_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR LEX_CANONICAL_FORM;
+
+ char const * TT::FEATURE_BASE_NAME_LEX_CANONICAL_FORM_CONFIDENCE = LEX_CANONICAL_FORM_CONFIDENCE;
+ char const * TT::FEATURE_FULL_NAME_LEX_CANONICAL_FORM_CONFIDENCE = LEXICAL_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR LEX_CANONICAL_FORM_CONFIDENCE;
+
+ char const * TT::FEATURE_BASE_NAME_CANONICAL_FORM_KIND = CANONICAL_FORM_KIND;
+ char const * TT::FEATURE_FULL_NAME_CANONICAL_FORM_KIND = CANONICAL_FORM UIMA_TYPE_FEATURE_SEPARATOR CANONICAL_FORM_KIND;
+
+ char const * TT::FEATURE_BASE_NAME_CANONICAL_FORM_FREQUENCY = CANONICAL_FORM_FREQUENCY;
+ char const * TT::FEATURE_FULL_NAME_CANONICAL_FORM_FREQUENCY = CANONICAL_FORM UIMA_TYPE_FEATURE_SEPARATOR CANONICAL_FORM_FREQUENCY;
+
+ char const * TT::FEATURE_BASE_NAME_RELATION_ARGUMENTS = "relationArguments";
+
+ char const * TT::FEATURE_BASE_NAME_RELATION_NAME = "relationName";
+
+ char const * TT::FEATURE_BASE_NAME_RELATION_FREQUENCY = "relationFrequency";
+
+ char const * TT::FEATURE_BASE_NAME_UNISYN = UNISYN;
+ char const * TT::FEATURE_FULL_NAME_UNISYN = LEMMA UIMA_TYPE_FEATURE_SEPARATOR UNISYN;
+
+ char const * TT::FEATURE_BASE_NAME_UNIMORPH = UNIMORPH;
+ char const * TT::FEATURE_FULL_NAME_UNIMORPH = LEMMA UIMA_TYPE_FEATURE_SEPARATOR UNIMORPH;
+
+#define DOCUMENT_META_NAME "xml_DocumentMetaName"
+ char const * TT::FEATURE_BASE_NAME_XML_DOCUMENT_META_NAME = DOCUMENT_META_NAME;
+ char const * TT::FEATURE_FULL_NAME_XML_DOCUMENT_META_NAME = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_META_NAME;
+
+#define DOCUMENT_META_CONTENT "xml_DocumentMetaContent"
+ char const * TT::FEATURE_BASE_NAME_XML_DOCUMENT_META_CONTENT = DOCUMENT_META_CONTENT;
+ char const * TT::FEATURE_FULL_NAME_XML_DOCUMENT_META_CONTENT = DOCUMENT_ANNOTATION UIMA_TYPE_FEATURE_SEPARATOR DOCUMENT_META_CONTENT;
+
+
+ char const * TT::ANNOSFX = "Annotation";
+
+
+ char const * TT::INDEXID_LEMMA = "LemmaIndex";
+ char const * TT::INDEXID_CANONICALFORM = "CanonicalFormIndex";
+ char const * TT::INDEXID_RELATION = "RelationIndex";
+ char const * TT::INDEXID_SYNONYM = "SynonymIndex";
+
+}
+
+
+/* ----------------------------------------------------------------------- */
+/* Forward declarations */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Types / Classes */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* Implementation */
+/* ----------------------------------------------------------------------- */
+
+
+/* ----------------------------------------------------------------------- */
+
+
+
Propchange: incubator/uima/uimacpp/trunk/src/test/src/tt_types.cpp
------------------------------------------------------------------------------
svn:eol-style = native