From 3233b010899da575312e705ac640b194e2d86b81 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 18 Jun 2020 11:22:58 +0200 Subject: [PATCH] changes due to adding all the result type under Result --- .../dnetlib/dhp/oa/graph/dump/APIClient.java | 108 +++++++--- .../eu/dnetlib/dhp/oa/graph/dump/Mapper.java | 40 ++-- .../dump/SparkDumpCommunityProducts.java | 17 +- .../oa/graph/dump/SparkSplitForCommunity.java | 31 ++- .../graph/dump/SparkSplitForCommunity2.java | 4 - .../oa/graph/dump/SparkUpdateProjectInfo.java | 21 +- .../dhp/oa/graph/dump/zenodo/Community.java | 17 +- .../dhp/oa/graph/dump/zenodo/Creator.java | 28 +++ .../dhp/oa/graph/dump/zenodo/File.java | 55 ++++- .../dhp/oa/graph/dump/zenodo/Grant.java | 14 +- .../dhp/oa/graph/dump/zenodo/Links.java | 90 +++++++- .../dhp/oa/graph/dump/zenodo/Metadata.java | 151 +++++++++++++- .../oa/graph/dump/zenodo/PrereserveDoi.java | 23 +- .../graph/dump/zenodo/RelatedIdentifier.java | 41 +++- .../dhp/oa/graph/dump/zenodo/ZenodoModel.java | 197 ++++++++---------- 15 files changed, 619 insertions(+), 218 deletions(-) delete mode 100644 dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity2.java diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java index 4ba7d431b4..56b54cf8ea 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java @@ -1,56 +1,102 @@ + package eu.dnetlib.dhp.oa.graph.dump; import java.io.*; -import java.net.MalformedURLException; - -import com.cloudera.org.apache.http.HttpResponse; -import com.cloudera.org.apache.http.client.HttpClient; -import com.cloudera.org.apache.http.client.methods.HttpPost; -import com.cloudera.org.apache.http.entity.StringEntity; -import com.cloudera.org.apache.http.impl.client.DefaultHttpClient; -import com.cloudera.org.apache.http.util.EntityUtils; -import com.google.gson.Gson; -import eu.dnetlib.dhp.oa.graph.dump.zenodo.ZenodoModel; -import org.springframework.beans.factory.annotation.Value; - import java.io.IOException; +//import com.cloudera.org.apache.http.HttpResponse; +//import com.cloudera.org.apache.http.client.HttpClient; +//import com.cloudera.org.apache.http.client.methods.HttpPost; +//import com.cloudera.org.apache.http.entity.StringEntity; +//import com.cloudera.org.apache.http.impl.client.DefaultHttpClient; +//import com.cloudera.org.apache.http.util.EntityUtils; +import com.google.gson.Gson; -public class SendToZenodo implements Serializable { +import eu.dnetlib.dhp.oa.graph.dump.zenodo.ZenodoModel; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +public class APIClient implements Serializable { + + String urlString; + String bucket; + HttpClient client; + String deposition_id; + final String ACCESS_TOKEN = "5ImUj0VC1ICg4ifK5dc3AGzJhcfAB4osxrFlsr8WxHXxjaYgCE0hY8HZcDoe"; + + public String getUrlString() { + return urlString; + } + + public void setUrlString(String urlString) { + this.urlString = urlString; + } + + public String getBucket() { + return bucket; + } + + public void setBucket(String bucket) { + this.bucket = bucket; + } + + public APIClient(String urlString) throws IOException { + + this.urlString = urlString; + //connect(); + } - String urlString; + public int connect() throws IOException { + + String json = "{}"; - public SendToZenodo(String urlString) throws MalformedURLException { + client = new DefaultHttpClient(); + HttpPost post = new HttpPost(urlString); - this.urlString = urlString ; - } + StringEntity input = new StringEntity(json); + post.setEntity(input); + post.addHeader("Content-Type", "application/json"); + post.setHeader("Authorization", "Bearer " + ACCESS_TOKEN); - public void connect() throws IOException { + HttpResponse response = client.execute(post); - String json = "{}"; + json = EntityUtils.toString(response.getEntity()); - HttpClient client = new DefaultHttpClient(); - HttpPost post = new HttpPost(urlString); + ZenodoModel newSubmission = new Gson().fromJson(json, ZenodoModel.class); + this.bucket = newSubmission.getLinks().getBucket(); + this.deposition_id = newSubmission.getId(); - StringEntity input = new StringEntity(json); - post.setEntity(input); - post.addHeader("Content-Type", "application/json"); + return response.getStatusLine().getStatusCode(); - HttpResponse response = client.execute(post); - System.out.println(response.getStatusLine()); - System.out.println(response.getEntity().getContent().toString()); + } - json = EntityUtils.toString(response.getEntity()); + public void upload(String filePath, String file_name) throws IOException { + File file = new File(filePath); + HttpPut post = new HttpPut(bucket + "/" + file_name); + post.setHeader("Authorization", "Bearer " + ACCESS_TOKEN); + post.addHeader("Content-Type", "application/zip"); + HttpEntity data = MultipartEntityBuilder.create().addBinaryBody(file_name, file).build(); + post.setEntity(data); - ZenodoModel newSubmission = new Gson().fromJson(json, ZenodoModel.class); - System.out.println(newSubmission.getLinks().getBucket()); + //HttpUriRequest request = RequestBuilder.post(bucket + "/" + file_name +"?access_token=5ImUj0VC1ICg4ifK5dc3AGzJhcfAB4osxrFlsr8WxHXxjaYgCE0hY8HZcDoe").setEntity(data).build(); - } + HttpResponse response = client.execute(post); + System.out.println(response.getStatusLine().getStatusCode()); + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java index 4693d1ed15..1c31b7d5ae 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java @@ -9,6 +9,7 @@ import javax.swing.text.html.Option; import org.apache.avro.generic.GenericData; +import eu.dnetlib.dhp.schema.common.ModelConstants; import eu.dnetlib.dhp.schema.dump.oaf.*; import eu.dnetlib.dhp.schema.oaf.DataInfo; import eu.dnetlib.dhp.schema.oaf.Field; @@ -17,15 +18,14 @@ import eu.dnetlib.dhp.schema.oaf.StructuredProperty; public class Mapper implements Serializable { - public static O map( + public static Result map( I input, Map communityMap) { - O out = null; + final Result out = new Result(); Optional ort = Optional.ofNullable(input.getResulttype()); if (ort.isPresent()) { switch (ort.get().getClassid()) { case "publication": - out = (O) new Publication(); Optional journal = Optional .ofNullable(((eu.dnetlib.dhp.schema.oaf.Publication) input).getJournal()); if (journal.isPresent()) { @@ -43,15 +43,15 @@ public class Mapper implements Serializable { c.setSp(j.getSp()); c.setVol(j.getVol()); out.setContainer(c); + out.setType(ModelConstants.PUBLICATION_DEFAULT_RESULTTYPE.getClassname()); } break; case "dataset": - Dataset d = new Dataset(); eu.dnetlib.dhp.schema.oaf.Dataset id = (eu.dnetlib.dhp.schema.oaf.Dataset) input; - Optional.ofNullable(id.getSize()).ifPresent(v -> d.setSize(v.getValue())); - Optional.ofNullable(id.getVersion()).ifPresent(v -> d.setVersion(v.getValue())); + Optional.ofNullable(id.getSize()).ifPresent(v -> out.setSize(v.getValue())); + Optional.ofNullable(id.getVersion()).ifPresent(v -> out.setVersion(v.getValue())); - d + out .setGeolocation( Optional .ofNullable(id.getGeolocation()) @@ -69,19 +69,18 @@ public class Mapper implements Serializable { .collect(Collectors.toList())) .orElse(null)); - out = (O) d; - + out.setType(ModelConstants.DATASET_DEFAULT_RESULTTYPE.getClassname()); break; case "software": - Software s = new Software(); + eu.dnetlib.dhp.schema.oaf.Software is = (eu.dnetlib.dhp.schema.oaf.Software) input; Optional .ofNullable(is.getCodeRepositoryUrl()) - .ifPresent(value -> s.setCodeRepositoryUrl(value.getValue())); + .ifPresent(value -> out.setCodeRepositoryUrl(value.getValue())); Optional .ofNullable(is.getDocumentationUrl()) .ifPresent( - value -> s + value -> out .setDocumentationUrl( value .stream() @@ -90,33 +89,35 @@ public class Mapper implements Serializable { Optional .ofNullable(is.getProgrammingLanguage()) - .ifPresent(value -> s.setProgrammingLanguage(value.getClassid())); + .ifPresent(value -> out.setProgrammingLanguage(value.getClassid())); - out = (O) s; + out.setType(ModelConstants.SOFTWARE_DEFAULT_RESULTTYPE.getClassname()); break; case "other": - OtherResearchProduct or = new OtherResearchProduct(); + eu.dnetlib.dhp.schema.oaf.OtherResearchProduct ir = (eu.dnetlib.dhp.schema.oaf.OtherResearchProduct) input; - or + out .setContactgroup( Optional .ofNullable(ir.getContactgroup()) .map(value -> value.stream().map(cg -> cg.getValue()).collect(Collectors.toList())) .orElse(null)); - or + out .setContactperson( Optional .ofNullable(ir.getContactperson()) .map(value -> value.stream().map(cp -> cp.getValue()).collect(Collectors.toList())) .orElse(null)); - or + out .setTool( Optional .ofNullable(ir.getTool()) .map(value -> value.stream().map(t -> t.getValue()).collect(Collectors.toList())) .orElse(null)); - out = (O) or; + + out.setType(ModelConstants.ORP_DEFAULT_RESULTTYPE.getClassname()); + break; } Optional> oAuthor = Optional.ofNullable(input.getAuthor()); @@ -293,6 +294,7 @@ public class Mapper implements Serializable { .ifPresent(value -> instance.setPublicationdate(value.getValue())); Optional .ofNullable(i.getRefereed()) + // .ifPresent(value -> instance.setRefereed(value.getClassname())); .ifPresent(value -> instance.setRefereed(value.getValue())); Optional .ofNullable(i.getInstancetype()) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkDumpCommunityProducts.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkDumpCommunityProducts.java index b5204382d2..8d8c7c0310 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkDumpCommunityProducts.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkDumpCommunityProducts.java @@ -57,8 +57,8 @@ public class SparkDumpCommunityProducts implements Serializable { final String resultClassName = parser.get("resultTableName"); log.info("resultTableName: {}", resultClassName); - final String dumpClassName = parser.get("dumpTableName"); - log.info("dumpClassName: {}", dumpClassName); +// final String dumpClassName = parser.get("dumpTableName"); +// log.info("dumpClassName: {}", dumpClassName); final String isLookUpUrl = parser.get("isLookUpUrl"); log.info("isLookUpUrl: {}", isLookUpUrl); @@ -69,8 +69,8 @@ public class SparkDumpCommunityProducts implements Serializable { final Optional cm = Optional.ofNullable(parser.get("communityMap")); Class inputClazz = (Class) Class.forName(resultClassName); - Class dumpClazz = (Class) Class - .forName(dumpClassName); +// Class dumpClazz = (Class) Class +// .forName(dumpClassName); SparkConf conf = new SparkConf(); @@ -89,7 +89,7 @@ public class SparkDumpCommunityProducts implements Serializable { isSparkSessionManaged, spark -> { Utils.removeOutputDir(spark, outputPath); - execDump(spark, inputPath, outputPath, communityMap, inputClazz, dumpClazz); + execDump(spark, inputPath, outputPath, communityMap, inputClazz);// , dumpClazz); }); @@ -103,14 +103,13 @@ public class SparkDumpCommunityProducts implements Serializable { String inputPath, String outputPath, CommunityMap communityMap, - Class inputClazz, - Class dumpClazz) { + Class inputClazz) {// Class dumpClazz) { // Set communities = communityMap.keySet(); Dataset tmp = Utils.readPath(spark, inputPath, inputClazz); tmp - .map(value -> execMap(value, communityMap), Encoders.bean(dumpClazz)) + .map(value -> execMap(value, communityMap), Encoders.bean(eu.dnetlib.dhp.schema.dump.oaf.Result.class)) .filter(Objects::nonNull) .write() .mode(SaveMode.Overwrite) @@ -119,7 +118,7 @@ public class SparkDumpCommunityProducts implements Serializable { } - private static O execMap(I value, + private static eu.dnetlib.dhp.schema.dump.oaf.Result execMap(I value, CommunityMap communityMap) { { Set communities = communityMap.keySet(); diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity.java index dd6df59bf8..eec170955e 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity.java @@ -4,8 +4,8 @@ package eu.dnetlib.dhp.oa.graph.dump; import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession; import java.io.Serializable; -import java.io.StringReader; -import java.util.*; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; @@ -13,10 +13,6 @@ import org.apache.spark.SparkConf; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.SaveMode; import org.apache.spark.sql.SparkSession; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.Element; -import org.dom4j.io.SAXReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,16 +49,14 @@ public class SparkSplitForCommunity implements Serializable { final String outputPath = parser.get("outputPath"); log.info("outputPath: {}", outputPath); - final String resultClassName = parser.get("resultTableName"); - log.info("resultTableName: {}", resultClassName); +// final String resultClassName = parser.get("resultTableName"); +// log.info("resultTableName: {}", resultClassName); final String isLookUpUrl = parser.get("isLookUpUrl"); log.info("isLookUpUrl: {}", isLookUpUrl); final Optional cm = Optional.ofNullable(parser.get("communityMap")); - Class inputClazz = (Class) Class.forName(resultClassName); - SparkConf conf = new SparkConf(); CommunityMap communityMap; @@ -80,7 +74,7 @@ public class SparkSplitForCommunity implements Serializable { isSparkSessionManaged, spark -> { Utils.removeOutputDir(spark, outputPath); - execSplit(spark, inputPath, outputPath, communityMap.keySet(), inputClazz); + execSplit(spark, inputPath, outputPath, communityMap.keySet());// , inputClazz); }); } @@ -88,10 +82,14 @@ public class SparkSplitForCommunity implements Serializable { return ISLookupClientFactory.getLookUpService(isLookUpUrl); } - private static void execSplit(SparkSession spark, String inputPath, String outputPath, - Set communities, Class inputClazz) { + private static void execSplit(SparkSession spark, String inputPath, String outputPath, + Set communities) {// }, Class inputClazz) { - Dataset result = Utils.readPath(spark, inputPath, inputClazz); + Dataset result = Utils + .readPath(spark, inputPath + "/publication", Result.class) + .union(Utils.readPath(spark, inputPath + "/dataset", Result.class)) + .union(Utils.readPath(spark, inputPath + "/orp", Result.class)) + .union(Utils.readPath(spark, inputPath + "/software", Result.class)); communities .stream() @@ -99,16 +97,17 @@ public class SparkSplitForCommunity implements Serializable { } - private static void printResult(String c, Dataset result, String outputPath) { + private static void printResult(String c, Dataset result, String outputPath) { result .filter(r -> containsCommunity(r, c)) + .repartition(1) .write() .option("compression", "gzip") .mode(SaveMode.Append) .json(outputPath + "/" + c); } - private static boolean containsCommunity(R r, String c) { + private static boolean containsCommunity(Result r, String c) { if (Optional.ofNullable(r.getContext()).isPresent()) { return r .getContext() diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity2.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity2.java deleted file mode 100644 index 10dd079ef5..0000000000 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkSplitForCommunity2.java +++ /dev/null @@ -1,4 +0,0 @@ -package eu.dnetlib.dhp.oa.graph.dump; - -public class SparkSplitForCommunity2 { -} diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkUpdateProjectInfo.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkUpdateProjectInfo.java index 3fce0abe9e..d87810b79a 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkUpdateProjectInfo.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SparkUpdateProjectInfo.java @@ -52,14 +52,9 @@ public class SparkUpdateProjectInfo implements Serializable { final String outputPath = parser.get("outputPath"); log.info("outputPath: {}", outputPath); - final String resultClassName = parser.get("resultTableName"); - log.info("resultTableName: {}", resultClassName); - final String preparedInfoPath = parser.get("preparedInfoPath"); log.info("preparedInfoPath: {}", preparedInfoPath); - Class inputClazz = (Class) Class.forName(resultClassName); - SparkConf conf = new SparkConf(); runWithSparkSession( @@ -67,33 +62,33 @@ public class SparkUpdateProjectInfo implements Serializable { isSparkSessionManaged, spark -> { Utils.removeOutputDir(spark, outputPath); - extend(spark, inputPath, outputPath, preparedInfoPath, inputClazz); + extend(spark, inputPath, outputPath, preparedInfoPath);// , inputClazz); }); } - private static void extend( + private static void extend( SparkSession spark, String inputPath, String outputPath, - String preparedInfoPath, - Class inputClazz) { + String preparedInfoPath) {// , + // Class inputClazz) { - Dataset result = Utils.readPath(spark, inputPath, inputClazz); + Dataset result = Utils.readPath(spark, inputPath, Result.class); Dataset resultProject = Utils.readPath(spark, preparedInfoPath, ResultProject.class); result .joinWith( resultProject, result.col("id").equalTo(resultProject.col("resultId")), "left") .map(value -> { - R r = value._1(); + Result r = value._1(); Optional.ofNullable(value._2()).ifPresent(rp -> { r.setProjects(rp.getProjectsList()); }); return r; - }, Encoders.bean(inputClazz)) + }, Encoders.bean(Result.class)) .write() .option("compression", "gzip") - .mode(SaveMode.Overwrite) + .mode(SaveMode.Append) .json(outputPath); } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Community.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Community.java index 89a48a8d56..0c55318aeb 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Community.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Community.java @@ -1,13 +1,14 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; -public class Communities { - private String identifier; +public class Community { + private String identifier; - public String getIdentifier() { - return identifier; - } + public String getIdentifier() { + return identifier; + } - public void setIdentifier(String identifier) { - this.identifier = identifier; - } + public void setIdentifier(String identifier) { + this.identifier = identifier; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Creator.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Creator.java index 6a968d00f8..d9a072db0f 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Creator.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Creator.java @@ -1,4 +1,32 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; public class Creator { + private String affiliation; + private String name; + private String orcid; + + public String getAffiliation() { + return affiliation; + } + + public void setAffiliation(String affiliation) { + this.affiliation = affiliation; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getOrcid() { + return orcid; + } + + public void setOrcid(String orcid) { + this.orcid = orcid; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/File.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/File.java index 3f6ff49160..dbf0aad80b 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/File.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/File.java @@ -1,7 +1,58 @@ -package eu.dnetlib.dhp.oa.graph.dump; + +package eu.dnetlib.dhp.oa.graph.dump.zenodo; import java.io.Serializable; +import net.minidev.json.annotate.JsonIgnore; + public class File implements Serializable { - {"checksum": "dbf89bfc64fb70f7861b3b338ac3626d", "filename": "dataset.gz", "filesize": 22822474699, "id": "d20d0069-6a66-4cf5-a226-22ab5f87ece8", "links": {"download": "https://zenodo.org/api/files/44450289-0dbe-4d38-aa91-7a671dcd0700/dataset.gz", "self": "https://zenodo.org/api/deposit/depositions/3516918/files/d20d0069-6a66-4cf5-a226-22ab5f87ece8"}}; + private String checksum; + private String filename; + private long filesize; + private String id; + + @JsonIgnore + // private Links links; + + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public long getFilesize() { + return filesize; + } + + public void setFilesize(long filesize) { + this.filesize = filesize; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +// @JsonIgnore +// public Links getLinks() { +// return links; +// } +// +// @JsonIgnore +// public void setLinks(Links links) { +// this.links = links; +// } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Grant.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Grant.java index 9a063d67b2..712644cde7 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Grant.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Grant.java @@ -1,4 +1,16 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; -public class Grant { +import java.io.Serializable; + +public class Grant implements Serializable { + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Links.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Links.java index 76a3b2bdd1..04b2394ad1 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Links.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Links.java @@ -1,4 +1,92 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; -public class Links { +import java.io.Serializable; + +public class Links implements Serializable { + + private String bucket; + + private String discard; + + private String edit; + private String files; + private String html; + private String latest_draft; + private String latest_draft_html; + private String publish; + + private String self; + + public String getBucket() { + return bucket; + } + + public void setBucket(String bucket) { + this.bucket = bucket; + } + + public String getDiscard() { + return discard; + } + + public void setDiscard(String discard) { + this.discard = discard; + } + + public String getEdit() { + return edit; + } + + public void setEdit(String edit) { + this.edit = edit; + } + + public String getFiles() { + return files; + } + + public void setFiles(String files) { + this.files = files; + } + + public String getHtml() { + return html; + } + + public void setHtml(String html) { + this.html = html; + } + + public String getLatest_draft() { + return latest_draft; + } + + public void setLatest_draft(String latest_draft) { + this.latest_draft = latest_draft; + } + + public String getLatest_draft_html() { + return latest_draft_html; + } + + public void setLatest_draft_html(String latest_draft_html) { + this.latest_draft_html = latest_draft_html; + } + + public String getPublish() { + return publish; + } + + public void setPublish(String publish) { + this.publish = publish; + } + + public String getSelf() { + return self; + } + + public void setSelf(String self) { + this.self = self; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Metadata.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Metadata.java index af10e1485f..4a86256915 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Metadata.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/Metadata.java @@ -1,4 +1,153 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; -public class Metadata { +import java.io.Serializable; +import java.util.List; + +public class Metadata implements Serializable { + + private String access_right; + private List communities; + private List creators; + private String description; + private String doi; + private List grants; + private List keywords; + private String language; + private String license; + private PrereserveDoi prereserve_doi; + private String publication_date; + private List references; + private List related_identifiers; + private String title; + private String upload_type; + private String version; + + public String getUpload_type() { + return upload_type; + } + + public void setUpload_type(String upload_type) { + this.upload_type = upload_type; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getAccess_right() { + return access_right; + } + + public void setAccess_right(String access_right) { + this.access_right = access_right; + } + + public List getCommunities() { + return communities; + } + + public void setCommunities(List communities) { + this.communities = communities; + } + + public List getCreators() { + return creators; + } + + public void setCreators(List creators) { + this.creators = creators; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDoi() { + return doi; + } + + public void setDoi(String doi) { + this.doi = doi; + } + + public List getGrants() { + return grants; + } + + public void setGrants(List grants) { + this.grants = grants; + } + + public List getKeywords() { + return keywords; + } + + public void setKeywords(List keywords) { + this.keywords = keywords; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getLicense() { + return license; + } + + public void setLicense(String license) { + this.license = license; + } + + public PrereserveDoi getPrereserve_doi() { + return prereserve_doi; + } + + public void setPrereserve_doi(PrereserveDoi prereserve_doi) { + this.prereserve_doi = prereserve_doi; + } + + public String getPublication_date() { + return publication_date; + } + + public void setPublication_date(String publication_date) { + this.publication_date = publication_date; + } + + public List getReferences() { + return references; + } + + public void setReferences(List references) { + this.references = references; + } + + public List getRelated_identifiers() { + return related_identifiers; + } + + public void setRelated_identifiers(List related_identifiers) { + this.related_identifiers = related_identifiers; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/PrereserveDoi.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/PrereserveDoi.java index c463eecb73..ef12408655 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/PrereserveDoi.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/PrereserveDoi.java @@ -1,4 +1,25 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; -public class PrereserveDoi { +import java.io.Serializable; + +public class PrereserveDoi implements Serializable { + private String doi; + private String recid; + + public String getDoi() { + return doi; + } + + public void setDoi(String doi) { + this.doi = doi; + } + + public String getRecid() { + return recid; + } + + public void setRecid(String recid) { + this.recid = recid; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/RelatedIdentifier.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/RelatedIdentifier.java index c13dee1e75..87a04a49bb 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/RelatedIdentifier.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/RelatedIdentifier.java @@ -1,4 +1,43 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; -public class RelatedIdentifier { +import java.io.Serializable; + +public class RelatedIdentifier implements Serializable { + private String identifier; + private String relation; + private String resource_type; + private String scheme; + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getRelation() { + return relation; + } + + public void setRelation(String relation) { + this.relation = relation; + } + + public String getResource_type() { + return resource_type; + } + + public void setResource_type(String resource_type) { + this.resource_type = resource_type; + } + + public String getScheme() { + return scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/ZenodoModel.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/ZenodoModel.java index 8dc80ae997..72d55fecf5 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/ZenodoModel.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/zenodo/ZenodoModel.java @@ -1,143 +1,118 @@ + package eu.dnetlib.dhp.oa.graph.dump.zenodo; import java.io.Serializable; import java.util.List; -public class ZenodoResponse implements Serializable { +public class ZenodoModel implements Serializable { - private String conceptdoi; - private String conceptrecid; - private String created; - private String doi; - private String doi_url; - private List files; - private String id; - private Links links; - private Metadata metadata; - private String modifie; - private String owner; - private String record_id; - private String state; - private boolean submitted; - private String title; + private String conceptrecid; + private String created; - public String getConceptdoi() { - return conceptdoi; - } + private List files; + private String id; + private Links links; + private Metadata metadata; + private String modified; + private String owner; + private String record_id; + private String state; + private boolean submitted; + private String title; - public void setConceptdoi(String conceptdoi) { - this.conceptdoi = conceptdoi; - } + public String getConceptrecid() { + return conceptrecid; + } - public String getConceptrecid() { - return conceptrecid; - } + public void setConceptrecid(String conceptrecid) { + this.conceptrecid = conceptrecid; + } - public void setConceptrecid(String conceptrecid) { - this.conceptrecid = conceptrecid; - } + public String getCreated() { + return created; + } - public String getCreated() { - return created; - } + public void setCreated(String created) { + this.created = created; + } - public void setCreated(String created) { - this.created = created; - } + public List getFiles() { + return files; + } - public String getDoi() { - return doi; - } + public void setFiles(List files) { + this.files = files; + } - public void setDoi(String doi) { - this.doi = doi; - } + public String getId() { + return id; + } - public String getDoi_url() { - return doi_url; - } + public void setId(String id) { + this.id = id; + } - public void setDoi_url(String doi_url) { - this.doi_url = doi_url; - } + public Links getLinks() { + return links; + } - public List getFiles() { - return files; - } + public void setLinks(Links links) { + this.links = links; + } - public void setFiles(List files) { - this.files = files; - } + public Metadata getMetadata() { + return metadata; + } - public String getId() { - return id; - } + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } - public void setId(String id) { - this.id = id; - } + public String getModified() { + return modified; + } - public Links getLinks() { - return links; - } + public void setModified(String modified) { + this.modified = modified; + } - public void setLinks(Links links) { - this.links = links; - } + public String getOwner() { + return owner; + } - public Metadata getMetadata() { - return metadata; - } + public void setOwner(String owner) { + this.owner = owner; + } - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } + public String getRecord_id() { + return record_id; + } - public String getModifie() { - return modifie; - } + public void setRecord_id(String record_id) { + this.record_id = record_id; + } - public void setModifie(String modifie) { - this.modifie = modifie; - } + public String getState() { + return state; + } - public String getOwner() { - return owner; - } + public void setState(String state) { + this.state = state; + } - public void setOwner(String owner) { - this.owner = owner; - } + public boolean isSubmitted() { + return submitted; + } - public String getRecord_id() { - return record_id; - } + public void setSubmitted(boolean submitted) { + this.submitted = submitted; + } - public void setRecord_id(String record_id) { - this.record_id = record_id; - } + public String getTitle() { + return title; + } - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public boolean isSubmitted() { - return submitted; - } - - public void setSubmitted(boolean submitted) { - this.submitted = submitted; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } + public void setTitle(String title) { + this.title = title; + } }