update to be compatible with the latest worms version
This commit is contained in:
parent
5eed4dbfc1
commit
ff1ea51e30
40
.classpath
40
.classpath
|
@ -1,10 +1,38 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
<attributes>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
<attribute name="optional" value="true"/>
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
</attributes>
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
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.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
|
||||||
|
|
37
pom.xml
37
pom.xml
|
@ -5,13 +5,13 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<version>1.0.0</version>
|
<version>1.1.0</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.gcube.data.spd</groupId>
|
<groupId>org.gcube.data.spd</groupId>
|
||||||
<artifactId>worms-spd-plugin</artifactId>
|
<artifactId>worms-spd-plugin</artifactId>
|
||||||
<version>1.8.0-SNAPSHOT</version>
|
<version>1.8.1-SNAPSHOT</version>
|
||||||
<name>worms-plugin</name>
|
<name>worms-plugin</name>
|
||||||
<description>worms plugin for species manager service</description>
|
<description>worms plugin for species manager service</description>
|
||||||
|
|
||||||
|
@ -41,35 +41,20 @@
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<artifactId>ic-client</artifactId>
|
<artifactId>ic-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.axis/axis -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.axis</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>axis</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>1.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jaxrpc-api</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>1.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-discovery</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>commons-discovery</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>0.5</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>wsdl4j</groupId>
|
|
||||||
<artifactId>wsdl4j</artifactId>
|
|
||||||
<version>1.6.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data.spd</groupId>
|
<groupId>org.gcube.data.spd</groupId>
|
||||||
<artifactId>spd-model</artifactId>
|
<artifactId>spd-model</artifactId>
|
||||||
|
@ -121,7 +106,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>2.2</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptors>
|
<descriptors>
|
||||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||||
|
|
|
@ -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<Attribute> attributes;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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<Attribute> children;
|
||||||
|
}
|
|
@ -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<AttributeKey> children;
|
||||||
|
}
|
|
@ -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<AttributeValue> children;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* A client for the <a href="http://www.marinespecies.org/rest/">World Register
|
||||||
|
* of Marine Species REST API</a>. Please refer to the <a
|
||||||
|
* href=""http://www.marinespecies.org/about.php#terms>terms of use</a>.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* <b>Acknowledgments:</b> 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.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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<AttributeKey> aphiaAttributeKeysById(long id, boolean includeChildren)
|
||||||
|
throws WormsClientException {
|
||||||
|
return this.request(
|
||||||
|
SERVICE_URL + "AphiaAttributeKeysByID/" + id + ((includeChildren) ? "?include_inherited=true" : ""),
|
||||||
|
new TypeReference<ArrayList<AttributeKey>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<Attribute> aphiaAttributesByAphiaId(long aphiaId, boolean includeChildren)
|
||||||
|
throws WormsClientException {
|
||||||
|
return this.request(
|
||||||
|
SERVICE_URL + "AphiaAttributesByAphiaID/" + aphiaId
|
||||||
|
+ ((includeChildren) ? "?include_inherited=true" : ""),
|
||||||
|
new TypeReference<ArrayList<Attribute>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list values that are grouped by an CateogryID
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* The CateogryID to search for
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public Collection<AttributeValue> aphiaAttributeValuesByCategoryId(long id) throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaAttributeValuesByCategoryID/" + id,
|
||||||
|
new TypeReference<ArrayList<AttributeValue>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Get the direct children for a given AphiaID.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> This methods might cause multiple calls of
|
||||||
|
* {@link #aphiaChildrenByAphiaId(long, boolean, long)} to receive all records
|
||||||
|
* in chunks of 50 records.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param aphiaId
|
||||||
|
* The AphiaID to search for
|
||||||
|
* @param marineOnly
|
||||||
|
* Limit to marine taxa.
|
||||||
|
* @return
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public Collection<AphiaRecord> aphiaChildrenByAphiaId(long aphiaId, boolean marineOnly)
|
||||||
|
throws WormsClientException {
|
||||||
|
Collection<AphiaRecord> totalResult = new ArrayList<AphiaRecord>();
|
||||||
|
Collection<AphiaRecord> 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<AphiaRecord> aphiaChildrenByAphiaId(long aphiaId, boolean marineOnly, long offset)
|
||||||
|
throws WormsClientException {
|
||||||
|
return this.request(
|
||||||
|
SERVICE_URL + "AphiaChildrenByAphiaID/" + aphiaId + "?marine_only=" + marineOnly + "&offset=" + offset,
|
||||||
|
new TypeReference<ArrayList<AphiaRecord>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<Classification>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<Distribution> aphiaDistributionsByAphiaId(long aphiaId) throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaDistributionsByAphiaID/" + aphiaId,
|
||||||
|
new TypeReference<ArrayList<Distribution>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<String> aphiaExternalIdByAphiaId(long aphiaId, ExternalIdentifierSource type)
|
||||||
|
throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaExternalIDByAphiaID/" + aphiaId + "?type=" + type.name(),
|
||||||
|
new TypeReference<ArrayList<String>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<Long>() {
|
||||||
|
});
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new WormsClientException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Get a list of AphiaIDs with attribute tree for a given attribute definition
|
||||||
|
* ID Distributions.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> This methods might cause multiple calls of
|
||||||
|
* {@link #aphiaIdsByAttributeKeyId(long, long)} to receive all records in
|
||||||
|
* chunks of 50 records.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* The attribute definition id to search for
|
||||||
|
* @return
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public Collection<AphiaAttributeSets> aphiaIdsByAttributeKeyId(long id) throws WormsClientException {
|
||||||
|
Collection<AphiaAttributeSets> totalResult = new ArrayList<AphiaAttributeSets>();
|
||||||
|
Collection<AphiaAttributeSets> 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<AphiaAttributeSets> aphiaIdsByAttributeKeyId(long id, long offset) throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaIDsByAttributeKeyID/" + id,
|
||||||
|
new TypeReference<ArrayList<AphiaAttributeSets>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<String>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<AphiaRecord>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<AphiaRecord>() {
|
||||||
|
});
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new WormsClientException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Lists all AphiaRecords (max. 50) modified or added between a specific time
|
||||||
|
* interval
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> This methods might cause multiple request to receive all records
|
||||||
|
* in chunks of 50 records.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param statdate
|
||||||
|
* @param enddate
|
||||||
|
* @param marineOnly
|
||||||
|
* Limit to marine taxa.
|
||||||
|
* @return
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public Collection<AphiaRecord> aphiaRecordsByDate(TemporalAccessor statdate, TemporalAccessor enddate,
|
||||||
|
boolean marineOnly) throws WormsClientException {
|
||||||
|
Collection<AphiaRecord> totalResult = new ArrayList<AphiaRecord>();
|
||||||
|
Collection<AphiaRecord> 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<AphiaRecord> 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<ArrayList<AphiaRecord>>() {
|
||||||
|
});
|
||||||
|
} catch (DateTimeException e) {
|
||||||
|
throw new WormsClientException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 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.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> This methods might cause multiple service request.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param scientificNames
|
||||||
|
* Names to search for
|
||||||
|
* @param marineOnly
|
||||||
|
* Limit to marine taxa.
|
||||||
|
* @return
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public List<Collection<AphiaRecord>> aphiaRecordsByMatchNames(List<String> scientificNames, boolean marineOnly)
|
||||||
|
throws WormsClientException {
|
||||||
|
return requestPartitioned(SERVICE_URL + "AphiaRecordsByMatchNames?scientificnames[]=", scientificNames,
|
||||||
|
"&scientificnames[]=", 50, "&marine_only=" + marineOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Get one or more matching AphiaRecords for a given name.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> This methods might cause multiple calls of
|
||||||
|
* {@link #aphiaRecordsByName(String, boolean, boolean, long)} to receive all
|
||||||
|
* records in chunks of 50 records.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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<AphiaRecord> aphiaRecordsByName(String scientificName, boolean like, boolean marineOnly)
|
||||||
|
throws WormsClientException {
|
||||||
|
Collection<AphiaRecord> totalResult = new ArrayList<AphiaRecord>();
|
||||||
|
Collection<AphiaRecord> 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<AphiaRecord> 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<ArrayList<AphiaRecord>>() {
|
||||||
|
});
|
||||||
|
} 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<Collection<AphiaRecord>> aphiaRecordsByNames(List<String> scientificNames, boolean like,
|
||||||
|
boolean marineOnly) throws WormsClientException {
|
||||||
|
return requestPartitioned(SERVICE_URL + "AphiaRecordsByNames?scientificnames[]=", scientificNames,
|
||||||
|
"&scientificnames[]=", 500, "&like=" + like + "&marine_only=" + marineOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Get one or more Aphia Records for a given vernacular.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> This methods might cause multiple request to receive all records
|
||||||
|
* in chunks of 50 records.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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<AphiaRecord> aphiaRecordsByVernacular(String vernacular, boolean like)
|
||||||
|
throws WormsClientException {
|
||||||
|
Collection<AphiaRecord> totalResult = new ArrayList<AphiaRecord>();
|
||||||
|
Collection<AphiaRecord> 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<AphiaRecord> 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<ArrayList<AphiaRecord>>() {
|
||||||
|
});
|
||||||
|
} 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<Source> aphiaSourcesByAphiaId(long aphiaId) throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaSourcesByAphiaID/" + aphiaId, new TypeReference<ArrayList<Source>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all synonyms for a given AphiaID.
|
||||||
|
*
|
||||||
|
* @param aphiaId
|
||||||
|
* The AphiaID to search for
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public Collection<AphiaRecord> aphiaSynonymsByAphiaId(long aphiaId) throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaSynonymsByAphiaID/" + aphiaId,
|
||||||
|
new TypeReference<ArrayList<AphiaRecord>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all vernaculars for a given AphiaID
|
||||||
|
*
|
||||||
|
* @param aphiaId
|
||||||
|
* The AphiaID to search for
|
||||||
|
* @return
|
||||||
|
* @throws WormsClientException
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public Collection<Vernacular> aphiaVernacularsByAphiaId(long aphiaId) throws WormsClientException {
|
||||||
|
return this.request(SERVICE_URL + "AphiaVernacularsByAphiaID/" + aphiaId,
|
||||||
|
new TypeReference<ArrayList<Vernacular>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private <T> List<Collection<T>> ensureEmptyCollections(List<Collection<T>> list, long count) {
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
// add omitted empty collections
|
||||||
|
return Stream.generate(() -> {
|
||||||
|
return (Collection<T>) Collections.emptyList();
|
||||||
|
}).limit(count).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private <T> T request(String url, TypeReference<T> t) throws WormsClientException {
|
||||||
|
try {
|
||||||
|
URL urlConn = new URL(url);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection)urlConn.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setDoInput(true);
|
||||||
|
connection.setRequestProperty("Content-type", "application/json");
|
||||||
|
if (connection.getResponseCode() == 200) {
|
||||||
|
try (InputStream content = (InputStream)connection.getContent()) {
|
||||||
|
return JSON.readValue(content, t);
|
||||||
|
} catch (JsonParseException | JsonMappingException e) {
|
||||||
|
throw new WormsClientException("\"" + url + "\" returned invalid response.", e);
|
||||||
|
}
|
||||||
|
} else if (connection.getResponseCode() == 204) {
|
||||||
|
if (JSON.getTypeFactory().constructType(t).isContainerType()) {
|
||||||
|
try {
|
||||||
|
return (T) JSON.getTypeFactory().constructType(t).getRawClass().newInstance();
|
||||||
|
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||||
|
| SecurityException e) {
|
||||||
|
throw new WormsClientException("Failed to instantiate empty result for \"" + url + "\".", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new WormsClientException(
|
||||||
|
"\"" + url + "\" returned " + connection.getResponseCode() + ".");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new WormsClientException("Request failed on \"" + url + "\".", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Collection<AphiaRecord>> requestPartitioned(String requestPrefix, List<String> names,
|
||||||
|
String requestNameDelimiter, int maxNamesPerRequest, String requestPostfix) throws WormsClientException {
|
||||||
|
List<Collection<AphiaRecord>> totalResult = new ArrayList<Collection<AphiaRecord>>();
|
||||||
|
StringBuilder requestUrl = new StringBuilder(requestPrefix);
|
||||||
|
long requestNames = 0;
|
||||||
|
for (String scientificName : names) {
|
||||||
|
try {
|
||||||
|
String scientificNameEncoded = URLEncoder.encode(scientificName, "UTF-8").replace("+", "%20");
|
||||||
|
if (requestNames == maxNamesPerRequest || requestUrl.length() + requestNameDelimiter.length()
|
||||||
|
+ scientificNameEncoded.length() + requestPostfix.length() > HTTP_MAX_URL_BYTES) {
|
||||||
|
// reached max number of names per request or max length of URL
|
||||||
|
|
||||||
|
// request partial result and add to total results
|
||||||
|
totalResult.addAll(ensureEmptyCollections(this.request(requestUrl.append(requestPostfix).toString(),
|
||||||
|
new TypeReference<ArrayList<Collection<AphiaRecord>>>() {
|
||||||
|
}), requestNames));
|
||||||
|
// reset request
|
||||||
|
requestUrl = new StringBuilder(requestPrefix);
|
||||||
|
requestNames = 0;
|
||||||
|
}
|
||||||
|
if (requestNames != 0) {
|
||||||
|
requestUrl.append(requestNameDelimiter);
|
||||||
|
}
|
||||||
|
requestUrl.append(scientificNameEncoded);
|
||||||
|
requestNames++;
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new WormsClientException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// request last partial result and add to total results
|
||||||
|
totalResult.addAll(ensureEmptyCollections(this.request(requestUrl.append(requestPostfix).toString(),
|
||||||
|
new TypeReference<ArrayList<Collection<AphiaRecord>>>() {
|
||||||
|
}), requestNames));
|
||||||
|
|
||||||
|
return totalResult;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
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 WormsClientException extends Exception {
|
||||||
|
private static final long serialVersionUID = -7269153574516662753L;
|
||||||
|
|
||||||
|
public WormsClientException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public WormsClientException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WormsClientException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WormsClientException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
package org.gcube.data.spd.wormsplugin;
|
package org.gcube.data.spd.wormsplugin;
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.data.spd.model.CommonName;
|
import org.gcube.data.spd.model.CommonName;
|
||||||
|
@ -14,25 +14,27 @@ import org.gcube.data.spd.model.products.TaxonomyStatus.Status;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import aphia.v1_0.worms.AphiaRecord;
|
import de.uni_jena.cs.fusion.client.worms.AphiaRecord;
|
||||||
import aphia.v1_0.worms.Classification;
|
import de.uni_jena.cs.fusion.client.worms.Classification;
|
||||||
import aphia.v1_0.worms.Vernacular;
|
import de.uni_jena.cs.fusion.client.worms.Vernacular;
|
||||||
|
import de.uni_jena.cs.fusion.client.worms.WormsClientException;
|
||||||
|
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
static Logger logger = LoggerFactory.getLogger(Utils.class);
|
static Logger logger = LoggerFactory.getLogger(Utils.class);
|
||||||
|
|
||||||
public static Taxon retrieveTaxon(Classification classification, int aphiaID){
|
public static Taxon retrieveTaxon(Classification classification, long aphiaID){
|
||||||
Taxon taxon = null;
|
Taxon taxon = null;
|
||||||
while (classification.getAphiaID()!=aphiaID){
|
while (classification.aphiaId!=aphiaID){
|
||||||
Taxon newTaxon = new Taxon(classification.getAphiaID()+"");
|
Taxon newTaxon = new Taxon(classification.aphiaId+"");
|
||||||
if (taxon!=null)
|
if (taxon!=null)
|
||||||
newTaxon.setParent(taxon);
|
newTaxon.setParent(taxon);
|
||||||
newTaxon.setRank(classification.getRank());
|
newTaxon.setRank(classification.taxonomicRank);
|
||||||
// logger.trace(classification.getRank());
|
// logger.trace(classification.getRank());
|
||||||
// logger.trace(classification.getScientificname());
|
// logger.trace(classification.getScientificname());
|
||||||
newTaxon.setScientificName(classification.getScientificname());
|
newTaxon.setScientificName(classification.scientificName);
|
||||||
classification = classification.getChild();
|
classification = classification.child;
|
||||||
taxon = newTaxon;
|
taxon = newTaxon;
|
||||||
}
|
}
|
||||||
// logger.trace(taxon);
|
// logger.trace(taxon);
|
||||||
|
@ -40,52 +42,52 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static TaxonomyItem retrieveTaxonomy(Classification classification, int aphiaID){
|
public static TaxonomyItem retrieveTaxonomy(Classification classification, long aphiaID){
|
||||||
List<CommonName> listCommNames = new ArrayList<CommonName> ();
|
List<CommonName> listCommNames = new ArrayList<CommonName> ();
|
||||||
TaxonomyItem taxon = null;
|
TaxonomyItem taxon = null;
|
||||||
|
|
||||||
while (classification.getAphiaID()!=aphiaID){
|
while (classification.aphiaId!=aphiaID){
|
||||||
|
|
||||||
int id = classification.getAphiaID();
|
int id = classification.aphiaId;
|
||||||
TaxonomyItem newTaxon = new TaxonomyItem(id+"");
|
TaxonomyItem newTaxon = new TaxonomyItem(id+"");
|
||||||
if (taxon!=null)
|
if (taxon!=null)
|
||||||
newTaxon.setParent(taxon);
|
newTaxon.setParent(taxon);
|
||||||
|
|
||||||
newTaxon.setRank(classification.getRank());
|
newTaxon.setRank(classification.taxonomicRank);
|
||||||
newTaxon.setScientificName(classification.getScientificname());
|
newTaxon.setScientificName(classification.scientificName);
|
||||||
newTaxon.setCredits(Utils.createCredits());
|
newTaxon.setCredits(Utils.createCredits());
|
||||||
AphiaRecord record = null;
|
AphiaRecord record = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
record = WormsPlugin.binding.getAphiaRecordByID(id);
|
record = WormsPlugin.wormsClient.aphiaRecordByAphiaId(id);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("Error getAphiaRecordByID ", e);
|
logger.error("Error getAphiaRecordByID ", e);
|
||||||
}
|
}
|
||||||
if (record != null){
|
if (record != null){
|
||||||
newTaxon.setCitation(record.getCitation());
|
newTaxon.setCitation(record.citation);
|
||||||
newTaxon.setLsid(record.getLsid());
|
newTaxon.setLsid(record.lsid);
|
||||||
newTaxon.setScientificNameAuthorship(record.getAuthority());
|
newTaxon.setScientificNameAuthorship(record.authority);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vernacular[] vernaculars;
|
Collection<Vernacular> vernaculars;
|
||||||
try {
|
try {
|
||||||
vernaculars = WormsPlugin.binding.getAphiaVernacularsByID(classification.getAphiaID());
|
vernaculars = WormsPlugin.wormsClient.aphiaVernacularsByAphiaId(classification.aphiaId);
|
||||||
if (vernaculars!=null){
|
if (vernaculars!=null){
|
||||||
// logger.debug("found vernacular name");
|
// logger.debug("found vernacular name");
|
||||||
for (Vernacular vernacular : vernaculars) {
|
for (Vernacular vernacular : vernaculars) {
|
||||||
if (vernacular.getLanguage_code()!=null){
|
if (vernacular.languageCode!=null){
|
||||||
CommonName a = new CommonName(vernacular.getLanguage(),vernacular.getVernacular());
|
CommonName a = new CommonName(vernacular.language,vernacular.vernacular);
|
||||||
listCommNames.add(a);
|
listCommNames.add(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (WormsClientException e) {
|
||||||
logger.error("RemoteException", e);
|
logger.error("RemoteException", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
newTaxon.setCommonNames(listCommNames);
|
newTaxon.setCommonNames(listCommNames);
|
||||||
newTaxon.setStatus(new TaxonomyStatus("accepted", Status.ACCEPTED));
|
newTaxon.setStatus(new TaxonomyStatus("accepted", Status.ACCEPTED));
|
||||||
classification = classification.getChild();
|
classification = classification.child;
|
||||||
taxon = newTaxon;
|
taxon = newTaxon;
|
||||||
}
|
}
|
||||||
return taxon;
|
return taxon;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.data.spd.wormsplugin;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,36 +32,24 @@ import org.gcube.data.spd.wormsplugin.capabilities.NamesMappingImpl;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import aphia.v1_0.worms.AphiaRecord;
|
import de.uni_jena.cs.fusion.client.worms.AphiaRecord;
|
||||||
import aphia.v1_0.worms.Source;
|
import de.uni_jena.cs.fusion.client.worms.Source;
|
||||||
import aphia.v1_0.worms.Vernacular;
|
import de.uni_jena.cs.fusion.client.worms.Vernacular;
|
||||||
|
import de.uni_jena.cs.fusion.client.worms.WormsClient;
|
||||||
|
import de.uni_jena.cs.fusion.client.worms.WormsClientException;
|
||||||
|
|
||||||
|
|
||||||
public class WormsPlugin extends AbstractPlugin {
|
public class WormsPlugin extends AbstractPlugin {
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(WormsPlugin.class);
|
private Logger logger = LoggerFactory.getLogger(WormsPlugin.class);
|
||||||
public static String credits = "This information object has been generated via the Species Product Discovery service on XDATEX by interfacing with World Register of Marine Species (http://www.marinespecies.org/)";
|
public static String credits = "This information object has been generated via the Species Product Discovery service on XDATEX by interfacing with World Register of Marine Species (http://www.marinespecies.org/)";
|
||||||
public static aphia.v1_0.worms.AphiaNameServiceBindingStub binding;
|
|
||||||
public static String baseurl;
|
public static WormsClient wormsClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(ServiceEndpoint res) throws Exception {
|
public void initialize(ServiceEndpoint res) throws Exception {
|
||||||
setUseCache(true);
|
setUseCache(true);
|
||||||
try {
|
wormsClient = new WormsClient();
|
||||||
for (AccessPoint ap:res.profile().accessPoints()) {
|
|
||||||
if (ap.name().equals("portType")){
|
|
||||||
baseurl = ap.address();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
binding = (aphia.v1_0.worms.AphiaNameServiceBindingStub)
|
|
||||||
new aphia.v1_0.worms.AphiaNameServiceLocator().getAphiaNameServicePort(new URL(baseurl));
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (javax.xml.rpc.ServiceException jre) {
|
|
||||||
logger.error("error contacting worms service", jre);
|
|
||||||
throw jre;
|
|
||||||
}
|
|
||||||
super.initialize(res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,73 +92,74 @@ public class WormsPlugin extends AbstractPlugin {
|
||||||
|
|
||||||
DataProvider dp = new DataProvider("worms");
|
DataProvider dp = new DataProvider("worms");
|
||||||
dp.setName("Worms");
|
dp.setName("Worms");
|
||||||
AphiaRecord[] records = null;
|
Collection<AphiaRecord> records = null;
|
||||||
List<CommonName> listCommNames = new ArrayList<CommonName> ();
|
List<CommonName> listCommNames = new ArrayList<CommonName> ();
|
||||||
|
|
||||||
final int offsetlimit=50;
|
final int offsetlimit=50;
|
||||||
int offset =1;
|
int offset =1;
|
||||||
do{
|
do{
|
||||||
if (type.equals("vernacular"))
|
if (type.equals("vernacular"))
|
||||||
records = binding.getAphiaRecordsByVernacular(word, true, offset);
|
records = wormsClient.aphiaRecordsByVernacular(word, true, offset);
|
||||||
else if (type.equals("scientific"))
|
else if (type.equals("scientific"))
|
||||||
records = binding.getAphiaRecords(word, true, false, false, offset);
|
records = wormsClient.aphiaRecordsByName(word, true, false, offset);
|
||||||
|
|
||||||
|
|
||||||
if (records!=null){
|
if (records!=null){
|
||||||
for (AphiaRecord record : records){
|
for (AphiaRecord record : records){
|
||||||
//logger.debug("found record in worms");
|
//logger.debug("found record in worms");
|
||||||
Source[] sources = null;
|
Collection<Source> sources = null;
|
||||||
|
|
||||||
if (record==null || (sources= binding.getSourcesByAphiaID(record.getAphiaID()))==null || record.getScientificname()==null)
|
if (record==null || (sources= wormsClient.aphiaSourcesByAphiaId(record.aphiaId))==null || record.scientificName==null)
|
||||||
continue;
|
continue;
|
||||||
for (Source source : sources){
|
for (Source source : sources){
|
||||||
//logger.debug("found source in worms");
|
//logger.debug("found source in worms");
|
||||||
if (source==null)
|
if (source==null)
|
||||||
continue;
|
continue;
|
||||||
if (source.getReference()!=null){
|
if (source.reference!=null){
|
||||||
// logger.debug("source has fulltext not null");
|
// logger.debug("source has fulltext not null");
|
||||||
DataSet ds = new DataSet(record.getAphiaID()+"||"+source.getReference().hashCode());
|
DataSet ds = new DataSet(record.aphiaId+"||"+source.reference.hashCode());
|
||||||
ds.setName(source.getReference());
|
ds.setName(source.reference);
|
||||||
if (source.getUrl()!=null) ds.setCitation(source.getUrl());
|
if (source.url!=null) ds.setCitation(source.url);
|
||||||
ds.setDataProvider(dp);
|
ds.setDataProvider(dp);
|
||||||
ResultItem item = new ResultItem(record.getAphiaID()+"", record.getScientificname());
|
ResultItem item = new ResultItem(record.aphiaId+"", record.scientificName);
|
||||||
// Calendar now = Calendar.getInstance();
|
// Calendar now = Calendar.getInstance();
|
||||||
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
// String credits ="Biodiversity data published by: "+ds.getName()+" (Accessed through WoRMS web service, "+format.format(now.getTime())+")";
|
// String credits ="Biodiversity data published by: "+ds.getName()+" (Accessed through WoRMS web service, "+format.format(now.getTime())+")";
|
||||||
AphiaRecord[] synonyms = binding.getAphiaSynonymsByID(record.getAphiaID());
|
Collection<AphiaRecord> synonyms = wormsClient.aphiaSynonymsByAphiaId(record.aphiaId);
|
||||||
if (synonyms!=null && synonyms.length>0){
|
if (synonyms!=null && synonyms.size()>0){
|
||||||
Product product = new Product(ProductType.Synonym, item.getId());
|
Product product = new Product(ProductType.Synonym, item.getId());
|
||||||
product.setCount(synonyms.length);
|
product.setCount(synonyms.size());
|
||||||
item.setProducts(Collections.singletonList(product));
|
item.setProducts(Collections.singletonList(product));
|
||||||
}
|
}
|
||||||
Vernacular[] vernaculars = binding.getAphiaVernacularsByID(record.getAphiaID());
|
Collection<Vernacular> vernaculars = wormsClient.aphiaVernacularsByAphiaId(record.aphiaId);
|
||||||
|
|
||||||
if (vernaculars!=null){
|
if (vernaculars!=null){
|
||||||
// logger.debug("found vernacular name");
|
// logger.debug("found vernacular name");
|
||||||
for (Vernacular vernacular : vernaculars) {
|
for (Vernacular vernacular : vernaculars) {
|
||||||
if (vernacular.getLanguage_code()!=null){
|
if (vernacular.languageCode!=null){
|
||||||
CommonName a = new CommonName(vernacular.getLanguage(),vernacular.getVernacular());
|
CommonName a = new CommonName(vernacular.language,vernacular.vernacular);
|
||||||
listCommNames.add(a);
|
listCommNames.add(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setScientificNameAuthorship(record.getAuthority());
|
item.setScientificNameAuthorship(record.authority);
|
||||||
item.setLsid(record.getLsid());
|
item.setLsid(record.lsid);
|
||||||
|
|
||||||
item.setCitation(record.getCitation());
|
item.setCitation(record.citation);
|
||||||
item.setCredits(Utils.createCredits());
|
item.setCredits(Utils.createCredits());
|
||||||
|
|
||||||
item.setCommonNames(listCommNames);
|
item.setCommonNames(listCommNames);
|
||||||
|
|
||||||
|
|
||||||
item.setDataSet(ds);
|
item.setDataSet(ds);
|
||||||
|
|
||||||
if (record.getRank()!=null)
|
if (record.taxonomicRank!=null)
|
||||||
item.setRank(record.getRank());
|
item.setRank(record.taxonomicRank);
|
||||||
else if (record.getScientificname().equals("Biota"))
|
else if (record.scientificName.equals("Biota"))
|
||||||
item.setRank("Superdomain");
|
item.setRank("Superdomain");
|
||||||
|
|
||||||
|
|
||||||
item.setParent(Utils.retrieveTaxon(binding.getAphiaClassificationByID(record.getAphiaID()), record.getAphiaID()));
|
item.setParent(Utils.retrieveTaxon(wormsClient.aphiaClassificationByAphiaId(record.aphiaId), record.aphiaId));
|
||||||
if (writer.isAlive())
|
if (writer.isAlive())
|
||||||
writer.write(item);
|
writer.write(item);
|
||||||
else
|
else
|
||||||
|
@ -180,9 +170,9 @@ public class WormsPlugin extends AbstractPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset+=offsetlimit;
|
offset+=offsetlimit;
|
||||||
} while (records!=null && records.length==offsetlimit);
|
} while (records!=null && records.size()==offsetlimit);
|
||||||
|
|
||||||
} catch (RemoteException e) {
|
} catch (WormsClientException e) {
|
||||||
logger.error("error contacting WoRMS service", e);
|
logger.error("error contacting WoRMS service", e);
|
||||||
throw new ExternalRepositoryException(e);
|
throw new ExternalRepositoryException(e);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.data.spd.wormsplugin.capabilities;
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -26,9 +27,11 @@ import org.gcube.data.spd.wormsplugin.WormsPlugin;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import aphia.v1_0.worms.AphiaRecord;
|
import de.uni_jena.cs.fusion.client.worms.AphiaRecord;
|
||||||
import aphia.v1_0.worms.Source;
|
import de.uni_jena.cs.fusion.client.worms.Source;
|
||||||
import aphia.v1_0.worms.Vernacular;
|
import de.uni_jena.cs.fusion.client.worms.Vernacular;
|
||||||
|
import de.uni_jena.cs.fusion.client.worms.WormsClientException;
|
||||||
|
|
||||||
|
|
||||||
public class ClassificationCapabilityImpl extends ClassificationCapability {
|
public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
|
|
||||||
|
@ -51,11 +54,11 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
// logger.trace(id);
|
// logger.trace(id);
|
||||||
List<TaxonomyItem> list = new ArrayList<TaxonomyItem>();
|
List<TaxonomyItem> list = new ArrayList<TaxonomyItem>();
|
||||||
try {
|
try {
|
||||||
AphiaRecord[] records;
|
Collection<AphiaRecord> records;
|
||||||
final int offsetlimit=50;
|
final int offsetlimit=50;
|
||||||
int offset =1;
|
int offset =1;
|
||||||
do{
|
do{
|
||||||
records = WormsPlugin.binding.getAphiaChildrenByID(Integer.parseInt(id), offset);
|
records = WormsPlugin.wormsClient.aphiaChildrenByAphiaId(Long.parseLong(id), false, offset);
|
||||||
|
|
||||||
if (records!=null){
|
if (records!=null){
|
||||||
// logger.debug(records.length);
|
// logger.debug(records.length);
|
||||||
|
@ -66,7 +69,7 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset+=offsetlimit;
|
offset+=offsetlimit;
|
||||||
} while (records!=null && records.length==offsetlimit);
|
} while (records!=null && records.size()==offsetlimit);
|
||||||
}catch (NumberFormatException e) {
|
}catch (NumberFormatException e) {
|
||||||
logger.error("id not valid",e);
|
logger.error("id not valid",e);
|
||||||
throw new IdNotValidException(e);
|
throw new IdNotValidException(e);
|
||||||
|
@ -81,20 +84,20 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
|
|
||||||
public void retrieveTaxa(ObjectWriter<TaxonomyItem> writer, String word, RecordType type) throws ExternalRepositoryException{
|
public void retrieveTaxa(ObjectWriter<TaxonomyItem> writer, String word, RecordType type) throws ExternalRepositoryException{
|
||||||
|
|
||||||
Set<Integer> hash = new HashSet<Integer>();
|
Set<Long> hash = new HashSet<Long>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AphiaRecord[] records = null;
|
Collection<AphiaRecord> records = null;
|
||||||
|
|
||||||
final int offsetlimit=50;
|
final int offsetlimit=50;
|
||||||
int offset =1;
|
int offset =1;
|
||||||
do{
|
do{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SCIENTIFIC:
|
case SCIENTIFIC:
|
||||||
records = WormsPlugin.binding.getAphiaRecords(word, true, false, false, offset);
|
records = WormsPlugin.wormsClient.aphiaRecordsByName(word, true, false, offset);
|
||||||
break;
|
break;
|
||||||
case VERNACULAR:
|
case VERNACULAR:
|
||||||
records = WormsPlugin.binding.getAphiaRecordsByVernacular(word, true, offset);
|
records = WormsPlugin.wormsClient.aphiaRecordsByVernacular(word, true, offset);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.warn("invalid record type");
|
logger.warn("invalid record type");
|
||||||
|
@ -104,11 +107,11 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
|
|
||||||
if (records!=null){
|
if (records!=null){
|
||||||
for (AphiaRecord record : records){
|
for (AphiaRecord record : records){
|
||||||
if (hash.contains(record.getAphiaID())){
|
if (hash.contains(record.aphiaId)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash.add(record.getAphiaID());
|
hash.add(record.aphiaId);
|
||||||
|
|
||||||
TaxonomyItem item = createItem(record, true);
|
TaxonomyItem item = createItem(record, true);
|
||||||
if ((item != null) && (writer.isAlive()))
|
if ((item != null) && (writer.isAlive()))
|
||||||
|
@ -120,7 +123,7 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
|
|
||||||
|
|
||||||
offset+=offsetlimit;
|
offset+=offsetlimit;
|
||||||
} while (records!=null && records.length==offsetlimit);
|
} while (records!=null && records.size()==offsetlimit);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("error contacting worms service", e);
|
logger.error("error contacting worms service", e);
|
||||||
|
@ -130,33 +133,33 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
}
|
}
|
||||||
|
|
||||||
//create TaxonomyItem
|
//create TaxonomyItem
|
||||||
private TaxonomyItem createItem(AphiaRecord record, Boolean flag) throws RemoteException {
|
private TaxonomyItem createItem(AphiaRecord record, Boolean flag) throws WormsClientException {
|
||||||
TaxonomyItem item = null;
|
TaxonomyItem item = null;
|
||||||
String scientificname = record.getScientificname();
|
String scientificname = record.scientificName;
|
||||||
// logger.trace("scientificname " + scientificname);
|
// logger.trace("scientificname " + scientificname);
|
||||||
if (scientificname != null ){
|
if (scientificname != null ){
|
||||||
|
|
||||||
item = new TaxonomyItem(record.getAphiaID()+"");
|
item = new TaxonomyItem(record.aphiaId+"");
|
||||||
|
|
||||||
item.setScientificName(record.getScientificname());
|
item.setScientificName(record.scientificName);
|
||||||
item.setScientificNameAuthorship(record.getAuthority());
|
item.setScientificNameAuthorship(record.authority);
|
||||||
item.setLsid(record.getLsid());
|
item.setLsid(record.lsid);
|
||||||
|
|
||||||
item.setCredits(Utils.createCredits());
|
item.setCredits(Utils.createCredits());
|
||||||
item.setCitation(record.getCitation());
|
item.setCitation(record.citation);
|
||||||
|
|
||||||
if (record.getRank()!=null)
|
if (record.taxonomicRank!=null)
|
||||||
item.setRank(record.getRank());
|
item.setRank(record.taxonomicRank);
|
||||||
else if (record.getScientificname().equals("Biota"))
|
else if (record.scientificName.equals("Biota"))
|
||||||
item.setRank("Superdomain");
|
item.setRank("Superdomain");
|
||||||
|
|
||||||
List<CommonName> listCommNames = new ArrayList<CommonName> ();
|
List<CommonName> listCommNames = new ArrayList<CommonName> ();
|
||||||
|
|
||||||
Vernacular[] vernaculars = WormsPlugin.binding.getAphiaVernacularsByID(record.getAphiaID());
|
Collection<Vernacular> vernaculars = WormsPlugin.wormsClient.aphiaVernacularsByAphiaId(record.aphiaId);
|
||||||
if (vernaculars!=null){
|
if (vernaculars!=null){
|
||||||
for (Vernacular vernacular : vernaculars) {
|
for (Vernacular vernacular : vernaculars) {
|
||||||
if (vernacular.getLanguage_code()!=null){
|
if (vernacular.languageCode!=null){
|
||||||
CommonName a = new CommonName(vernacular.getLanguage(),vernacular.getVernacular());
|
CommonName a = new CommonName(vernacular.language,vernacular.vernacular);
|
||||||
listCommNames.add(a);
|
listCommNames.add(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,20 +167,20 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
item.setCommonNames(listCommNames);
|
item.setCommonNames(listCommNames);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if (record.getStatus().equals("accepted"))
|
if (record.status.equals("accepted"))
|
||||||
item.setStatus(new TaxonomyStatus("accepted", Status.ACCEPTED));
|
item.setStatus(new TaxonomyStatus("accepted", Status.ACCEPTED));
|
||||||
else if (record.getStatus().equals("unaccepted") && WormsPlugin.binding.getAphiaRecordByID(record.getValid_AphiaID()).getStatus().equals("accepted")){
|
else if (record.status.equals("unaccepted") && WormsPlugin.wormsClient.aphiaRecordByAphiaId(record.validAphiaId).status.equals("accepted")){
|
||||||
// logger.trace(WormsPlugin.binding.getAphiaSynonymsByID(record.getValid_AphiaID()));
|
// logger.trace(WormsPlugin.binding.getAphiaSynonymsByID(record.getValid_AphiaID()));
|
||||||
item.setStatus(new TaxonomyStatus(Status.SYNONYM, record.getValid_AphiaID()+"", "synonym"));}
|
item.setStatus(new TaxonomyStatus(Status.SYNONYM, record.validAphiaId+"", "synonym"));}
|
||||||
else
|
else
|
||||||
item.setStatus(new TaxonomyStatus(record.getStatus(), Status.UNKNOWN));
|
item.setStatus(new TaxonomyStatus(record.status, Status.UNKNOWN));
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
item.setStatus(new TaxonomyStatus(record.getStatus(), Status.UNKNOWN));
|
item.setStatus(new TaxonomyStatus(record.status, Status.UNKNOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag){
|
if (flag){
|
||||||
try{
|
try{
|
||||||
item.setParent(Utils.retrieveTaxonomy( WormsPlugin.binding.getAphiaClassificationByID(record.getAphiaID()), record.getAphiaID()));
|
item.setParent(Utils.retrieveTaxonomy( WormsPlugin.wormsClient.aphiaClassificationByAphiaId(record.aphiaId), record.aphiaId));
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
item.setParent(null);
|
item.setParent(null);
|
||||||
}
|
}
|
||||||
|
@ -185,25 +188,25 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
else
|
else
|
||||||
item.setParent(null);
|
item.setParent(null);
|
||||||
|
|
||||||
Source[] sources = null;
|
Collection<Source> sources = null;
|
||||||
if ((sources= WormsPlugin.binding.getSourcesByAphiaID(record.getAphiaID()))!=null){
|
if ((sources= WormsPlugin.wormsClient.aphiaSourcesByAphiaId(record.aphiaId))!=null){
|
||||||
for (Source source : sources){
|
for (Source source : sources){
|
||||||
// logger.trace(source.getReference());
|
// logger.trace(source.getReference());
|
||||||
if (source==null)
|
if (source==null)
|
||||||
continue;
|
continue;
|
||||||
if (source.getReference()!=null){
|
if (source.reference!=null){
|
||||||
|
|
||||||
StringBuilder p = new StringBuilder();
|
StringBuilder p = new StringBuilder();
|
||||||
p.append(source.getReference());
|
p.append(source.reference);
|
||||||
if (source.getLink()!=null){
|
if (source.link!=null){
|
||||||
p.append(", available online at ");
|
p.append(", available online at ");
|
||||||
p.append(source.getLink());
|
p.append(source.link);
|
||||||
}
|
}
|
||||||
if (source.getUrl()!=null){
|
if (source.url!=null){
|
||||||
p.append(", details: ");
|
p.append(", details: ");
|
||||||
p.append(source.getUrl());
|
p.append(source.url);
|
||||||
}
|
}
|
||||||
ElementProperty property = new ElementProperty(source.getUse(), p.toString());
|
ElementProperty property = new ElementProperty(source.use, p.toString());
|
||||||
item.addProperty(property);
|
item.addProperty(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,14 +253,14 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
AphiaRecord record = null;
|
AphiaRecord record = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
record = WormsPlugin.binding.getAphiaRecordByID(Integer.parseInt(id));
|
record = WormsPlugin.wormsClient.aphiaRecordByAphiaId(Long.parseLong(id));
|
||||||
if (record!=null){
|
if (record!=null){
|
||||||
tax = createItem(record, true);
|
tax = createItem(record, true);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
logger.error("NumberFormatException", e);
|
logger.error("NumberFormatException", e);
|
||||||
throw new IdNotValidException(e);
|
throw new IdNotValidException(e);
|
||||||
} catch (RemoteException e) {
|
} catch (WormsClientException e) {
|
||||||
logger.error("Remote Error", e);
|
logger.error("Remote Error", e);
|
||||||
throw new ExternalRepositoryException(e);
|
throw new ExternalRepositoryException(e);
|
||||||
}
|
}
|
||||||
|
@ -272,8 +275,8 @@ public class ClassificationCapabilityImpl extends ClassificationCapability {
|
||||||
throws IdNotValidException, MethodNotSupportedException, ExternalRepositoryException {
|
throws IdNotValidException, MethodNotSupportedException, ExternalRepositoryException {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
AphiaRecord[] records = null;
|
Collection<AphiaRecord> records = null;
|
||||||
if ((records = WormsPlugin.binding.getAphiaSynonymsByID(Integer.parseInt(id)))!=null){
|
if ((records = WormsPlugin.wormsClient.aphiaSynonymsByAphiaId(Long.parseLong(id)))!=null){
|
||||||
for (AphiaRecord record : records){
|
for (AphiaRecord record : records){
|
||||||
|
|
||||||
TaxonomyItem tax = createItem(record, true);
|
TaxonomyItem tax = createItem(record, true);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.data.spd.wormsplugin.capabilities;
|
package org.gcube.data.spd.wormsplugin.capabilities;
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.gcube.data.spd.model.exceptions.ExternalRepositoryException;
|
import org.gcube.data.spd.model.exceptions.ExternalRepositoryException;
|
||||||
import org.gcube.data.spd.model.exceptions.StreamNonBlockingException;
|
import org.gcube.data.spd.model.exceptions.StreamNonBlockingException;
|
||||||
|
@ -10,7 +10,8 @@ import org.gcube.data.spd.wormsplugin.WormsPlugin;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import aphia.v1_0.worms.AphiaRecord;
|
import de.uni_jena.cs.fusion.client.worms.AphiaRecord;
|
||||||
|
import de.uni_jena.cs.fusion.client.worms.WormsClientException;
|
||||||
|
|
||||||
public class ExpansionCapabilityImpl implements ExpansionCapability {
|
public class ExpansionCapabilityImpl implements ExpansionCapability {
|
||||||
|
|
||||||
|
@ -22,32 +23,33 @@ public class ExpansionCapabilityImpl implements ExpansionCapability {
|
||||||
logger.debug("searching synonyms for "+scientifcName);
|
logger.debug("searching synonyms for "+scientifcName);
|
||||||
int offset =1;
|
int offset =1;
|
||||||
int elements =20;
|
int elements =20;
|
||||||
AphiaRecord[] records = null;
|
Collection<AphiaRecord> records = null;
|
||||||
do{
|
do{
|
||||||
try{
|
try{
|
||||||
records = WormsPlugin.binding.getAphiaRecords(scientifcName, true, false, false, offset);
|
records = WormsPlugin.wormsClient.aphiaRecordsByName(scientifcName, true, false, offset);
|
||||||
if (records!=null){
|
if (records!=null){
|
||||||
for (AphiaRecord record : records){
|
for (AphiaRecord record : records){
|
||||||
try{
|
try{
|
||||||
AphiaRecord[] synonyms = WormsPlugin.binding.getAphiaSynonymsByID(record.getAphiaID());
|
Collection<AphiaRecord> synonyms = WormsPlugin.wormsClient.aphiaSynonymsByAphiaId(record.aphiaId);
|
||||||
|
|
||||||
if (synonyms!=null){
|
if (synonyms!=null){
|
||||||
for (AphiaRecord synonym: synonyms){
|
for (AphiaRecord synonym: synonyms){
|
||||||
if (!writer.isAlive()) return;
|
if (!writer.isAlive()) return;
|
||||||
writer.write(synonym.getScientificname());
|
writer.write(synonym.scientificName);
|
||||||
logger.debug("found synonym "+synonym.getScientificname());
|
logger.debug("found synonym "+synonym.scientificName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
writer.write(new StreamNonBlockingException("WoRMS",scientifcName));
|
writer.write(new StreamNonBlockingException("WoRMS",scientifcName));
|
||||||
logger.error("error retrieving synonyms for aphia id "+record.getAphiaID(), e);
|
logger.error("error retrieving synonyms for aphia id "+record.aphiaId, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (WormsClientException e) {
|
||||||
throw new ExternalRepositoryException(e);
|
throw new ExternalRepositoryException(e);
|
||||||
}
|
}
|
||||||
offset = elements+offset;
|
offset = elements+offset;
|
||||||
}while(records!=null && records.length == offset );
|
}while(records!=null && records.size() == offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.data.spd.wormsplugin.capabilities;
|
package org.gcube.data.spd.wormsplugin.capabilities;
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@ import org.gcube.data.spd.wormsplugin.WormsPlugin;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import aphia.v1_0.worms.AphiaRecord;
|
import de.uni_jena.cs.fusion.client.worms.AphiaRecord;
|
||||||
|
import de.uni_jena.cs.fusion.client.worms.WormsClientException;
|
||||||
|
|
||||||
public class NamesMappingImpl implements MappingCapability{
|
public class NamesMappingImpl implements MappingCapability{
|
||||||
|
|
||||||
|
@ -23,26 +24,26 @@ public class NamesMappingImpl implements MappingCapability{
|
||||||
String commonName) throws ExternalRepositoryException{
|
String commonName) throws ExternalRepositoryException{
|
||||||
try {
|
try {
|
||||||
logger.debug("retrieving mapping for "+commonName);
|
logger.debug("retrieving mapping for "+commonName);
|
||||||
AphiaRecord[] records;
|
Collection<AphiaRecord> records;
|
||||||
final int offsetlimit=50;
|
final int offsetlimit=50;
|
||||||
int offset =1;
|
int offset =1;
|
||||||
Set<String> snSet = new HashSet<String>();
|
Set<String> snSet = new HashSet<String>();
|
||||||
do{
|
do{
|
||||||
records = WormsPlugin.binding.getAphiaRecordsByVernacular(commonName, true, offset);
|
records = WormsPlugin.wormsClient.aphiaRecordsByVernacular(commonName, true, offset);
|
||||||
if (records!=null){
|
if (records!=null){
|
||||||
for (AphiaRecord record : records){
|
for (AphiaRecord record : records){
|
||||||
if (!writer.isAlive()) return;
|
if (!writer.isAlive()) return;
|
||||||
if (!snSet.contains(record.getScientificname())){
|
if (!snSet.contains(record.scientificName)){
|
||||||
logger.trace("writing (COMMONNAMESMAPPING) "+record.getScientificname() );
|
logger.trace("writing (COMMONNAMESMAPPING) "+record.scientificName );
|
||||||
writer.write(record.getScientificname());
|
writer.write(record.scientificName);
|
||||||
snSet.add(record.getScientificname());
|
snSet.add(record.scientificName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset+=offsetlimit;
|
offset+=offsetlimit;
|
||||||
} while (records!=null && records.length==offsetlimit);
|
} while (records!=null && records.size()==offsetlimit);
|
||||||
|
|
||||||
} catch (RemoteException e) {
|
} catch (WormsClientException e) {
|
||||||
throw new ExternalRepositoryException(e);
|
throw new ExternalRepositoryException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.gcube.data.spd.wormsplugin;
|
package org.gcube.data.spd.wormsplugin;
|
||||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.rpc.ServiceException;
|
|
||||||
|
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
@ -22,7 +22,7 @@ public class Test {
|
||||||
* @throws ServiceException
|
* @throws ServiceException
|
||||||
* @throws ExternalRepositoryException
|
* @throws ExternalRepositoryException
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws ServiceException, ExternalRepositoryException {
|
public static void main(String[] args) throws ExternalRepositoryException {
|
||||||
|
|
||||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.rpc.ServiceException;
|
|
||||||
|
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
@ -23,7 +22,7 @@ public class TestExpansionCapability {
|
||||||
* @throws ServiceException
|
* @throws ServiceException
|
||||||
* @throws ExternalRepositoryException
|
* @throws ExternalRepositoryException
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws ServiceException, ExternalRepositoryException {
|
public static void main(String[] args) throws ExternalRepositoryException {
|
||||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
query.addCondition("$resource/Profile/Category/text() eq 'BiodiversityRepository' and $resource/Profile/Name eq 'WoRMS' ");
|
query.addCondition("$resource/Profile/Category/text() eq 'BiodiversityRepository' and $resource/Profile/Name eq 'WoRMS' ");
|
||||||
|
@ -44,8 +43,8 @@ public class TestExpansionCapability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WormsPlugin.binding = (aphia.v1_0.worms.AphiaNameServiceBindingStub)
|
/*WormsPlugin.binding = (aphia.v1_0.worms.AphiaNameServiceBindingStub)
|
||||||
new aphia.v1_0.worms.AphiaNameServiceLocator().getAphiaNameServicePort();
|
new aphia.v1_0.worms.AphiaNameServiceLocator().getAphiaNameServicePort();*/
|
||||||
|
|
||||||
ExpansionCapabilityImpl b = new ExpansionCapabilityImpl();
|
ExpansionCapabilityImpl b = new ExpansionCapabilityImpl();
|
||||||
b.getSynonyms(new ObjectWriter<String>() {
|
b.getSynonyms(new ObjectWriter<String>() {
|
||||||
|
|
|
@ -3,7 +3,6 @@ import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
@ -36,8 +35,8 @@ public class TestMapping {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WormsPlugin.binding = (aphia.v1_0.worms.AphiaNameServiceBindingStub)
|
/*WormsPlugin.binding = (aphia.v1_0.worms.AphiaNameServiceBindingStub)
|
||||||
new aphia.v1_0.worms.AphiaNameServiceLocator().getAphiaNameServicePort();
|
new aphia.v1_0.worms.AphiaNameServiceLocator().getAphiaNameServicePort();*/
|
||||||
|
|
||||||
NamesMappingImpl b = new NamesMappingImpl();
|
NamesMappingImpl b = new NamesMappingImpl();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue