From e1f7f3ee2025eac0f00a941192e9c38a82c8999b Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 4 Jul 2006 10:53:06 +0000
Subject: [PATCH] add lazy loading of feature_relationships
git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4492 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
artemis_sqlmap/Feature.xml | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/artemis_sqlmap/Feature.xml b/artemis_sqlmap/Feature.xml
index ac869db95..bfe711ed7 100644
--- a/artemis_sqlmap/Feature.xml
+++ b/artemis_sqlmap/Feature.xml
@@ -48,9 +48,14 @@
<result property="featureloc.fmin" column="fmin" nullValue="-999" />
<result property="featureloc.fmax" column="fmax" nullValue="-999" />
<result property="featureloc.strand" column="strand" nullValue="0" />
+ <result property="featureloc.phase" column="phase" nullValue="0" />
<result property="cvterm" column="type_id" select="selectCvterm" />
<result property="featurepropList" column="{schema=schema, feature_id=id}"
- select="selectFeatureProp" />
+ select="selectFeatureProp" />
+ <result property="featureRelationshipsForObjectId" column="{schema=schema, object_id=id}"
+ select="getFeatureRelationship" />
+ <result property="featureRelationshipsForSubjectId" column="{schema=schema, subject_id=id}"
+ select="getFeatureRelationship" />
<!--
<result property="featureprop.cvterm" column="prop_type_id" select="selectCvterm" />
<result property="featureprop.value" column="value" />
@@ -81,13 +86,38 @@
<result property="cvterm" column="type_id" select="selectCvterm" />
</resultMap>
+ <resultMap id="select-relationship"
+ class="uk.ac.sanger.artemis.chado.ChadoFeatureRelationship">
+ <result property="subject_id" column="subject_id" />
+ <result property="object_id" column="object_id" />
+ <result property="value" column="value" />
+ <result property="rank" column="rank" />
+ <result property="cvterm" column="type_id" select="selectCvterm" />
+ </resultMap>
+
+
+ <!-- select featureprops e.g. for lazy loading -->
<select id="selectFeatureProp" resultMap="select-product-result">
SELECT type_id, value, rank
FROM $schema$.featureprop
WHERE feature_id=#feature_id#
</select>
- <!-- get feature name -->
+ <!-- select feature_relationship -->
+ <select id="getFeatureRelationship" resultMap="select-relationship">
+ SELECT subject_id, object_id, type_id, value, rank
+ FROM $schema$.feature_relationship
+ WHERE
+ <dynamic>
+ <isNotNull property="object_id">
+ object_id=#object_id#
+ </isNotNull>
+ <isNotNull property="subject_id">
+ subject_id=#subject_id#
+ </isNotNull>
+ </dynamic>
+ </select>
+
<select id="getFeatureName" parameterClass="ChadoFeature"
resultClass="java.lang.String">
SELECT name
@@ -187,7 +217,8 @@
srcfeature_id,
fmin,
fmax,
- strand
+ strand,
+ phase
<!--
,fp.type_id AS prop_type_id
,fp.value
--
GitLab