|
From: <rv...@us...> - 2010-03-15 01:25:54
|
Revision: 584
http://treebase.svn.sourceforge.net/treebase/?rev=584&view=rev
Author: rvos
Date: 2010-03-15 01:25:48 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
Added getAnnotations() and getLabel() for nexml and rdf serialization.
Modified Paths:
--------------
trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java 2010-03-15 01:20:38 UTC (rev 583)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/AbstractPersistedObject.java 2010-03-15 01:25:48 UTC (rev 584)
@@ -2,19 +2,22 @@
package org.cipres.treebase.domain;
import java.io.Serializable;
+import java.net.URI;
+import java.util.ArrayList;
import java.util.Comparator;
-
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import javax.persistence.Version;
+import org.cipres.treebase.Constants;
import org.cipres.treebase.NamespacedGUID;
import org.cipres.treebase.PhyloWSPath;
import org.cipres.treebase.TreebaseIDString;
+import org.cipres.treebase.TreebaseUtil;
import org.hibernate.annotations.GenericGenerator;
/**
@@ -100,5 +103,30 @@
public PhyloWSPath getPhyloWSPath() {
return new PhyloWSPath(this);
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.cipres.treebase.domain.Annotatable#getAnnotations()
+ */
+ @Transient
+ public List<Annotation> getAnnotations() {
+ // This is called by child classes using super.getAnnotations()
+ // to get the common annotations out of the way
+ List<Annotation> annotations = new ArrayList<Annotation>();
+ URI uri = URI.create(TreebaseUtil.getPurlDomain()+getPhyloWSPath());
+ annotations.add(new Annotation(Constants.OWLURI,"owl:sameAs",uri));
+ return annotations;
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.cipres.treebase.domain.NexmlWritable#getLabel()
+ */
+ @Transient
+ public String getLabel() {
+ // This is overridden by child classes that want a name/title/label
+ // to be serialized in nexml or rdf
+ return null;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|