ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1717856 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
Date Thu, 03 Dec 2015 22:29:45 GMT
Author: seanfinan
Date: Thu Dec  3 22:29:44 2015
New Revision: 1717856

URL: http://svn.apache.org/viewvc?rev=1717856&view=rev
Log:
minor refactoring

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java?rev=1717856&r1=1717855&r2=1717856&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
Thu Dec  3 22:29:44 2015
@@ -76,6 +76,20 @@ final public class OntologyConceptUtil {
 
    /**
     * @param annotation -
+    * @return steram of OntologyConcept
+    */
+   static private Stream<OntologyConcept> getOntologyConceptStream( final IdentifiedAnnotation
annotation ) {
+      return Arrays.stream( getOntologyConcepts( annotation ) )
+            .filter( OntologyConcept.class::isInstance )
+//            .filter( isUmlsConcept.negate() )
+            .map( fs -> (OntologyConcept)fs )
+            .filter( isSchemeOk )
+            .filter( isCodeOk );
+   }
+
+
+   /**
+    * @param annotation -
     * @return set of all Umls Concepts associated with the annotation
     */
    static public Collection<UmlsConcept> getConcepts( final IdentifiedAnnotation annotation
) {
@@ -117,12 +131,7 @@ final public class OntologyConceptUtil {
     * @return map of ontology scheme names to a set of ontology codes associated each scheme
     */
    static public Map<String, Collection<String>> getSchemeCodes( final IdentifiedAnnotation
annotation ) {
-      return Arrays.stream( getOntologyConcepts( annotation ) )
-            .filter( OntologyConcept.class::isInstance )
-//            .filter( isUmlsConcept.negate() )
-            .map( fs -> (OntologyConcept)fs )
-            .filter( isSchemeOk )
-            .filter( isCodeOk )
+      return getOntologyConceptStream( annotation )
             .collect( Collectors.toMap( OntologyConcept::getCodingScheme, getCodeAsSet, mergeSets
) );
    }
 
@@ -131,12 +140,7 @@ final public class OntologyConceptUtil {
     * @return set of ontology codes associated with all schemes
     */
    static public Collection<String> getCodes( final IdentifiedAnnotation annotation
) {
-      return Arrays.stream( getOntologyConcepts( annotation ) )
-            .filter( OntologyConcept.class::isInstance )
-//            .filter( isUmlsConcept.negate() )
-            .map( fs -> (OntologyConcept)fs )
-            .filter( isSchemeOk )
-            .filter( isCodeOk )
+      return getOntologyConceptStream( annotation )
             .map( OntologyConcept::getCode )
             .collect( Collectors.toSet() );
    }
@@ -148,12 +152,8 @@ final public class OntologyConceptUtil {
     */
    static public Collection<String> getCodes( final IdentifiedAnnotation annotation,
                                               final String schemeName ) {
-      return Arrays.stream( getOntologyConcepts( annotation ) )
-            .filter( OntologyConcept.class::isInstance )
-//            .filter( isUmlsConcept.negate() )
-            .map( fs -> (OntologyConcept)fs )
+      return getOntologyConceptStream( annotation )
             .filter( concept -> schemeName.equalsIgnoreCase( concept.getCodingScheme()
) )
-            .filter( isCodeOk )
             .map( OntologyConcept::getCode )
             .collect( Collectors.toSet() );
    }
@@ -212,7 +212,7 @@ final public class OntologyConceptUtil {
 
    /**
     * @param jcas         -
-    * @param lookupWindow
+    * @param lookupWindow -
     * @return set of all cuis in jcas
     */
    static public <T extends Annotation> Collection<String> getCuis( final JCas
jcas, final T lookupWindow ) {
@@ -221,7 +221,7 @@ final public class OntologyConceptUtil {
 
    /**
     * @param jcas         -
-    * @param lookupWindow
+    * @param lookupWindow -
     * @return set of all tuis in jcas
     */
    static public <T extends Annotation> Collection<String> getTuis( final JCas
jcas, final T lookupWindow ) {
@@ -230,7 +230,7 @@ final public class OntologyConceptUtil {
 
    /**
     * @param jcas         -
-    * @param lookupWindow
+    * @param lookupWindow -
     * @return set of all tuis in jcas
     */
    static public <T extends Annotation> Map<String, Collection<String>>
getSchemeCodes( final JCas jcas,
@@ -240,7 +240,7 @@ final public class OntologyConceptUtil {
 
    /**
     * @param jcas         -
-    * @param lookupWindow
+    * @param lookupWindow -
     * @return set of all tuis in jcas
     */
    static public <T extends Annotation> Collection<String> getCodes( final JCas
jcas, final T lookupWindow ) {
@@ -249,7 +249,7 @@ final public class OntologyConceptUtil {
 
    /**
     * @param jcas         -
-    * @param lookupWindow
+    * @param lookupWindow -
     * @param schemeName   name of the scheme of interest
     * @return set of ontology codes associated the named scheme
     */



Mime
View raw message