Project

General

Profile

« Previous | Next » 

Revision 20dbc8a3

Added by Cherian Mathew over 10 years ago

NameInformationTest : sample test file for name information test in RdfViewTest
rdf-views.xml: new view configuration for rdf view
NameInformationRdf : new rdf class corresponding to NameInformation

View differences:

.gitattributes
1678 1678
cdmlib-remote-webapp/src/main/webapp/WEB-INF/json-views.xml -text
1679 1679
cdmlib-remote-webapp/src/main/webapp/WEB-INF/jsp/index.jsp -text
1680 1680
cdmlib-remote-webapp/src/main/webapp/WEB-INF/oai-views.xml -text
1681
cdmlib-remote-webapp/src/main/webapp/WEB-INF/rdf-views.xml -text
1681 1682
cdmlib-remote-webapp/src/main/webapp/WEB-INF/web.xml -text
1682 1683
cdmlib-remote-webapp/src/main/webapp/WEB-INF/xml-views.xml -text
1683 1684
cdmlib-remote-webapp/src/main/webapp/css/csv_export.css -text
......
1804 1805
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/RemoveHTMLReader.java -text
1805 1806
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/StripTagsConverter.java -text
1806 1807
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/assembler/converter/TimePeriodConverter.java -text
1808
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/cdm/NameInformationRdf.java -text
1807 1809
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/common/ErrorResponse.java -text
1808 1810
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/common/RemoteResponse.java -text
1809 1811
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/dc/Relation.java -text
......
1978 1980
cdmlib-remote/src/test/resources/applicationContext.xml -text
1979 1981
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/applicationContext-test.xml -text
1980 1982
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/override.properties -text
1983
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/NameInformationTest.rdf -text
1981 1984
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/RdfViewTest.rdf -text
1982 1985
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/oaipmh/IdentifyView.xml -text
1983 1986
cdmlib-remote/src/test/resources/log4j.properties -text
cdmlib-remote-webapp/src/main/webapp/WEB-INF/rdf-views.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xsi:schemaLocation="http://www.springframework.org/schema/beans
5
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
6

  
7
    <!--
8
        ===============================================================
9
        This is the configuration file for the
10
        eu.etaxonomy.cdm.remote.view.PatternViewResolver
11
        ===============================================================
12

  
13
      - bean names are ant style patterns
14
      - the eu.etaxonomy.cdm.remote.view.PatternViewResolver
15
        must be used to resolve patterns used as bean names
16
      - the views listed here are responsible for rdf repsponse formats 
17
    -->
18

  
19

  
20
     <bean name="**/name_catalogue/* **/name_catalogue" class="eu.etaxonomy.cdm.remote.view.RdfView">
21
      <property name="type" value="RDFXML" />
22
      <property name="rdfMarshaller" ref="rdfMarshaller"/>
23
      <property name="mapper" ref="dozerMapper"/>
24
    </bean>
25

  
26

  
27

  
28
</beans>
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/cdm/NameInformationRdf.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.remote.dto.cdm;
11

  
12
import java.net.URI;
13
import java.net.URISyntaxException;
14
import java.util.HashSet;
15
import java.util.Iterator;
16
import java.util.List;
17
import java.util.Set;
18

  
19
import javax.xml.bind.annotation.XmlAccessType;
20
import javax.xml.bind.annotation.XmlAccessorType;
21
import javax.xml.bind.annotation.XmlElement;
22
import javax.xml.bind.annotation.XmlRootElement;
23
import javax.xml.bind.annotation.XmlTransient;
24
import javax.xml.bind.annotation.XmlType;
25

  
26
import eu.etaxonomy.cdm.remote.dto.tdwg.BaseThing;
27
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.Relationship;
28
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept;
29
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept.HasRelationship;
30

  
31
/**
32
 * This class is an RDF representation of the {@link eu.etaxonomy.cdm.remote.dto.namecatalogue.NameInformation NameInformation}
33
 *
34
 * @author c.mathew
35
 * @version 1.1.0
36
 * @created 25-Nov-2012
37
 */
38

  
39
@XmlAccessorType(XmlAccessType.FIELD)
40
@XmlType(name = "NameInformation", propOrder = {
41
		"scientificNameID",
42
		"nameComplete",
43
		"title",
44
		"rankString",
45
		"references",
46
		"typeStatus",
47
		"hasRelationships"
48
})
49
@XmlRootElement(name = "NameInformation", namespace = "http://cybertaxonomy.eu/cdm/ontology/voc/NameInformation#")
50
public class NameInformationRdf extends BaseThing {
51
	
52
	@XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
53
	private String scientificNameID;
54
	
55
	@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
56
	private String nameComplete;
57
	
58
	@XmlElement(namespace = "http://purl.org/dc/elements/1.1/")
59
	private String title;
60
	
61
	@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
62
	private String rankString;	
63
	
64
	@XmlElement(namespace = "http://purl.org/dc/terms/")
65
	private String references;
66

  
67
	@XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
68
	private List<String> typeStatus;
69
	
70

  
71
	@XmlElement(name = "hasRelationship", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
72
	private Set<HasRelationship> hasRelationships = null;
73
	
74
	@XmlTransient
75
	private Set<String> taxonUuids;
76
	
77
	
78
	public Set<String> getTaxonUuids() {
79
		return taxonUuids;
80
	}
81

  
82
	public void setTaxonUuids(Set<String> taxonUuids) {
83
		this.taxonUuids = taxonUuids;
84
		Set<Relationship> relationships = new HashSet<Relationship>();
85
		Iterator<String> itr = taxonUuids.iterator();
86
		while(itr.hasNext()) {
87
			String uuid = itr.next();			
88
			try {
89
				TaxonConcept tc = new TaxonConcept();
90
				tc.setIdentifier(new URI("urn:uuid:" + uuid));
91
				Relationship rel = new Relationship();
92
				rel.setToTaxon(tc);
93
				relationships.add(rel);
94
				
95
			} catch (URISyntaxException e) {
96
				// TODO Auto-generated catch block
97
				//e.printStackTrace();
98
			}
99
		}
100
		if(!relationships.isEmpty()) {
101
			setHasRelationship(relationships);
102
		}
103
	}
104

  
105
	public String getScientificNameID() {
106
		return scientificNameID;
107
	}
108
	
109
	public void setScientificNameID(String scientificNameID) {
110
		this.scientificNameID = scientificNameID;
111
	}
112
	
113
	public String getNameComplete() {
114
		return nameComplete;
115
	}
116

  
117
	public void setNameComplete(String nameComplete) {
118
		this.nameComplete = nameComplete;
119
	}
120

  
121
	public String getTitle() {
122
		return title;
123
	}
124

  
125
	public void setTitle(String title) {
126
		this.title = title;
127
	}
128

  
129
	public String getRankString() {
130
		return rankString;
131
	}
132

  
133
	public void setRankString(String rankString) {
134
		this.rankString = rankString;
135
	}
136
	
137
	public String getReferences() {
138
		return references;
139
	}
140

  
141
	public void setReferences(String references) {
142
		this.references = references;
143
	}
144
	
145
	public List<String> getTypeStatus() {
146
		return typeStatus;
147
	}
148

  
149
	public void setTypeStatus(List<String> typeStatus) {
150
		this.typeStatus = typeStatus;
151
	}
152

  
153
	public Set<Relationship> getHasRelationship() {
154
		if(hasRelationships != null) {
155
			Set<Relationship> relationships = new HashSet<Relationship>();
156
			for(HasRelationship hasRelationship : hasRelationships) {
157
				relationships.add(hasRelationship.getRelationship());
158
			}
159
			return relationships;
160
		} else {
161
			return null;
162
		}
163
	}
164

  
165
	public void setHasRelationship(Set<Relationship> relationships) {
166
		if(relationships != null) {
167
		  this.hasRelationships = new HashSet<HasRelationship>();
168
		  for(Relationship relationship : relationships) {
169
			hasRelationships.add( new HasRelationship(relationship));
170
		  }
171
		} else {
172
			hasRelationships = null;
173
		}
174
	}
175
}
cdmlib-remote/src/test/resources/eu/etaxonomy/cdm/remote/view/NameInformationTest.rdf
1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" 
3
	xmlns:tn="http://rs.tdwg.org/ontology/voc/TaxonName#" 
4
	xmlns:dwcterms="http://rs.tdwg.org/dwc/terms/" 
5
	xmlns:cdmni="http://cybertaxonomy.eu/cdm/ontology/voc/NameInformation#" 
6
	xmlns:tp="http://rs.tdwg.org/ontology/voc/Person#" 
7
	xmlns:spm="http://rs.tdwg.org/ontology/voc/SpeciesProfileModel#" 
8
	xmlns:tcom="http://rs.tdwg.org/ontology/voc/Common#" 
9
	xmlns:tpc="http://rs.tdwg.org/ontology/voc/PublicationCitation#" 
10
	xmlns:dcterms="http://purl.org/dc/terms/" 
11
	xmlns:tc="http://rs.tdwg.org/ontology/voc/TaxonConcept#" 
12
	xmlns:tt="http://rs.tdwg.org/ontology/voc/Team#" 
13
	xmlns:owl="http://www.w3.org/2002/07/owl#" 
14
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
15
	xmlns:gr="http://rs.tdwg.org/ontology/voc/GeographicRegion#">
16
	<cdmni:NameInformation xsi:type="NameInformation" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
17
		<dwcterms:scientificNameID>64cf8cf8-f56a-4411-8f49-c3dc95ea257a</dwcterms:scientificNameID>
18
		<tn:nameComplete>Platalea leucorodia</tn:nameComplete>
19
		<dc:title>Platalea leucorodia Linnaeus, 1758</dc:title>
20
		<tn:rankString>Species</tn:rankString>
21
		<tc:hasRelationship>
22
			<tc:Relationship>
23
				<tc:toTaxon>
24
					<tc:TaxonConcept>
25
						<dc:identifier>urn:uuid:1a5bcb42-146f-42e5-9136-1b21d170163e</dc:identifier>
26
					</tc:TaxonConcept>
27
				</tc:toTaxon>
28
			</tc:Relationship>
29
		</tc:hasRelationship>
30
	</cdmni:NameInformation>
31
</rdf:RDF>

Also available in: Unified diff