File: Organism.xml

package info (click to toggle)
artemis 17.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 112,044 kB
  • sloc: java: 451,938; sh: 3,370; xml: 2,292; makefile: 182; perl: 83; sql: 47
file content (94 lines) | stat: -rw-r--r-- 3,652 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="UTF-8" ?> 
 
<!DOCTYPE sqlMap 
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" 
    "http://ibatis.apache.org/dtd/sql-map-2.dtd"> 
 
<sqlMap namespace="Organism"> 
      
    <cacheModel id="organism-cache" type ="LRU" readOnly="true"> 
      <flushInterval hours="24"/>  
      <property name="cache-size" value="85" /> 
    </cacheModel> 
    
    <resultMap id="map-organism" class="org.gmod.schema.organism.Organism">
       <result property="organismId" column="organismId"/>
       <result property="abbreviation" column="abbreviation"/>
       <result property="commonName" column="commonName"/>
       <result property="genus" column="genus"/>
       <result property="species" column="species"/>
       <result property="comment" column="comment"/>
       <result property="organismProps" column="organismId" select="getOrganismPropByOrganismIdLazy"/>
    </resultMap>
    
    <select id="getOrganism" resultMap="map-organism" cacheModel="organism-cache"> 
      SELECT organism_id AS organismId, abbreviation, genus, species, common_name AS commonName, comment 
      FROM organism
      <dynamic>
        <isNotNull property="organismId">
			<isGreaterThan property="organismId" compareValue="0"> 
				WHERE organism_id=#organismId#
			    <isNotNull prepend="AND" property="commonName">
                    common_name=#commonName#
                </isNotNull>
			</isGreaterThan>
			
			<isLessEqual property="organismId" compareValue="0">
				<isNotNull prepend="WHERE" property="commonName">
                  common_name=#commonName#
                </isNotNull>
			</isLessEqual>
        </isNotNull>
		
		<isNull property="organismId">
	  	   <isNotNull prepend="WHERE" property="commonName">
             common_name=#commonName#
           </isNotNull>
		</isNull>
		  
        <isNull prepend="ORDER BY" property="organismId">
           commonName
        </isNull>
      </dynamic>
    </select> 
    
    
    <select id="getOrganismIdBySrcFeatureIdOrFeatureId" resultClass="java.lang.Integer" 
            parameterClass="org.gmod.schema.sequence.Feature" cacheModel="organism-cache">
      SELECT organism_id AS organismId FROM feature f WHERE
        <isGreaterThan property="featureLoc.featureBySrcFeatureId.featureId" compareValue="0"> 
             f.feature_id=$featureLoc.featureBySrcFeatureId.featureId$
        </isGreaterThan>
		<isEqual property="featureLoc.featureBySrcFeatureId.featureId" compareValue="0">
			<isGreaterThan property="featureId" compareValue="0"> 
				f.feature_id=$featureId$
			</isGreaterThan>
		</isEqual>
		<isNull property="featureLoc.featureBySrcFeatureId">
			f.feature_id=$featureId$
		</isNull>
    </select>
	
	<select id="getOrganismsContainingSrcFeatures" resultMap="map-organism">
	  SELECT DISTINCT ON( feature.organism_id )  
		organism.organism_id AS organismId, abbreviation, genus, species, common_name AS commonName, comment
		FROM feature 
		join  organism using (organism_id) 
		join cvterm on feature.type_id = cvterm.cvterm_id 
		WHERE residues notnull AND residues != '' 
		AND ( <include refid="source_feature_cvterm_names"/> ) 
	</select>
	
	<select id="getTopLevelOrganisms" resultMap="map-organism">
	  SELECT organism.organism_id AS organismId, abbreviation, genus, species, common_name AS commonName, comment
      FROM organism
      WHERE exists (
        SELECT *
        FROM organismprop
        JOIN cvterm on organismprop.type_id = cvterm.cvterm_id
        JOIN cv using (cv_id)
        WHERE organism_id = organism.organism_id
        AND cv.name = 'genedb_misc' and cvterm.name = 'populated' )
	</select>	
 
</sqlMap>