NameInformationTest : sample test file for name information test in RdfViewTest
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 27 Nov 2013 10:42:45 +0000 (10:42 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 27 Nov 2013 10:42:45 +0000 (10:42 +0000)
rdf-views.xml: new view configuration for rdf view
NameInformationRdf : new rdf class corresponding to  NameInformation

.gitattributes
cdmlib-remote-webapp/src/main/webapp/WEB-INF/rdf-views.xml [new file with mode: 0644]
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/cdm/NameInformationRdf.java [new file with mode: 0644]
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/NameInformationTest.rdf [new file with mode: 0644]

index 5f186b786de22cc399f8e473b808bb4fe39ebe76..04f401293835de54c67ef915e3e84fb61f78eb2e 100644 (file)
@@ -1678,6 +1678,7 @@ cdmlib-remote-webapp/src/main/webapp/WEB-INF/datasources/routing-datasource.xml
 cdmlib-remote-webapp/src/main/webapp/WEB-INF/json-views.xml -text
 cdmlib-remote-webapp/src/main/webapp/WEB-INF/jsp/index.jsp -text
 cdmlib-remote-webapp/src/main/webapp/WEB-INF/oai-views.xml -text
+cdmlib-remote-webapp/src/main/webapp/WEB-INF/rdf-views.xml -text
 cdmlib-remote-webapp/src/main/webapp/WEB-INF/web.xml -text
 cdmlib-remote-webapp/src/main/webapp/WEB-INF/xml-views.xml -text
 cdmlib-remote-webapp/src/main/webapp/css/csv_export.css -text
@@ -1804,6 +1805,7 @@ cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/Pref
 cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/RemoveHTMLReader.java -text
 cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/StripTagsConverter.java -text
 cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/TimePeriodConverter.java -text
+cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/cdm/NameInformationRdf.java -text
 cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/common/ErrorResponse.java -text
 cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/common/RemoteResponse.java -text
 cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/dc/Relation.java -text
@@ -1978,6 +1980,7 @@ cdmlib-remote/src/test/java/eu/etaxonomy/cdm/test/util/LSIDMatchers.java -text
 cdmlib-remote/src/test/resources/applicationContext.xml -text
 cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/applicationContext-test.xml -text
 cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/override.properties -text
+cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/NameInformationTest.rdf -text
 cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/RdfViewTest.rdf -text
 cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/oaipmh/IdentifyView.xml -text
 cdmlib-remote/src/test/resources/log4j.properties -text
diff --git a/cdmlib-remote-webapp/src/main/webapp/WEB-INF/rdf-views.xml b/cdmlib-remote-webapp/src/main/webapp/WEB-INF/rdf-views.xml
new file mode 100644 (file)
index 0000000..a920ba5
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans
+    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+    <!--
+        ===============================================================
+        This is the configuration file for the
+        eu.etaxonomy.cdm.remote.view.PatternViewResolver
+        ===============================================================
+
+      - bean names are ant style patterns
+      - the eu.etaxonomy.cdm.remote.view.PatternViewResolver
+        must be used to resolve patterns used as bean names
+      - the views listed here are responsible for rdf repsponse formats 
+    -->
+
+
+     <bean name="**/name_catalogue/* **/name_catalogue" class="eu.etaxonomy.cdm.remote.view.RdfView">
+      <property name="type" value="RDFXML" />
+      <property name="rdfMarshaller" ref="rdfMarshaller"/>
+      <property name="mapper" ref="dozerMapper"/>
+    </bean>
+
+
+
+</beans>
\ No newline at end of file
diff --git a/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/cdm/NameInformationRdf.java b/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/cdm/NameInformationRdf.java
new file mode 100644 (file)
index 0000000..bff4112
--- /dev/null
@@ -0,0 +1,175 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.cdm.remote.dto.cdm;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import eu.etaxonomy.cdm.remote.dto.tdwg.BaseThing;
+import eu.etaxonomy.cdm.remote.dto.tdwg.voc.Relationship;
+import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept;
+import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept.HasRelationship;
+
+/**
+ * This class is an RDF representation of the {@link eu.etaxonomy.cdm.remote.dto.namecatalogue.NameInformation NameInformation}
+ *
+ * @author c.mathew
+ * @version 1.1.0
+ * @created 25-Nov-2012
+ */
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "NameInformation", propOrder = {
+               "scientificNameID",
+               "nameComplete",
+               "title",
+               "rankString",
+               "references",
+               "typeStatus",
+               "hasRelationships"
+})
+@XmlRootElement(name = "NameInformation", namespace = "http://cybertaxonomy.eu/cdm/ontology/voc/NameInformation#")
+public class NameInformationRdf extends BaseThing {
+       
+       @XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
+       private String scientificNameID;
+       
+       @XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
+       private String nameComplete;
+       
+       @XmlElement(namespace = "http://purl.org/dc/elements/1.1/")
+       private String title;
+       
+       @XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
+       private String rankString;      
+       
+       @XmlElement(namespace = "http://purl.org/dc/terms/")
+       private String references;
+
+       @XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
+       private List<String> typeStatus;
+       
+
+       @XmlElement(name = "hasRelationship", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
+       private Set<HasRelationship> hasRelationships = null;
+       
+       @XmlTransient
+       private Set<String> taxonUuids;
+       
+       
+       public Set<String> getTaxonUuids() {
+               return taxonUuids;
+       }
+
+       public void setTaxonUuids(Set<String> taxonUuids) {
+               this.taxonUuids = taxonUuids;
+               Set<Relationship> relationships = new HashSet<Relationship>();
+               Iterator<String> itr = taxonUuids.iterator();
+               while(itr.hasNext()) {
+                       String uuid = itr.next();                       
+                       try {
+                               TaxonConcept tc = new TaxonConcept();
+                               tc.setIdentifier(new URI("urn:uuid:" + uuid));
+                               Relationship rel = new Relationship();
+                               rel.setToTaxon(tc);
+                               relationships.add(rel);
+                               
+                       } catch (URISyntaxException e) {
+                               // TODO Auto-generated catch block
+                               //e.printStackTrace();
+                       }
+               }
+               if(!relationships.isEmpty()) {
+                       setHasRelationship(relationships);
+               }
+       }
+
+       public String getScientificNameID() {
+               return scientificNameID;
+       }
+       
+       public void setScientificNameID(String scientificNameID) {
+               this.scientificNameID = scientificNameID;
+       }
+       
+       public String getNameComplete() {
+               return nameComplete;
+       }
+
+       public void setNameComplete(String nameComplete) {
+               this.nameComplete = nameComplete;
+       }
+
+       public String getTitle() {
+               return title;
+       }
+
+       public void setTitle(String title) {
+               this.title = title;
+       }
+
+       public String getRankString() {
+               return rankString;
+       }
+
+       public void setRankString(String rankString) {
+               this.rankString = rankString;
+       }
+       
+       public String getReferences() {
+               return references;
+       }
+
+       public void setReferences(String references) {
+               this.references = references;
+       }
+       
+       public List<String> getTypeStatus() {
+               return typeStatus;
+       }
+
+       public void setTypeStatus(List<String> typeStatus) {
+               this.typeStatus = typeStatus;
+       }
+
+       public Set<Relationship> getHasRelationship() {
+               if(hasRelationships != null) {
+                       Set<Relationship> relationships = new HashSet<Relationship>();
+                       for(HasRelationship hasRelationship : hasRelationships) {
+                               relationships.add(hasRelationship.getRelationship());
+                       }
+                       return relationships;
+               } else {
+                       return null;
+               }
+       }
+
+       public void setHasRelationship(Set<Relationship> relationships) {
+               if(relationships != null) {
+                 this.hasRelationships = new HashSet<HasRelationship>();
+                 for(Relationship relationship : relationships) {
+                       hasRelationships.add( new HasRelationship(relationship));
+                 }
+               } else {
+                       hasRelationships = null;
+               }
+       }
+}
diff --git a/cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/NameInformationTest.rdf b/cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/NameInformationTest.rdf
new file mode 100644 (file)
index 0000000..dd80909
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" 
+       xmlns:tn="http://rs.tdwg.org/ontology/voc/TaxonName#" 
+       xmlns:dwcterms="http://rs.tdwg.org/dwc/terms/" 
+       xmlns:cdmni="http://cybertaxonomy.eu/cdm/ontology/voc/NameInformation#" 
+       xmlns:tp="http://rs.tdwg.org/ontology/voc/Person#" 
+       xmlns:spm="http://rs.tdwg.org/ontology/voc/SpeciesProfileModel#" 
+       xmlns:tcom="http://rs.tdwg.org/ontology/voc/Common#" 
+       xmlns:tpc="http://rs.tdwg.org/ontology/voc/PublicationCitation#" 
+       xmlns:dcterms="http://purl.org/dc/terms/" 
+       xmlns:tc="http://rs.tdwg.org/ontology/voc/TaxonConcept#" 
+       xmlns:tt="http://rs.tdwg.org/ontology/voc/Team#" 
+       xmlns:owl="http://www.w3.org/2002/07/owl#" 
+       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+       xmlns:gr="http://rs.tdwg.org/ontology/voc/GeographicRegion#">
+       <cdmni:NameInformation xsi:type="NameInformation" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+               <dwcterms:scientificNameID>64cf8cf8-f56a-4411-8f49-c3dc95ea257a</dwcterms:scientificNameID>
+               <tn:nameComplete>Platalea leucorodia</tn:nameComplete>
+               <dc:title>Platalea leucorodia Linnaeus, 1758</dc:title>
+               <tn:rankString>Species</tn:rankString>
+               <tc:hasRelationship>
+                       <tc:Relationship>
+                               <tc:toTaxon>
+                                       <tc:TaxonConcept>
+                                               <dc:identifier>urn:uuid:1a5bcb42-146f-42e5-9136-1b21d170163e</dc:identifier>
+                                       </tc:TaxonConcept>
+                               </tc:toTaxon>
+                       </tc:Relationship>
+               </tc:hasRelationship>
+       </cdmni:NameInformation>
+</rdf:RDF>
\ No newline at end of file