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
|
* @since 25-Nov-2012
|
36
|
*/
|
37
|
@XmlAccessorType(XmlAccessType.FIELD)
|
38
|
@XmlType(name = "NameInformation", propOrder = {
|
39
|
"scientificNameID",
|
40
|
"nameComplete",
|
41
|
"title",
|
42
|
"rankString",
|
43
|
"references",
|
44
|
"typeStatus",
|
45
|
"hasRelationships"
|
46
|
})
|
47
|
@XmlRootElement(name = "NameInformation", namespace = "http://cybertaxonomy.eu/cdm/ontology/voc/NameInformation#")
|
48
|
public class NameInformationRdf extends BaseThing {
|
49
|
|
50
|
@XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
|
51
|
private String scientificNameID;
|
52
|
|
53
|
@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
|
54
|
private String nameComplete;
|
55
|
|
56
|
@XmlElement(namespace = "http://purl.org/dc/elements/1.1/")
|
57
|
private String title;
|
58
|
|
59
|
@XmlElement(namespace = "http://rs.tdwg.org/ontology/voc/TaxonName#")
|
60
|
private String rankString;
|
61
|
|
62
|
@XmlElement(namespace = "http://purl.org/dc/terms/")
|
63
|
private String references;
|
64
|
|
65
|
@XmlElement(namespace = "http://rs.tdwg.org/dwc/terms/")
|
66
|
private List<String> typeStatus;
|
67
|
|
68
|
|
69
|
@XmlElement(name = "hasRelationship", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#")
|
70
|
private Set<HasRelationship> hasRelationships = null;
|
71
|
|
72
|
@XmlTransient
|
73
|
private Set<String> taxonUuids;
|
74
|
|
75
|
|
76
|
public Set<String> getTaxonUuids() {
|
77
|
return taxonUuids;
|
78
|
}
|
79
|
|
80
|
public void setTaxonUuids(Set<String> taxonUuids) {
|
81
|
this.taxonUuids = taxonUuids;
|
82
|
Set<Relationship> relationships = new HashSet<Relationship>();
|
83
|
Iterator<String> itr = taxonUuids.iterator();
|
84
|
while(itr.hasNext()) {
|
85
|
String uuid = itr.next();
|
86
|
try {
|
87
|
TaxonConcept tc = new TaxonConcept();
|
88
|
tc.setIdentifier(new URI("urn:uuid:" + uuid));
|
89
|
Relationship rel = new Relationship();
|
90
|
rel.setToTaxon(tc);
|
91
|
relationships.add(rel);
|
92
|
|
93
|
} catch (URISyntaxException e) {
|
94
|
// TODO Auto-generated catch block
|
95
|
//e.printStackTrace();
|
96
|
}
|
97
|
}
|
98
|
if(!relationships.isEmpty()) {
|
99
|
setHasRelationship(relationships);
|
100
|
}
|
101
|
}
|
102
|
|
103
|
public String getScientificNameID() {
|
104
|
return scientificNameID;
|
105
|
}
|
106
|
|
107
|
public void setScientificNameID(String scientificNameID) {
|
108
|
this.scientificNameID = scientificNameID;
|
109
|
}
|
110
|
|
111
|
public String getNameComplete() {
|
112
|
return nameComplete;
|
113
|
}
|
114
|
|
115
|
public void setNameComplete(String nameComplete) {
|
116
|
this.nameComplete = nameComplete;
|
117
|
}
|
118
|
|
119
|
@Override
|
120
|
public String getTitle() {
|
121
|
return title;
|
122
|
}
|
123
|
|
124
|
@Override
|
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
|
}
|