ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vjapa...@apache.org
Subject svn commit: r1556425 - in /ctakes/branches/ytex/ctakes-ytex: scripts/data/ scripts/data/orcl/test/ scripts/data/orcl/uima/ scripts/data/orcl/umls/ src/test/java/org/apache/ctakes/ytex/ src/test/resources/org/apache/ctakes/ytex/
Date Wed, 08 Jan 2014 02:29:31 GMT
Author: vjapache
Date: Wed Jan  8 02:29:31 2014
New Revision: 1556425

URL: http://svn.apache.org/r1556425
Log:
oracle tests and scripts

Added:
    ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/index_view.sql
    ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/insert_view.template.sql
    ctakes/branches/ytex/ctakes-ytex/src/test/resources/org/apache/ctakes/ytex/ytex.orcl.properties
Removed:
    ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/create_view.template.sql
Modified:
    ctakes/branches/ytex/ctakes-ytex/scripts/data/build.xml
    ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/test/createdb.sql
    ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/uima/create_reference.sql
    ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/create_view.sql
    ctakes/branches/ytex/ctakes-ytex/src/test/java/org/apache/ctakes/ytex/ConceptDaoTest.java

Modified: ctakes/branches/ytex/ctakes-ytex/scripts/data/build.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/scripts/data/build.xml?rev=1556425&r1=1556424&r2=1556425&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/scripts/data/build.xml (original)
+++ ctakes/branches/ytex/ctakes-ytex/scripts/data/build.xml Wed Jan  8 02:29:31 2014
@@ -349,8 +349,8 @@ Database connection parameters are taken
 		<property name="sql.catalog" value="${db.name}" />
 		<property name="sql.schema" value="${db.schema}" />
 		<property name="sql.file" value="${sql.dir}/${sqlcmd.dir}/${sqlcmd.script}" />
-		<tempfile property="sql.src" suffix=".sql" destdir="${java.io.tmpdir}" />
-		<tempfile property="use.sql.file" suffix="use.sql" destdir="${java.io.tmpdir}" />
+		<tempfile property="sql.src" prefix="ytex" suffix=".sql" destdir="${java.io.tmpdir}"
/>
+		<tempfile property="use.sql.file" prefix="ytex" suffix="use.sql" destdir="${java.io.tmpdir}"
/>
 		<echo>execute ${sql.file}</echo>
 		<!-- <property name="sql.src" value="${java.io.tmpdir}/${sqlcmd.script}" /> -->
 		<if>
@@ -398,7 +398,7 @@ ${sql.delimiter}					
 				<if>
 					<equals arg1="${db.type}" arg2="orcl" />
 					<then>
-						<echo file="${java.io.tmpdir}/use.sql">
+						<echo file="${use.sql.file}">
 ALTER SESSION SET CURRENT_SCHEMA=${sql.schema}
 ${sql.delimiter}					
 </echo>

Modified: ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/test/createdb.sql
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/test/createdb.sql?rev=1556425&r1=1556424&r2=1556425&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/test/createdb.sql (original)
+++ ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/test/createdb.sql Wed Jan  8 02:29:31
2014
@@ -1,7 +1 @@
-alter session set container=PDBORCL;
-create tablespace TBS_YTEX_TEST datafile 'C:/code/data/oradata/orcl/TBS_YTEX_TEST.dbf' size
1M autoextend on online;
-create user ytex_test identified by ytex_test default tablespace TBS_YTEX_TEST;
-grant connect, resource to ytex_test;
-grant create materialized view to ytex_test;
-grant create view to ytex_test;
 

Modified: ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/uima/create_reference.sql
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/uima/create_reference.sql?rev=1556425&r1=1556424&r2=1556425&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/uima/create_reference.sql (original)
+++ ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/uima/create_reference.sql Wed Jan 
8 02:29:31 2014
@@ -10,8 +10,8 @@ create table hibernate_sequences (
 insert into hibernate_sequences(sequence_name, next_val) values ('document_id_sequence',
1);
 
 create table anno_base_sequence (
-	sequence_name varchar(100) not null,
-	next_val int not null default 1,
+	sequence_name varchar2(100) not null,
+	next_val int default 1 not null,
 	primary key (sequence_name)
 );
 insert into anno_base_sequence(sequence_name, next_val) values ('anno_base_id_sequence',
1);

Modified: ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/create_view.sql
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/create_view.sql?rev=1556425&r1=1556424&r2=1556425&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/create_view.sql (original)
+++ ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/create_view.sql Wed Jan  8 02:29:31
2014
@@ -1,37 +1,9 @@
-create table v_snomed_fword_lookup
-as
-select mrc.cui, t.tui, c.fword, c.fstem, c.tok_str, c.stem_str
-from umls_aui_fword c
-inner join ytex.MRCONSO mrc on c.aui = mrc.aui and mrc.SAB in ( 'SNOMEDCT', 'RXNORM')
-inner join 
-(
-	select cui, min(tui) tui
-	from ytex.MRSTY sty
-	where sty.tui in
-	(
-    /* diseasesAndDisordersTuis */
-    'T019', 'T020', 'T037', 'T046', 'T047', 'T048', 'T049', 'T050', 
-      'T190', 'T191', 'T033',
-    /* signAndSymptomTuis */
-    'T184',
-    /* anatomicalSitesTuis */
-    'T017', 'T029', 'T023', 'T030', 'T031', 'T022', 'T025', 'T026',
-        'T018', 'T021', 'T024',
-    /* medicationsAndDrugsTuis */
-     'T116', 'T195', 'T123', 'T122', 'T118', 'T103', 'T120', 'T104',
-        'T200', 'T111', 'T196', 'T126', 'T131', 'T125', 'T129', 'T130',
-        'T197', 'T119', 'T124', 'T114', 'T109', 'T115', 'T121', 'T192',
-        'T110', 'T127',
-	/* proceduresTuis */
-    'T060', 'T065', 'T058', 'T059', 'T063', 'T062', 'T061',
-    /* deviceTuis */
-    'T074', 'T075',
-    /* laboratoryTuis */
-    'T059'
-	)
-	group by cui
-) t on t.cui = mrc.cui
+create table v_snomed_fword_lookup (
+  cui char(8) not null,
+  tui char(8) null,
+  fword varchar2(70) not null,
+  fstem varchar2(70) null,
+  tok_str varchar2(250) not null,
+  stem_str varchar2(250) null
+)
 ;
-create index IX_vsnfl_cui on v_snomed_fword_lookup(cui);
-create index IX_vsnfl_fword on v_snomed_fword_lookup(fword);
-create index IX_vsnfl_fstem on v_snomed_fword_lookup(fstem);

Added: ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/index_view.sql
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/index_view.sql?rev=1556425&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/index_view.sql (added)
+++ ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/index_view.sql Wed Jan  8 02:29:31
2014
@@ -0,0 +1,3 @@
+create index IX_vsnfl_fword on v_snomed_fword_lookup (fword);
+create index IX_vsnfl_fstem on v_snomed_fword_lookup (fstem);
+create index IX_vsnfl_cui on v_snomed_fword_lookup (cui);

Added: ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/insert_view.template.sql
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/insert_view.template.sql?rev=1556425&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/insert_view.template.sql (added)
+++ ctakes/branches/ytex/ctakes-ytex/scripts/data/orcl/umls/insert_view.template.sql Wed Jan
 8 02:29:31 2014
@@ -0,0 +1,33 @@
+insert into v_snomed_fword_lookup
+select mrc.cui, t.tui, c.fword, c.fstem, c.tok_str, c.stem_str
+from umls_aui_fword c
+inner join @UMLS_SCHEMA@.MRCONSO mrc on c.aui = mrc.aui and mrc.SAB in ( 'SNOMEDCT', 'RXNORM')
+inner join 
+(
+	select cui, min(tui) tui
+	from @UMLS_SCHEMA@.MRSTY sty
+	where sty.tui in
+	(
+    /* diseasesAndDisordersTuis */
+    'T019', 'T020', 'T037', 'T046', 'T047', 'T048', 'T049', 'T050', 
+      'T190', 'T191', 'T033',
+    /* signAndSymptomTuis */
+    'T184',
+    /* anatomicalSitesTuis */
+    'T017', 'T029', 'T023', 'T030', 'T031', 'T022', 'T025', 'T026',
+        'T018', 'T021', 'T024',
+    /* medicationsAndDrugsTuis */
+     'T116', 'T195', 'T123', 'T122', 'T118', 'T103', 'T120', 'T104',
+        'T200', 'T111', 'T196', 'T126', 'T131', 'T125', 'T129', 'T130',
+        'T197', 'T119', 'T124', 'T114', 'T109', 'T115', 'T121', 'T192',
+        'T110', 'T127',
+	/* proceduresTuis */
+    'T060', 'T065', 'T058', 'T059', 'T063', 'T062', 'T061',
+    /* deviceTuis */
+    'T074', 'T075',
+    /* laboratoryTuis */
+    'T059'
+	)
+	group by cui
+) t on t.cui = mrc.cui
+;

Modified: ctakes/branches/ytex/ctakes-ytex/src/test/java/org/apache/ctakes/ytex/ConceptDaoTest.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/test/java/org/apache/ctakes/ytex/ConceptDaoTest.java?rev=1556425&r1=1556424&r2=1556425&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/test/java/org/apache/ctakes/ytex/ConceptDaoTest.java
(original)
+++ ctakes/branches/ytex/ctakes-ytex/src/test/java/org/apache/ctakes/ytex/ConceptDaoTest.java
Wed Jan  8 02:29:31 2014
@@ -29,28 +29,39 @@ public class ConceptDaoTest {
 
 	@Before
 	public void setUp() throws Exception {
-//		 ClassLoader cl = ClassLoader.getSystemClassLoader();
-//		 
-//		URL[] urls = ((URLClassLoader)cl).getURLs();
-//	 
-//	        for(URL url: urls){
-//	        	System.out.println(url.getFile());
-//	        }		
-//		URL is = this.getClass().getClassLoader().getResource("org/apache/ctakes/ytex/kernelBeanRefContext.xml");
-//		System.out.println(is);
+		// ClassLoader cl = ClassLoader.getSystemClassLoader();
+		//
+		// URL[] urls = ((URLClassLoader)cl).getURLs();
+		//
+		// for(URL url: urls){
+		// System.out.println(url.getFile());
+		// }
+		// URL is =
+		// this.getClass().getClassLoader().getResource("org/apache/ctakes/ytex/kernelBeanRefContext.xml");
+		// System.out.println(is);
 		appCtx = (ApplicationContext) ContextSingletonBeanFactoryLocator
-				.getInstance("classpath*:org/apache/ctakes/ytex/kernelBeanRefContext.xml")
+				.getInstance(
+						"classpath*:org/apache/ctakes/ytex/kernelBeanRefContext.xml")
 				.useBeanFactory("kernelApplicationContext").getFactory();
 		conceptDao = appCtx.getBean(ConceptDao.class);
 		JdbcTemplate jdbcTemplate = new JdbcTemplate();
 		jdbcTemplate.setDataSource(appCtx.getBean(DataSource.class));
-		Properties ytexProperties = (Properties)appCtx.getBean("ytexProperties");
+		Properties ytexProperties = (Properties) appCtx
+				.getBean("ytexProperties");
 		String dbtype = ytexProperties.getProperty("db.type");
-		if("hsql".equals(dbtype) || "mysql".equals(dbtype))
+		if ("hsql".equals(dbtype) || "mysql".equals(dbtype))
 			jdbcTemplate.execute("drop table if exists test_concepts");
-		if("mssql".equals(dbtype))
-			jdbcTemplate.execute("if exists(select * from sys.objects where object_id = object_id('test_concepts'))
drop table test_concepts");
-		//TODO if("orcl".equals(dbtype)))
+		if ("mssql".equals(dbtype))
+			jdbcTemplate
+					.execute("if exists(select * from sys.objects where object_id = object_id('test_concepts'))
drop table test_concepts");
+		if ("orcl".equals(dbtype)) {
+			// just try dropping the table, catch exception and hope all is well
+			try {
+				jdbcTemplate.execute("drop table test_concepts");
+			} catch (Exception ignore) {
+
+			}
+		}
 		jdbcTemplate
 				.execute("create table test_concepts(parent varchar(20), child varchar(20))");
 		jdbcTemplate
@@ -65,13 +76,13 @@ public class ConceptDaoTest {
 				.execute("insert into test_concepts values ('root', 'bacteria')");
 		jdbcTemplate
 				.execute("insert into test_concepts values ('bacteria', 'e coli')");
-		System.out.println("Create concept graph"); 
+		System.out.println("Create concept graph");
 		conceptDao.createConceptGraph(null, "test",
 				"select child, parent from test_concepts", true,
 				Collections.EMPTY_SET);
 		ConceptGraph cg = conceptDao.getConceptGraph("test");
 		Assert.notNull(cg);
-		((ConfigurableApplicationContext)appCtx).close();
+		((ConfigurableApplicationContext) appCtx).close();
 	}
 
 	@Test

Added: ctakes/branches/ytex/ctakes-ytex/src/test/resources/org/apache/ctakes/ytex/ytex.orcl.properties
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/test/resources/org/apache/ctakes/ytex/ytex.orcl.properties?rev=1556425&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/test/resources/org/apache/ctakes/ytex/ytex.orcl.properties
(added)
+++ ctakes/branches/ytex/ctakes-ytex/src/test/resources/org/apache/ctakes/ytex/ytex.orcl.properties
Wed Jan  8 02:29:31 2014
@@ -0,0 +1,31 @@
+# jdbc url for database.  
+# Replace localhost:1521:orcl with the host, port and service name/SID of your database
+# another format that works is e.g.: jdbc:oracle:thin:ytex/ytex@localhost:1521:orcl
+db.url=jdbc:oracle:thin:@localhost:1521:orcl
+
+# oracle username and password
+# user needs connect, resource, and create view privileges
+db.username=ytex_test
+db.password=ytex_test
+
+# database schema 
+# typically identical to username
+# alternatively, the user must have access to the schema
+db.schema=ytex_test
+
+# the schema where umls is installed
+# if not specified, will default to schema from ytex
+#umls.schema=umls
+
+
+# you should not have to modify anything below
+# hibernate database dialect
+# specify Oracle8iDialect, Oracle9iDialect, or Oracle10gDialect
+# can use Oracle10gDialect for Oracle11
+hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
+
+db.type=orcl
+db.driver=oracle.jdbc.driver.OracleDriver
+
+# transaction isolation level
+db.isolationLevel=READ_COMMITTED



Mime
View raw message