From aad0cb40b7fd25cd888f1a080683e6d37cabb3f3 Mon Sep 17 00:00:00 2001 From: "sandro.labruzzo" Date: Thu, 14 Nov 2019 10:34:09 +0100 Subject: [PATCH] Added schema Scholexplorer --- dhp-schemas/pom.xml | 11 ++ .../eu/dnetlib/dhp/schema/dli/Entity.java | 118 ++++++++++++++++++ .../java/eu/dnetlib/dhp/schema/dli/Pid.java | 33 +++++ .../eu/dnetlib/dhp/schema/dli/Provenance.java | 35 ++++++ .../eu/dnetlib/dhp/schema/dli/Relation.java | 47 +++++++ .../dhp/schema/dli/RelationSemantic.java | 16 +++ .../eu/dnetlib/dhp/schema/dli/Subject.java | 35 ++++++ .../dhp/graph/SparkGraphImporterJobTest.java | 1 - 8 files changed, 295 insertions(+), 1 deletion(-) create mode 100644 dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Entity.java create mode 100644 dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Pid.java create mode 100644 dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Provenance.java create mode 100644 dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Relation.java create mode 100644 dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/RelationSemantic.java create mode 100644 dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Subject.java diff --git a/dhp-schemas/pom.xml b/dhp-schemas/pom.xml index f074fb241..20896a61d 100644 --- a/dhp-schemas/pom.xml +++ b/dhp-schemas/pom.xml @@ -21,6 +21,17 @@ commons-io + + org.apache.commons + commons-lang3 + + + + eu.dnetlib.dhp + dhp-common + ${project.version} + + diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Entity.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Entity.java new file mode 100644 index 000000000..894d54eaf --- /dev/null +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Entity.java @@ -0,0 +1,118 @@ +package eu.dnetlib.dhp.schema.dli; + +import java.io.Serializable; +import java.util.List; + +public class Entity implements Serializable { + + private String identifier; + + private List pid; + + private List title; + + private List date; + + private String typology; + + private List authors; + + private List subject; + + private String description; + + private String completionStatus; + + private List collectedFrom; + + private List publisher; + + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public List getPid() { + return pid; + } + + public void setPid(List pid) { + this.pid = pid; + } + + public List getTitle() { + return title; + } + + public void setTitle(List title) { + this.title = title; + } + + public List getDate() { + return date; + } + + public void setDate(List date) { + this.date = date; + } + + public String getTypology() { + return typology; + } + + public void setTypology(String typology) { + this.typology = typology; + } + + public List getAuthors() { + return authors; + } + + public void setAuthors(List authors) { + this.authors = authors; + } + + public List getSubject() { + return subject; + } + + public void setSubject(List subject) { + this.subject = subject; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getCollectedFrom() { + return collectedFrom; + } + + public void setCollectedFrom(List collectedFrom) { + this.collectedFrom = collectedFrom; + } + + public List getPublisher() { + return publisher; + } + + public void setPublisher(List publisher) { + this.publisher = publisher; + } + + public String getCompletionStatus() { + return completionStatus; + } + + public void setCompletionStatus(String completionStatus) { + this.completionStatus = completionStatus; + } +} diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Pid.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Pid.java new file mode 100644 index 000000000..252245f45 --- /dev/null +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Pid.java @@ -0,0 +1,33 @@ +package eu.dnetlib.dhp.schema.dli; + +import eu.dnetlib.dhp.utils.DHPUtils; +import org.apache.commons.lang3.StringUtils; + +public class Pid { + + private String pid; + + private String pidType; + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getPidType() { + return pidType; + } + + public void setPidType(String pidType) { + this.pidType = pidType; + } + + public String generateId() { + if(StringUtils.isEmpty(pid) || StringUtils.isEmpty(pidType)) + return null; + return DHPUtils.md5(String.format("%s::%s", pid, pidType)); + } +} diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Provenance.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Provenance.java new file mode 100644 index 000000000..300b1134b --- /dev/null +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Provenance.java @@ -0,0 +1,35 @@ +package eu.dnetlib.dhp.schema.dli; + +public class Provenance { + + private String datasourceId; + + private String datasourceName; + + private String completionStatus; + + + public String getDatasourceId() { + return datasourceId; + } + + public void setDatasourceId(String datasourceId) { + this.datasourceId = datasourceId; + } + + public String getDatasourceName() { + return datasourceName; + } + + public void setDatasourceName(String datasourceName) { + this.datasourceName = datasourceName; + } + + public String getCompletionStatus() { + return completionStatus; + } + + public void setCompletionStatus(String completionStatus) { + this.completionStatus = completionStatus; + } +} diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Relation.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Relation.java new file mode 100644 index 000000000..b83cccb73 --- /dev/null +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Relation.java @@ -0,0 +1,47 @@ +package eu.dnetlib.dhp.schema.dli; + +import java.io.Serializable; +import java.util.List; + +public class Relation implements Serializable { + + private String source; + + private String target; + + private List provenance; + + private RelationSemantic semantic; + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public List getProvenance() { + return provenance; + } + + public void setProvenance(List provenance) { + this.provenance = provenance; + } + + public RelationSemantic getSemantic() { + return semantic; + } + + public void setSemantic(RelationSemantic semantic) { + this.semantic = semantic; + } +} diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/RelationSemantic.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/RelationSemantic.java new file mode 100644 index 000000000..ff871ef2d --- /dev/null +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/RelationSemantic.java @@ -0,0 +1,16 @@ +package eu.dnetlib.dhp.schema.dli; + +import java.io.Serializable; + +public class RelationSemantic extends Subject implements Serializable { + + public String inverse; + + public String getInverse() { + return inverse; + } + + public void setInverse(String inverse) { + this.inverse = inverse; + } +} diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Subject.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Subject.java new file mode 100644 index 000000000..bd89bc6dd --- /dev/null +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dli/Subject.java @@ -0,0 +1,35 @@ +package eu.dnetlib.dhp.schema.dli; + +import java.io.Serializable; + +public class Subject implements Serializable { + + private String schema; + + private String value; + + public Subject() { + + } + + public Subject(String schema, String value) { + this.schema = schema; + this.value = value; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/graph/SparkGraphImporterJobTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/graph/SparkGraphImporterJobTest.java index c713e235e..2a8703f86 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/graph/SparkGraphImporterJobTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/graph/SparkGraphImporterJobTest.java @@ -35,5 +35,4 @@ public class SparkGraphImporterJobTest { //Assert.assertEquals(String.format("mapped %s must be %s", t._1(), MAX), MAX, t._2().longValue()); }); } - }