From: <mg...@us...> - 2008-01-29 23:53:02
|
Revision: 1427 http://obo.svn.sourceforge.net/obo/?rev=1427&view=rev Author: mgibson Date: 2008-01-29 15:53:03 -0800 (Tue, 29 Jan 2008) Log Message: ----------- added methods the characterI for making comparsions Modified Paths: -------------- phenote/trunk/conf/birn-test.cfg phenote/trunk/src/java/phenote/datamodel/AbstractCharacter.java phenote/trunk/src/java/phenote/datamodel/AnnotationCharacter.java phenote/trunk/src/java/phenote/datamodel/CharacterI.java phenote/trunk/src/java/phenote/gui/CharacterTableController.java Modified: phenote/trunk/conf/birn-test.cfg =================================================================== --- phenote/trunk/conf/birn-test.cfg 2008-01-29 23:40:37 UTC (rev 1426) +++ phenote/trunk/conf/birn-test.cfg 2008-01-29 23:53:03 UTC (rev 1427) @@ -2,7 +2,8 @@ <ns:phenote-configuration version="1.4-beta2" name="BIRN Test Config 2" author="Nicole Washington" description="A test for finding a config for BIRN so I can test annotate from their spreadsheet. It includes their converted brain subcellular anatomy ontology (SAO)." xmlns:ns="phenote/config/xml"> <!-- this will have phenote use obo edit datamodel (testing out) --> - <ns:character-mode mode="OBO_ANNOTATION" mapping="phenote.datamodel.PhenotypeMapping"/> + <ns:character-mode mode="OBO_ANNOTATION" + mapping="phenote.datamodel.PhenotypeAssociationMappingDriver"/> <ns:comparison enable-statement-comparison="true"/> Modified: phenote/trunk/src/java/phenote/datamodel/AbstractCharacter.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/AbstractCharacter.java 2008-01-29 23:40:37 UTC (rev 1426) +++ phenote/trunk/src/java/phenote/datamodel/AbstractCharacter.java 2008-01-29 23:53:03 UTC (rev 1427) @@ -4,6 +4,7 @@ import org.apache.log4j.Logger; +import org.obo.annotation.datamodel.Annotation; import org.obo.datamodel.OBOClass; import org.obo.datamodel.OBOProperty; @@ -141,6 +142,13 @@ return false; return c1.equals(c2); } + + /** Whether or not datamodel has obo annotations, returns getOboAnnotation != + null, which is only true for AnnotationCharacter */ + public boolean hasOboAnnotation() { return getOboAnnotation() != null; } + + /** Return null by default - AnnotationCharacter overrides */ + public Annotation getOboAnnotation() { return null; } /** throws CharacterEx if not implemented (Character doesnt implement) OBOAnnotation implements */ Modified: phenote/trunk/src/java/phenote/datamodel/AnnotationCharacter.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/AnnotationCharacter.java 2008-01-29 23:40:37 UTC (rev 1426) +++ phenote/trunk/src/java/phenote/datamodel/AnnotationCharacter.java 2008-01-29 23:53:03 UTC (rev 1427) @@ -14,6 +14,7 @@ import org.obo.datamodel.Namespace; import org.obo.datamodel.OBOClass; import org.obo.datamodel.OBOProperty; +import org.obo.datamodel.impl.OBORestrictionImpl; import org.obo.util.TermUtil; /** CharacterI for OBOAnnotations */ @@ -23,6 +24,7 @@ protected static int idgen = 0; + /** underlying obo annotation - cant be null actually */ protected Annotation annotation; protected AnnotationMappingDriver driver; private CharFieldValue objectGenus; @@ -303,11 +305,23 @@ return a; } + + public boolean supportsComparisons() { return true; } + /** Make comparison relationship between 2 annotations */ public void makeComparison(OBOProperty relation, CharacterI relatedChar) throws CharacterEx { + // this actually shouldnt happen but who knows + if (!hasOboAnnotation() || !relatedChar.hasOboAnnotation()) + throw new CharacterEx("Character doesnt have Annotation object"); + Annotation relAnn = relatedChar.getOboAnnotation(); + // thats for terms not instances + //OBORestrictionImpl res = new OBORestrictionImpl(annotation,relation,relAnn); + //InstancePropertyValue + //annotation.addPropertyValue(res,relAnn); + //annotation.addParent(res); } } Modified: phenote/trunk/src/java/phenote/datamodel/CharacterI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2008-01-29 23:40:37 UTC (rev 1426) +++ phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2008-01-29 23:53:03 UTC (rev 1427) @@ -1,6 +1,7 @@ package phenote.datamodel; import java.util.List; +import org.obo.annotation.datamodel.Annotation; import org.obo.datamodel.OBOClass; import org.obo.datamodel.OBOProperty; @@ -61,6 +62,12 @@ public boolean equals(CharacterI c); public boolean hasNoContent(); + /** Returns true if in fact charI has OboAnnotation under the hood, and thus + getOboAnnotation will have non null return. Char returns false */ + public boolean hasOboAnnotation(); + + /** if hasOboAnnotation() this returns non null Annotation from obo model */ + public Annotation getOboAnnotation(); /** Returns true if charI implementation supports comparisons, eg Character doesnt AnnotChar does */ Modified: phenote/trunk/src/java/phenote/gui/CharacterTableController.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableController.java 2008-01-29 23:40:37 UTC (rev 1426) +++ phenote/trunk/src/java/phenote/gui/CharacterTableController.java 2008-01-29 23:53:03 UTC (rev 1427) @@ -281,11 +281,13 @@ //buttonPanel.remove(ontolMakerButton); // dont need ontolMakerSpacer.setVisible(false); } + + // Take out comparison buttons if not configged for them if (!Config.inst().compareStatementEnabled() || !CharacterIFactory.supportsComparisons()) { compareButton.setVisible(false); compareSpacer.setVisible(false); - // if configured for comparable, but dont have comparable datamodel error + // if configured for comparable, but dont have comparable datamodel - error if (Config.inst().compareStatementEnabled()) { String m="Error: Comparisons are configged, but configged datamodel does not " +"support comparisons.\nDisabling.\nTry configging OBO_ANNOTATION mode"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |