diff --git a/.classpath b/.classpath
index 6e26406..002ad57 100644
--- a/.classpath
+++ b/.classpath
@@ -1,10 +1,38 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index ec4300d..2f5cc74 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,8 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/pom.xml b/pom.xml
index 8f7e7ee..ad9b202 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,13 +5,13 @@
maven-parentorg.gcube.tools
- 1.0.0
+ 1.1.0org.gcube.data.spdworms-spd-plugin
- 1.8.0-SNAPSHOT
+ 1.8.1-SNAPSHOTworms-pluginworms plugin for species manager service
@@ -41,35 +41,20 @@
org.gcube.resources.discoveryic-client
-
-
+
- org.apache.axis
- axis
- 1.4
+ com.fasterxml.jackson.core
+ jackson-core
-
-
- javax.xml
- jaxrpc-api
- 1.1
+ com.fasterxml.jackson.core
+ jackson-annotations
-
-
- commons-discovery
- commons-discovery
- 0.5
+ com.fasterxml.jackson.core
+ jackson-databind
-
-
-
- wsdl4j
- wsdl4j
- 1.6.2
-
-
+
org.gcube.data.spdspd-model
@@ -121,7 +106,7 @@
org.apache.maven.pluginsmaven-assembly-plugin
- 2.2
+
${distroDirectory}/descriptor.xml
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/AphiaAttributeSets.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/AphiaAttributeSets.java
new file mode 100644
index 0000000..2942fdb
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/AphiaAttributeSets.java
@@ -0,0 +1,41 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.Collection;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class AphiaAttributeSets {
+
+ /**
+ * Unique and persistent identifier within WoRMS. Primary key in the
+ * database.
+ */
+ @JsonProperty("AphiaID")
+ public int aphiaId;
+
+ @JsonProperty("Attributes")
+ public Collection attributes;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/AphiaRecord.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/AphiaRecord.java
new file mode 100644
index 0000000..d256c6e
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/AphiaRecord.java
@@ -0,0 +1,188 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class AphiaRecord {
+
+ /**
+ * Unique and persistent identifier within WoRMS. Primary key in the
+ * database.
+ */
+ @JsonProperty("AphiaID")
+ public long aphiaId;
+
+ /**
+ * HTTP URL to the AphiaRecord
+ */
+ public String url;
+
+ /**
+ * the full scientific name without authorship
+ */
+ @JsonProperty("scientificname")
+ public String scientificName;
+
+ /**
+ * the authorship information for the scientific name formatted according to
+ * the conventions of the applicable nomenclaturalCode
+ */
+ public String authority;
+
+ /**
+ * the taxonomic rank of the most specific name in the scientific name
+ */
+ @JsonProperty("rank")
+ public String taxonomicRank;
+
+ /**
+ * the status of the use of the scientific name (usually a taxonomic
+ * opinion). Additional technical statuses are (1) quarantined: hidden from
+ * public interface after decision from an editor and (2) deleted: AphiaID
+ * should NOT be used anymore, please replace it by the valid_AphiaID
+ */
+ public String status;
+
+ public String taxonRankID;
+
+ public String parentNameUsageID;
+
+ /**
+ * the reason why a scientific name is unaccepted
+ */
+ @JsonProperty("unacceptreason")
+ public String unacceptReason;
+
+ /**
+ * the AphiaID (for the scientific name) of the currently accepted taxon.
+ * NULL if there is no currently accepted taxon.
+ */
+ @JsonProperty("valid_AphiaID")
+ public long validAphiaId;
+
+ /**
+ * the scientific name of the currently accepted taxon
+ */
+ @JsonProperty("valid_name")
+ public String validName;
+
+ /**
+ * the authorship information for the scientific name of the currently
+ * accepted taxon
+ */
+ @JsonProperty("valid_authority")
+ public String validAuthority;
+
+ /**
+ * the full scientific name of the kingdom in which the taxon is classified
+ */
+ @JsonProperty("kingdom")
+ public String taxonomicKingdom;
+
+ /**
+ * the full scientific name of the phylum or division in which the taxon is
+ * classified
+ */
+ @JsonProperty("phylum")
+ public String taxonomicPhylum;
+
+ /**
+ * the full scientific name of the class in which the taxon is classified
+ */
+ @JsonProperty("class")
+ public String taxonomicClass;
+
+ /**
+ * the full scientific name of the order in which the taxon is classified
+ */
+ @JsonProperty("order")
+ public String taxonomicOrder;
+
+ /**
+ * the full scientific name of the family in which the taxon is classified
+ */
+ @JsonProperty("family")
+ public String taxonomicFamily;
+
+ /**
+ * the full scientific name of the genus in which the taxon is classified
+ */
+ @JsonProperty("genus")
+ public String taxonomicGenus;
+
+ /**
+ * a bibliographic reference for the resource as a statement indicating how
+ * this record should be cited (attributed) when used
+ */
+ public String citation;
+
+ /**
+ * LifeScience Identifier. Persistent GUID for an AphiaID
+ */
+ public String lsid;
+
+ /**
+ * a boolean flag indicating whether the taxon is a marine organism, i.e.
+ * can be found in/above sea water. Possible values: 0/1/NULL
+ */
+ public Boolean isMarine;
+
+ /**
+ * a boolean flag indicating whether the taxon occurrs in brackish habitats.
+ * Possible values: 0/1/NULL
+ */
+ public Boolean isBrackish;
+
+ /**
+ * a boolean flag indicating whether the taxon occurrs in freshwater
+ * habitats, i.e. can be found in/above rivers or lakes. Possible values:
+ * 0/1/NULL
+ */
+ public Boolean isFreshwater;
+
+ /**
+ * a boolean flag indicating the taxon is a terrestial organism, i.e.
+ * occurrs on land as opposed to the sea. Possible values: 0/1/NULL
+ */
+ public Boolean isTerrestrial;
+
+ /**
+ * a flag indicating an extinct organism. Possible values: 0/1/NULL
+ */
+ public Boolean isExtinct;
+
+ /**
+ * Type of match.
+ */
+ @JsonProperty("match_type")
+ public MatchType matchType;
+
+ /**
+ * The most recent date-time in GMT on which the resource was changed
+ */
+ public String modified;
+
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/Attribute.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/Attribute.java
new file mode 100644
index 0000000..4030493
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/Attribute.java
@@ -0,0 +1,90 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.Collection;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class Attribute {
+ /**
+ * Unique and persistent identifier within WoRMS. Primary key in the
+ * database.
+ */
+ @JsonProperty("AphiaID")
+ public int aphiaId;
+
+ /**
+ * The corresponding AttributeKey its measurementTypeID
+ */
+ @JsonProperty("measurementTypeID")
+ public int measurementTypeId;
+
+ /**
+ * The corresponding AttributeKey its measurementType
+ */
+ public String measurementType;
+
+ /**
+ * The value of the measurement, fact, characteristic, or assertion
+ */
+ public String measurementValue;
+
+ /**
+ * The identifier for the AphiaSource for this attribute
+ */
+ @JsonProperty("source_id")
+ public Integer sourceId;
+
+ /**
+ * The AphiaSource reference for this attribute
+ */
+ public String reference;
+
+ /**
+ * Quality status of the record. Possible values: 'checked’, ‘trusted’ or
+ * 'unreviewed’. See http://www.marinespecies.org/aphia.php?p=manual#topic22
+ */
+ @JsonProperty("qualitystatus")
+ public String qualityStatus;
+
+ /**
+ * The category identifier to list possible attribute values for this
+ * attribute definition
+ */
+ @JsonProperty("CategoryID")
+ public Integer categoryID;
+
+ /**
+ * The AphiaID from where this attribute is inherited
+ */
+ @JsonProperty("AphiaID_Inherited")
+ public Integer aphiaIdInherited;
+
+ /**
+ * The possible child attributes that help to describe to current attribute
+ */
+ public Collection children;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/AttributeKey.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/AttributeKey.java
new file mode 100644
index 0000000..3a439ed
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/AttributeKey.java
@@ -0,0 +1,59 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.Collection;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class AttributeKey {
+ /**
+ * An internal identifier for the measurementType
+ */
+ @JsonProperty("measurementTypeID")
+ public int measurementTypeId;
+
+ /**
+ * The nature of the measurement, fact, characteristic, or assertion http://www.marinespecies.org/traits/wiki
+ */
+ public String measurementType;
+
+ /**
+ * The data type that is expected as value for this attribute definition
+ */
+ @JsonProperty("input_id")
+ public int inputId;
+
+ /**
+ * The category identifier to list possible attribute values for this attribute definition
+ */
+ @JsonProperty("CategoryID")
+ public int categoryId;
+
+ /**
+ * The possible child attribute keys that help to describe to current attribute
+ */
+ public Collection children;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/AttributeValue.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/AttributeValue.java
new file mode 100644
index 0000000..3f874ce
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/AttributeValue.java
@@ -0,0 +1,53 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.Collection;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class AttributeValue {
+ /**
+ * An identifier for facts stored in the column measurementValue
+ */
+ @JsonProperty("measurementValueID")
+ public int measurementValueId;
+
+ /**
+ * The value of the measurement, fact, characteristic, or assertion
+ */
+ public String measurementValue;
+
+ /**
+ * Additional info/code that helps to the describe/define the
+ * measurementValue
+ */
+ public String measurementValueCode;
+
+ /**
+ * Child measurementValues that are more specific
+ */
+ public Collection children;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/Classification.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/Classification.java
new file mode 100644
index 0000000..6e5d8b4
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/Classification.java
@@ -0,0 +1,47 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class Classification {
+ /**
+ * Unique and persistent identifier within WoRMS. Primary key in the
+ * database.
+ */
+ @JsonProperty("AphiaID")
+ public int aphiaId;
+ /**
+ * the taxonomic rank of the most specific name in the scientific name
+ */
+ @JsonProperty("rank")
+ public String taxonomicRank;
+ /**
+ * the full scientific name without authorship
+ */
+ @JsonProperty("scientificname")
+ public String scientificName;
+ public Classification child;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/Distribution.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/Distribution.java
new file mode 100644
index 0000000..71f77e8
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/Distribution.java
@@ -0,0 +1,88 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class Distribution {
+
+ /**
+ * The specific description of the place
+ */
+ public String locality;
+
+ /**
+ * An identifier for the locality. Using the Marine Regions Geographic
+ * IDentifier (MRGID), see http://www.marineregions.org/mrgid.php
+ */
+ public String locationID;
+
+ /**
+ * A geographic name less specific than the information captured in the
+ * locality term. Possible values: an IHO Sea Area or Nation, derived from
+ * the MarineRegions gazetteer
+ */
+ public String higherGeography;
+
+ /**
+ * An identifier for the geographic region within which the locality
+ * occurred, using MRGID
+ */
+ public String higherGeographyID;
+
+ /**
+ * The status of the distribution record. Possible values are ‘valid’
+ * ,’doubtful’ or 'inaccurate’. See here for explanation of the statuses
+ */
+ public String recordStatus;
+
+ /**
+ * The type status of the distribution. Possible values: ‘holotype’ or
+ * empty.
+ */
+ public String typeStatus;
+
+ /**
+ * The process by which the biological individual(s) represented in the
+ * Occurrence became established at the location. Possible values: values
+ * listed as Origin in WRIMS
+ */
+ public String establishmentMeans;
+
+ /**
+ * The geographic latitude (in decimal degrees, WGS84)
+ */
+ public double decimalLatitude;
+
+ /**
+ * The geographic longitude (in decimal degrees, WGS84)
+ */
+ public double decimalLongitude;
+
+ /**
+ * Quality status of the record. Possible values: 'checked’, ‘trusted’ or
+ * 'unreviewed’. See http://www.marinespecies.org/aphia.php?p=manual#topic22
+ */
+ public String qualityStatus;
+
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/ExternalIdentifierSource.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/ExternalIdentifierSource.java
new file mode 100644
index 0000000..92ff7fe
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/ExternalIdentifierSource.java
@@ -0,0 +1,64 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public enum ExternalIdentifierSource {
+ /**
+ * Barcode of Life Database (BOLD) TaxID
+ */
+ bold,
+ /**
+ * Dyntaxa ID
+ */
+ dyntaxa,
+ /**
+ * Encyclopedia of Life page identifier
+ */
+ eol,
+ /**
+ * FishBase species ID
+ */
+ fishbase,
+ /**
+ * IUCN Red List Identifier
+ */
+ iucn,
+ /**
+ * Life Science Identifier
+ */
+ lsid,
+ /**
+ * NCBI Taxonomy ID (Genbank)
+ */
+ ncbi,
+ /**
+ * ITIS Taxonomic Serial Number
+ */
+ tsn,
+ /**
+ * Global Invasive Species Database
+ */
+ gisd
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/MatchType.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/MatchType.java
new file mode 100644
index 0000000..3aeb73f
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/MatchType.java
@@ -0,0 +1,29 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public enum MatchType {
+ exact, like, phonetic, near_1, near_2
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/Source.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/Source.java
new file mode 100644
index 0000000..c335e28
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/Source.java
@@ -0,0 +1,64 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class Source {
+ /**
+ * Unique identifier for the source within WoRMS.
+ */
+ @JsonProperty("source_id")
+ public int sourceId;
+ /**
+ * Usage of the source for this taxon. See
+ * http://www.marinespecies.org/aphia.php?p=manual#topic6 for all values
+ */
+ public String use;
+ /**
+ * Full citation string
+ */
+ public String reference;
+ /**
+ * Page(s) where the taxon is mentioned
+ */
+ public String page;
+ /**
+ * Direct link to the source record
+ */
+ public String url;
+ /**
+ * External link (i.e. journal, data system, etc…)
+ */
+ public String link;
+ /**
+ * Full text link (PDF)
+ */
+ public String fulltext;
+ /**
+ * Digital Object Identifier
+ */
+ public String doi;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/Vernacular.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/Vernacular.java
new file mode 100644
index 0000000..9531a45
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/Vernacular.java
@@ -0,0 +1,34 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class Vernacular {
+ public String vernacular;
+ @JsonProperty("language_code")
+ public String languageCode;
+ public String language;
+}
diff --git a/src/main/java/de/uni_jena/cs/fusion/client/worms/WormsClient.java b/src/main/java/de/uni_jena/cs/fusion/client/worms/WormsClient.java
new file mode 100644
index 0000000..eedfc9c
--- /dev/null
+++ b/src/main/java/de/uni_jena/cs/fusion/client/worms/WormsClient.java
@@ -0,0 +1,726 @@
+package de.uni_jena.cs.fusion.client.worms;
+
+/*-
+ * #%L
+ * LakeBase Semantic Service
+ * %%
+ * Copyright (C) 2018 Heinz Nixdorf Chair for Distributed Information Systems, Friedrich Schiller University Jena
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.time.DateTimeException;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAccessor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ *
+ * Acknowledgments: The development of the WoRMS Client was funded by DFG
+ * in the scope of the LakeBase project within the Scientific Library Services
+ * and Information Systems (LIS) program.
+ *
+ *
+ * @author Jan Martin Keil
+ * @since 1.0.0
+ */
+public class WormsClient {
+
+ private final static int HTTP_MAX_URL_BYTES = 7806;
+ private final static String SERVICE_URL = "http://www.marinespecies.org/rest/";
+ private final static ObjectMapper JSON = new ObjectMapper();
+
+ /**
+ * Constructs a {@link WormsClient} with a default {@link CloseableHttpClient}
+ * configured to a maximum number of 10 connections.
+ *
+ * @since 1.0.0
+ */
+ public WormsClient() {}
+
+
+ /**
+ * Get attribute definitions. To refer to root items specify ID = ‘0’.
+ *
+ * @param id
+ * The attribute definition id to search for
+ * @param includeChildren
+ * Include the tree of children.
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaAttributeKeysById(long id, boolean includeChildren)
+ throws WormsClientException {
+ return this.request(
+ SERVICE_URL + "AphiaAttributeKeysByID/" + id + ((includeChildren) ? "?include_inherited=true" : ""),
+ new TypeReference>() {
+ });
+ }
+
+ /**
+ * Get a list of attributes for a given AphiaID
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @param includeChildren
+ * Include attributes inherited from the taxon its parent(s).
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaAttributesByAphiaId(long aphiaId, boolean includeChildren)
+ throws WormsClientException {
+ return this.request(
+ SERVICE_URL + "AphiaAttributesByAphiaID/" + aphiaId
+ + ((includeChildren) ? "?include_inherited=true" : ""),
+ new TypeReference>() {
+ });
+ }
+
+ /**
+ * Get list values that are grouped by an CateogryID
+ *
+ * @param id
+ * The CateogryID to search for
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaAttributeValuesByCategoryId(long id) throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaAttributeValuesByCategoryID/" + id,
+ new TypeReference>() {
+ });
+
+ }
+
+ /**
+ *
+ * Get the direct children for a given AphiaID.
+ *
+ *
+ *
+ * Note: This methods might cause multiple calls of
+ * {@link #aphiaChildrenByAphiaId(long, boolean, long)} to receive all records
+ * in chunks of 50 records.
+ *
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaChildrenByAphiaId(long aphiaId, boolean marineOnly)
+ throws WormsClientException {
+ Collection totalResult = new ArrayList();
+ Collection singleResult;
+ long offset = 1;
+ do {
+ singleResult = aphiaChildrenByAphiaId(aphiaId, marineOnly, offset);
+ totalResult.addAll(singleResult);
+ offset += 50;
+ } while (singleResult.size() == 50);
+ return totalResult;
+ }
+
+ /**
+ * Get the direct children (max. 50) for a given AphiaID.
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @param offset
+ * Starting recordnumber, when retrieving next chunk of 50 records.
+ * First record has number {@code 1}.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaChildrenByAphiaId(long aphiaId, boolean marineOnly, long offset)
+ throws WormsClientException {
+ return this.request(
+ SERVICE_URL + "AphiaChildrenByAphiaID/" + aphiaId + "?marine_only=" + marineOnly + "&offset=" + offset,
+ new TypeReference>() {
+ });
+ }
+
+ /**
+ * Get the complete classification for one taxon. This also includes any sub or
+ * super ranks.
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @return classification of the taxon
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Classification aphiaClassificationByAphiaId(long aphiaId) throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaClassificationByAphiaID/" + aphiaId,
+ new TypeReference() {
+ });
+ }
+
+ /**
+ * Get all distributions for a given AphiaID External Identifiers
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @return all distributions
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaDistributionsByAphiaId(long aphiaId) throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaDistributionsByAphiaID/" + aphiaId,
+ new TypeReference>() {
+ });
+ }
+
+ /**
+ * Get any external identifier(s) for a given AphiaID
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @param type
+ * Type of external identifier to return.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaExternalIdByAphiaId(long aphiaId, ExternalIdentifierSource type)
+ throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaExternalIDByAphiaID/" + aphiaId + "?type=" + type.name(),
+ new TypeReference>() {
+ });
+ }
+
+ /**
+ * Get the AphiaID for a given name
+ *
+ * @param scientificName
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Long aphiaIdByName(String scientificName) throws WormsClientException {
+ try {
+ return this.request(
+ SERVICE_URL + "AphiaIDByName/" + URLEncoder.encode(scientificName, "UTF-8").replace("+", "%20"),
+ new TypeReference() {
+ });
+ } catch (UnsupportedEncodingException e) {
+ throw new WormsClientException(e);
+ }
+ }
+
+ /**
+ *
+ * Get a list of AphiaIDs with attribute tree for a given attribute definition
+ * ID Distributions.
+ *
+ *
+ *
+ * Note: This methods might cause multiple calls of
+ * {@link #aphiaIdsByAttributeKeyId(long, long)} to receive all records in
+ * chunks of 50 records.
+ *
+ *
+ * @param id
+ * The attribute definition id to search for
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaIdsByAttributeKeyId(long id) throws WormsClientException {
+ Collection totalResult = new ArrayList();
+ Collection singleResult;
+ long offset = 1;
+ do {
+ singleResult = aphiaIdsByAttributeKeyId(id, offset);
+ totalResult.addAll(singleResult);
+ offset += 50;
+ } while (singleResult.size() == 50);
+ return totalResult;
+ }
+
+ /**
+ * Get a list of AphiaIDs (max 50) with attribute tree for a given attribute
+ * definition ID Distributions.
+ *
+ * @param id
+ * The attribute definition id to search for
+ * @param offset
+ * Starting record number, when retrieving next chunk of (50)
+ * records. First record has number {@code 1}.
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaIdsByAttributeKeyId(long id, long offset) throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaIDsByAttributeKeyID/" + id,
+ new TypeReference>() {
+ });
+ }
+
+ /**
+ * Get the name for a given AphiaID
+ *
+ * @param aphiaId
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public String aphiaNameByAphiaId(long aphiaId) throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaNameByAphiaID/" + aphiaId, new TypeReference() {
+ });
+ }
+
+ /**
+ * Get the complete AphiaRecord for a given AphiaID
+ *
+ * @param aphiaId
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public AphiaRecord aphiaRecordByAphiaId(long aphiaId) throws WormsClientException {
+ return this.request(SERVICE_URL + "AphiaRecordByAphiaID/" + aphiaId, new TypeReference() {
+ });
+ }
+
+ /**
+ * Get the Aphia Record for a given external identifier Sources
+ *
+ * @param id
+ * @param type
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public AphiaRecord aphiaRecordByExternalId(String id, ExternalIdentifierSource type) throws WormsClientException {
+ try {
+ return this
+ .request(
+ SERVICE_URL + "AphiaRecordByExternalID/"
+ + URLEncoder.encode(id, "UTF-8").replace("+", "%20") + "?type=" + type.name(),
+ new TypeReference() {
+ });
+ } catch (UnsupportedEncodingException e) {
+ throw new WormsClientException(e);
+ }
+ }
+
+ /**
+ *
+ * Lists all AphiaRecords (max. 50) modified or added between a specific time
+ * interval
+ *
+ *
+ *
+ * Note: This methods might cause multiple request to receive all records
+ * in chunks of 50 records.
+ *
+ *
+ * @param statdate
+ * @param enddate
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaRecordsByDate(TemporalAccessor statdate, TemporalAccessor enddate,
+ boolean marineOnly) throws WormsClientException {
+ Collection totalResult = new ArrayList();
+ Collection singleResult;
+ long offset = 1;
+ do {
+ singleResult = aphiaRecordsByDate(statdate, enddate, marineOnly, offset);
+ totalResult.addAll(singleResult);
+ offset += 50;
+ } while (singleResult.size() == 50);
+ return totalResult;
+ }
+
+ /**
+ * Lists all AphiaRecords (max. 50) modified or added between a specific time
+ * interval
+ *
+ * @param statdate
+ * @param enddate
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @param offset
+ * Starting record number, when retrieving next chunk of (50)
+ * records. First record has number {@code 1}.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaRecordsByDate(TemporalAccessor statdate, TemporalAccessor enddate,
+ boolean marineOnly, long offset) throws WormsClientException {
+ try {
+ return this.request(SERVICE_URL + "AphiaRecordsByDate?startdate="
+ + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(statdate) + "&enddate="
+ + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(enddate) + "&marine_only=" + marineOnly + "&offset="
+ + offset, new TypeReference>() {
+ });
+ } catch (DateTimeException e) {
+ throw new WormsClientException(e);
+ }
+ }
+
+ /**
+ *
+ * For each given scientific name (may include authority), try to find one or
+ * more AphiaRecords, using the TAXAMATCH fuzzy matching algorithm by Tony Rees.
+ * This allows you to (fuzzy) match multiple names in one call.
+ *
+ *
+ *
+ * Note: This methods might cause multiple service request.
+ *
+ * Get one or more matching AphiaRecords for a given name.
+ *
+ *
+ *
+ * Note: This methods might cause multiple calls of
+ * {@link #aphiaRecordsByName(String, boolean, boolean, long)} to receive all
+ * records in chunks of 50 records.
+ *
+ *
+ * @param scientificName
+ * Name to search for
+ * @param like
+ * Add a "%"-sign added after the ScientificName (SQL LIKE function).
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaRecordsByName(String scientificName, boolean like, boolean marineOnly)
+ throws WormsClientException {
+ Collection totalResult = new ArrayList();
+ Collection singleResult;
+ long offset = 1;
+ do {
+ singleResult = aphiaRecordsByName(scientificName, like, marineOnly, offset);
+ totalResult.addAll(singleResult);
+ offset += 50;
+ } while (singleResult.size() == 50);
+ return totalResult;
+ }
+
+ /**
+ * Get one or more matching AphiaRecords (max. 50) for a given name.
+ *
+ * @param scientificName
+ * Name to search for
+ * @param like
+ * Add a "%"-sign added after the ScientificName (SQL LIKE function).
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @param offset
+ * Starting record number, when retrieving next chunk of (50)
+ * records. First record has number {@code 1}.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaRecordsByName(String scientificName, boolean like, boolean marineOnly,
+ long offset) throws WormsClientException {
+ try {
+ return this.request(
+ SERVICE_URL + "AphiaRecordsByName/"
+ + URLEncoder.encode(Objects.requireNonNull(scientificName), "UTF-8").replace("+", "%20")
+ + "?like=" + like + "&marine_only=" + marineOnly + "&offset=" + offset,
+ new TypeReference>() {
+ });
+ } catch (UnsupportedEncodingException e) {
+ throw new WormsClientException(e);
+ }
+ }
+
+ /**
+ * For each given scientific name, try to find one or more AphiaRecords (max.
+ * 50). This allows you to match multiple names in one call. Limited to 500
+ * names at once for performance reasons.
+ *
+ * @param scientificNames
+ * Collection of names to search for
+ * @param like
+ * Add a "%"-sign added after the ScientificName (SQL LIKE function).
+ * @param marineOnly
+ * Limit to marine taxa.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public List> aphiaRecordsByNames(List scientificNames, boolean like,
+ boolean marineOnly) throws WormsClientException {
+ return requestPartitioned(SERVICE_URL + "AphiaRecordsByNames?scientificnames[]=", scientificNames,
+ "&scientificnames[]=", 500, "&like=" + like + "&marine_only=" + marineOnly);
+ }
+
+ /**
+ *
+ * Get one or more Aphia Records for a given vernacular.
+ *
+ *
+ *
+ * Note: This methods might cause multiple request to receive all records
+ * in chunks of 50 records.
+ *
+ *
+ * @param vernacular
+ * The vernacular to find records for
+ * @param like
+ * Add a "%"-sign before and after the input (SQL LIKE ‘%vernacular%’
+ * function).
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaRecordsByVernacular(String vernacular, boolean like)
+ throws WormsClientException {
+ Collection totalResult = new ArrayList();
+ Collection singleResult;
+ long offset = 1;
+ do {
+ singleResult = aphiaRecordsByVernacular(vernacular, like, offset);
+ totalResult.addAll(singleResult);
+ offset += 50;
+ } while (singleResult.size() == 50);
+ return totalResult;
+ }
+
+ /**
+ *
+ * Get one or more Aphia Records (max. 50) for a given vernacular.
+ *
+ * @param vernacular
+ * The vernacular to find records for
+ * @param like
+ * Add a "%"-sign before and after the input (SQL LIKE ‘%vernacular%’
+ * function).
+ * @param offset
+ * Starting record number, when retrieving next chunk of (50)
+ * records. First record has number {@code 1}.
+ * @return
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection aphiaRecordsByVernacular(String vernacular, boolean like, long offset)
+ throws WormsClientException {
+ try {
+ return this.request(SERVICE_URL + "AphiaRecordsByVernacular/"
+ + URLEncoder.encode(Objects.requireNonNull(vernacular), "UTF-8").replace("+", "%20") + "?like="
+ + like + "&offset=" + offset, new TypeReference>() {
+ });
+ } catch (UnsupportedEncodingException e) {
+ throw new WormsClientException(e);
+ }
+ }
+
+ /**
+ * Get one or more sources/references including links, for one AphiaID
+ *
+ * @param aphiaId
+ * The AphiaID to search for
+ * @throws WormsClientException
+ *
+ * @since 1.0.0
+ */
+ public Collection