ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1641646 - in /ctakes/branches/ctakes-3.2.1/ctakes-ytex: scripts/build-setup.xml src/main/java/org/apache/ctakes/ytex/kernel/metric/ConceptSimilarityServiceImpl.java src/main/java/org/apache/ctakes/ytex/weka/GramMatrixExporterImpl.java
Date Tue, 25 Nov 2014 16:18:26 GMT
Author: chenpei
Date: Tue Nov 25 16:18:26 2014
New Revision: 1641646

URL: http://svn.apache.org/r1641646
Log:
#CTAKES-337 updgrade jsp-api version to avoid class conflict. #CTAKES-334 fix getter. (FROM
TRUNK)

Modified:
    ctakes/branches/ctakes-3.2.1/ctakes-ytex/scripts/build-setup.xml
    ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/ConceptSimilarityServiceImpl.java
    ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/weka/GramMatrixExporterImpl.java

Modified: ctakes/branches/ctakes-3.2.1/ctakes-ytex/scripts/build-setup.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-ytex/scripts/build-setup.xml?rev=1641646&r1=1641645&r2=1641646&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-ytex/scripts/build-setup.xml (original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-ytex/scripts/build-setup.xml Tue Nov 25 16:18:26 2014
@@ -72,6 +72,19 @@ Call with option -projecthelp for more i
 		<property name="umls.schema" value="${db.schema}" />
 		<mkdir dir="${config.generated.dir}" />
 	</target>
+	<target name="templateToConfig.extractTemplates" description="extractTemplateFiles" unless="ctakes.dev.mode">
+		<pathconvert property="res.jar" pathsep="${line.separator}">
+            <fileset dir="${ctakes.home}/lib">
+                <include name="ctakes-ytex-res-*.jar"/>
+            </fileset>
+        </pathconvert>
+		<echo>unpacking ytex templates from ${res.jar} to ${config.source.dir}</echo>
+		<unzip src="${res.jar}" dest="${config.source.dir}">
+			<patternset>
+				<include name="org/apache/ctakes/ytex/**/*.template.xml"/>
+			</patternset>
+		</unzip>
+	</target>
 	<target name="templateToConfig.updateConfig" depends="templateToConfig.init" description="update
config files">
 		<echo>config.source.dir = ${config.source.dir}</echo>
 		<echo>config.generated.dir = ${config.generated.dir}</echo>
@@ -130,7 +143,7 @@ Call with option -projecthelp for more i
 	<target name="deleteTestDb" description="delete the test hsql databse">
 		<delete dir="${test.hsqldb.dir}" quiet="true" />
 	</target>
-	<target name="templateToConfig" depends="templateToConfig.init,templateToConfig.updateConfig"
description="generate config files from templates using values specified in ytex.properties">
+	<target name="templateToConfig" depends="templateToConfig.init,templateToConfig.extractTemplates,templateToConfig.updateConfig"
description="generate config files from templates using values specified in ytex.properties">
 	</target>
 	<target name="test.setup" description="setup properties and database for unit tests"
depends="generateTestYtexProperties,templateToConfig,deleteTestDb">
 		<ant dir="data" target="all" inheritAll="true"/>

Modified: ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/ConceptSimilarityServiceImpl.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/ConceptSimilarityServiceImpl.java?rev=1641646&r1=1641645&r2=1641646&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/ConceptSimilarityServiceImpl.java
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/ConceptSimilarityServiceImpl.java
Tue Nov 25 16:18:26 2014
@@ -648,9 +648,15 @@ public class ConceptSimilarityServiceImp
 
 	@SuppressWarnings("unchecked")
 	private int getLCSFromCache(ConcRel cr1, ConcRel cr2, Set<String> lcses) {
-		OrderedPair<String> cacheKey = new OrderedPair<String>(
-				cr1.getConceptID(), cr2.getConceptID());
-		Element e = this.lcsCache.get(cacheKey);
+		StringBuilder cacheKeyBuilder = new StringBuilder(this.conceptGraphName);
+		cacheKeyBuilder
+				.append(cr1.getConceptID().compareTo(cr2.getConceptID()) < 0 ? cr1
+						.getConceptID() : cr2.getConceptID());
+		cacheKeyBuilder
+				.append(cr1.getConceptID().compareTo(cr2.getConceptID()) >= 0 ? cr2
+						.getConceptID() : cr1.getConceptID());
+		String cacheKey = cacheKeyBuilder.toString();
+		Element e = this.lcsCache != null ? this.lcsCache.get(cacheKey) : null;
 		if (e != null) {
 			// hit the cache - unpack the lcs
 			if (e.getObjectValue() != null) {
@@ -673,8 +679,10 @@ public class ConceptSimilarityServiceImp
 				}
 				val[1] = lcses;
 			}
-			e = new Element(cacheKey, val);
-			this.lcsCache.put(e);
+			if (this.lcsCache != null) {
+				e = new Element(cacheKey, val);
+				this.lcsCache.put(e);
+			}
 			return dist;
 		}
 	}

Modified: ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/weka/GramMatrixExporterImpl.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/weka/GramMatrixExporterImpl.java?rev=1641646&r1=1641645&r2=1641646&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/weka/GramMatrixExporterImpl.java
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/weka/GramMatrixExporterImpl.java
Tue Nov 25 16:18:26 2014
@@ -82,7 +82,7 @@ public class GramMatrixExporterImpl exte
 		this.jdbcTemplate = new JdbcTemplate(ds);
 	}
 
-	public DataSource getDataSource(DataSource ds) {
+	public DataSource getDataSource() {
 		return this.jdbcTemplate.getDataSource();
 	}
 



Mime
View raw message