subject) {
+ this.subject = subject;
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java
new file mode 100644
index 0000000..ad4ad88
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/graph/ResearchInitiative.java
@@ -0,0 +1,75 @@
+
+package eu.dnetlib.dhp.schema.dump.oaf.graph;
+
+import java.io.Serializable;
+
+/**
+ * To represent entity of type RC/RI. It has the following parameters, which are mostly derived by the profile
+ * - private
+ * String id to store the openaire id for the entity. Is has as code 00 and will be created as
+ * 00|context_____::md5(originalId) private
+ * String originalId to store the id of the context as provided in the profile
+ * (i.e. mes)
+ * - private String name to store the name of the context (got from the label attribute in the context
+ * definition)
+ * - private String type to store the type of the context (i.e.: research initiative or research community)
+ * - private String description to store the description of the context as given in the profile
+ * -private String
+ * zenodo_community to store the zenodo community associated to the context (main zenodo community)
+ */
+public class ResearchInitiative implements Serializable {
+ private String id; // openaireId
+ private String originalId; // context id
+ private String name; // context name
+ private String type; // context type: research initiative or research community
+ private String description;
+ private String zenodo_community;
+
+ public String getZenodo_community() {
+ return zenodo_community;
+ }
+
+ public void setZenodo_community(String zenodo_community) {
+ this.zenodo_community = zenodo_community;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String label) {
+ this.name = label;
+ }
+
+ public String getOriginalId() {
+ return originalId;
+ }
+
+ public void setOriginalId(String originalId) {
+ this.originalId = originalId;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java
new file mode 100644
index 0000000..8277e14
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java
@@ -0,0 +1,123 @@
+
+package eu.dnetlib.dhp.schema.mdstore;
+
+import java.io.Serializable;
+
+import eu.dnetlib.dhp.schema.common.ModelSupport;
+
+/**
+ * This class models a record in a Metadata store collection on HDFS
+ */
+public class MetadataRecord implements Serializable {
+
+ /** The D-Net Identifier associated to the record */
+ private String id;
+
+ /** The original Identifier of the record */
+ private String originalId;
+
+ /** The encoding of the record, should be JSON or XML */
+ private String encoding;
+
+ /**
+ * The information about the provenance of the record see @{@link Provenance} for the model of this information
+ */
+ private Provenance provenance;
+
+ /** The content of the metadata */
+ private String body;
+
+ /** the date when the record has been stored */
+ private Long dateOfCollection;
+
+ /** the date when the record has been stored */
+ private Long dateOfTransformation;
+
+ public MetadataRecord() {
+
+ }
+
+ public MetadataRecord(
+ String originalId,
+ String encoding,
+ Provenance provenance,
+ String body,
+ Long dateOfCollection) {
+
+ this.originalId = originalId;
+ this.encoding = encoding;
+ this.provenance = provenance;
+ this.body = body;
+ this.dateOfCollection = dateOfCollection;
+ this.id = ModelSupport.generateIdentifier(originalId, this.provenance.getNsPrefix());
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getOriginalId() {
+ return originalId;
+ }
+
+ public void setOriginalId(String originalId) {
+ this.originalId = originalId;
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ public Provenance getProvenance() {
+ return provenance;
+ }
+
+ public void setProvenance(Provenance provenance) {
+ this.provenance = provenance;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ public Long getDateOfCollection() {
+ return dateOfCollection;
+ }
+
+ public void setDateOfCollection(Long dateOfCollection) {
+ this.dateOfCollection = dateOfCollection;
+ }
+
+ public Long getDateOfTransformation() {
+ return dateOfTransformation;
+ }
+
+ public void setDateOfTransformation(Long dateOfTransformation) {
+ this.dateOfTransformation = dateOfTransformation;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof MetadataRecord)) {
+ return false;
+ }
+ return ((MetadataRecord) o).getId().equalsIgnoreCase(id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/Provenance.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/Provenance.java
new file mode 100644
index 0000000..8af58f6
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/Provenance.java
@@ -0,0 +1,52 @@
+
+package eu.dnetlib.dhp.schema.mdstore;
+
+import java.io.Serializable;
+
+/**
+ * @author Sandro La Bruzzo
+ *
+ * Provenace class models the provenance of the record in the metadataStore It contains the identifier and the
+ * name of the datasource that gives the record
+ */
+public class Provenance implements Serializable {
+
+ private String datasourceId;
+
+ private String datasourceName;
+
+ private String nsPrefix;
+
+ public Provenance() {
+ }
+
+ public Provenance(String datasourceId, String datasourceName, String nsPrefix) {
+ this.datasourceId = datasourceId;
+ this.datasourceName = datasourceName;
+ this.nsPrefix = nsPrefix;
+ }
+
+ 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 getNsPrefix() {
+ return nsPrefix;
+ }
+
+ public void setNsPrefix(String nsPrefix) {
+ this.nsPrefix = nsPrefix;
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java
new file mode 100644
index 0000000..47de365
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java
@@ -0,0 +1,48 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.util.Optional;
+
+/**
+ * This class models the access rights of research products.
+ */
+public class AccessRight extends Qualifier {
+
+ private OpenAccessRoute openAccessRoute;
+
+ public OpenAccessRoute getOpenAccessRoute() {
+ return openAccessRoute;
+ }
+
+ public void setOpenAccessRoute(OpenAccessRoute openAccessRoute) {
+ this.openAccessRoute = openAccessRoute;
+ }
+
+ public String toComparableString() {
+ String s = super.toComparableString();
+ return Optional
+ .ofNullable(getOpenAccessRoute())
+ .map(x -> s + "::" + x.toString())
+ .orElse(s);
+ }
+
+ @Override
+ public int hashCode() {
+ return toComparableString().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+
+ Qualifier other = (Qualifier) obj;
+
+ return toComparableString().equals(other.toComparableString());
+ }
+
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Author.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Author.java
new file mode 100644
index 0000000..b2f757d
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Author.java
@@ -0,0 +1,90 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.io.Serializable;
+import java.util.*;
+
+public class Author implements Serializable {
+
+ private String fullname;
+
+ private String name;
+
+ private String surname;
+
+ // START WITH 1
+ private Integer rank;
+
+ private List pid;
+
+ private List> affiliation;
+
+ public String getFullname() {
+ return fullname;
+ }
+
+ public void setFullname(String fullname) {
+ this.fullname = fullname;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getSurname() {
+ return surname;
+ }
+
+ public void setSurname(String surname) {
+ this.surname = surname;
+ }
+
+ public Integer getRank() {
+ return rank;
+ }
+
+ public void setRank(Integer rank) {
+ this.rank = rank;
+ }
+
+ public List getPid() {
+ return pid;
+ }
+
+ public void setPid(List pid) {
+ this.pid = pid;
+ }
+
+ public List> getAffiliation() {
+ return affiliation;
+ }
+
+ public void setAffiliation(List> affiliation) {
+ this.affiliation = affiliation;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Author author = (Author) o;
+ return Objects.equals(fullname, author.fullname)
+ && Objects.equals(name, author.name)
+ && Objects.equals(surname, author.surname)
+ && Objects.equals(rank, author.rank)
+ && Objects.equals(pid, author.pid)
+ && Objects.equals(affiliation, author.affiliation);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(fullname, name, surname, rank, pid, affiliation);
+ }
+
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Context.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Context.java
new file mode 100644
index 0000000..57912c4
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Context.java
@@ -0,0 +1,46 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class Context implements Serializable {
+ private String id;
+
+ private List dataInfo;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public List getDataInfo() {
+ return dataInfo;
+ }
+
+ public void setDataInfo(List dataInfo) {
+ this.dataInfo = dataInfo;
+ }
+
+ @Override
+ public int hashCode() {
+ return id == null ? 0 : id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+
+ Context other = (Context) obj;
+
+ return id.equals(other.getId());
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Country.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Country.java
new file mode 100644
index 0000000..e25fdca
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Country.java
@@ -0,0 +1,34 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.util.Objects;
+
+public class Country extends Qualifier {
+
+ private DataInfo dataInfo;
+
+ public DataInfo getDataInfo() {
+ return dataInfo;
+ }
+
+ public void setDataInfo(DataInfo dataInfo) {
+ this.dataInfo = dataInfo;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ if (!super.equals(o))
+ return false;
+ Country country = (Country) o;
+ return Objects.equals(dataInfo, country.dataInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), dataInfo);
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/DataInfo.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/DataInfo.java
new file mode 100644
index 0000000..9d572ee
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/DataInfo.java
@@ -0,0 +1,85 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+public class DataInfo implements Serializable {
+
+ private Boolean invisible = false;
+ private Boolean inferred;
+ private Boolean deletedbyinference = false;
+ private String trust;
+ private String inferenceprovenance;
+ private Qualifier provenanceaction;
+
+ public Boolean getInvisible() {
+ return invisible;
+ }
+
+ public void setInvisible(Boolean invisible) {
+ this.invisible = invisible;
+ }
+
+ public Boolean getInferred() {
+ return inferred;
+ }
+
+ public void setInferred(Boolean inferred) {
+ this.inferred = inferred;
+ }
+
+ public Boolean getDeletedbyinference() {
+ return deletedbyinference;
+ }
+
+ public void setDeletedbyinference(Boolean deletedbyinference) {
+ this.deletedbyinference = deletedbyinference;
+ }
+
+ public String getTrust() {
+ return trust;
+ }
+
+ public void setTrust(String trust) {
+ this.trust = trust;
+ }
+
+ public String getInferenceprovenance() {
+ return inferenceprovenance;
+ }
+
+ public void setInferenceprovenance(String inferenceprovenance) {
+ this.inferenceprovenance = inferenceprovenance;
+ }
+
+ public Qualifier getProvenanceaction() {
+ return provenanceaction;
+ }
+
+ public void setProvenanceaction(Qualifier provenanceaction) {
+ this.provenanceaction = provenanceaction;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ DataInfo dataInfo = (DataInfo) o;
+ return Objects.equals(invisible, dataInfo.invisible)
+ && Objects.equals(inferred, dataInfo.inferred)
+ && Objects.equals(deletedbyinference, dataInfo.deletedbyinference)
+ && Objects.equals(trust, dataInfo.trust)
+ && Objects.equals(inferenceprovenance, dataInfo.inferenceprovenance)
+ && Objects.equals(provenanceaction, dataInfo.provenanceaction);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects
+ .hash(
+ invisible, inferred, deletedbyinference, trust, inferenceprovenance, provenanceaction);
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java
new file mode 100644
index 0000000..b5587c6
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Dataset.java
@@ -0,0 +1,116 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.io.Serializable;
+import java.util.List;
+
+import eu.dnetlib.dhp.schema.common.ModelConstants;
+
+public class Dataset extends Result implements Serializable {
+
+ private Field storagedate;
+
+ // candidate for removal
+ private Field device;
+
+ private Field size;
+
+ private Field version;
+
+ private Field lastmetadataupdate;
+
+ private Field metadataversionnumber;
+
+ private List geolocation;
+
+ public Dataset() {
+ setResulttype(ModelConstants.DATASET_DEFAULT_RESULTTYPE);
+ }
+
+ public Field getStoragedate() {
+ return storagedate;
+ }
+
+ public void setStoragedate(Field storagedate) {
+ this.storagedate = storagedate;
+ }
+
+ public Field getDevice() {
+ return device;
+ }
+
+ public void setDevice(Field device) {
+ this.device = device;
+ }
+
+ public Field getSize() {
+ return size;
+ }
+
+ public void setSize(Field size) {
+ this.size = size;
+ }
+
+ public Field getVersion() {
+ return version;
+ }
+
+ public void setVersion(Field version) {
+ this.version = version;
+ }
+
+ public Field getLastmetadataupdate() {
+ return lastmetadataupdate;
+ }
+
+ public void setLastmetadataupdate(Field lastmetadataupdate) {
+ this.lastmetadataupdate = lastmetadataupdate;
+ }
+
+ public Field getMetadataversionnumber() {
+ return metadataversionnumber;
+ }
+
+ public void setMetadataversionnumber(Field metadataversionnumber) {
+ this.metadataversionnumber = metadataversionnumber;
+ }
+
+ public List getGeolocation() {
+ return geolocation;
+ }
+
+ public void setGeolocation(List geolocation) {
+ this.geolocation = geolocation;
+ }
+
+ @Override
+ public void mergeFrom(OafEntity e) {
+ super.mergeFrom(e);
+
+ if (!Dataset.class.isAssignableFrom(e.getClass())) {
+ return;
+ }
+
+ final Dataset d = (Dataset) e;
+
+ storagedate = d.getStoragedate() != null && compareTrust(this, e) < 0 ? d.getStoragedate() : storagedate;
+
+ device = d.getDevice() != null && compareTrust(this, e) < 0 ? d.getDevice() : device;
+
+ size = d.getSize() != null && compareTrust(this, e) < 0 ? d.getSize() : size;
+
+ version = d.getVersion() != null && compareTrust(this, e) < 0 ? d.getVersion() : version;
+
+ lastmetadataupdate = d.getLastmetadataupdate() != null && compareTrust(this, e) < 0
+ ? d.getLastmetadataupdate()
+ : lastmetadataupdate;
+
+ metadataversionnumber = d.getMetadataversionnumber() != null && compareTrust(this, e) < 0
+ ? d.getMetadataversionnumber()
+ : metadataversionnumber;
+
+ geolocation = mergeLists(geolocation, d.getGeolocation());
+
+ mergeOAFDataInfo(d);
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java b/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java
new file mode 100644
index 0000000..7217982
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/oaf/Datasource.java
@@ -0,0 +1,472 @@
+
+package eu.dnetlib.dhp.schema.oaf;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class Datasource extends OafEntity implements Serializable {
+
+ private Qualifier datasourcetype;
+
+ private Qualifier openairecompatibility;
+
+ private Field officialname;
+
+ private Field englishname;
+
+ private Field websiteurl;
+
+ private Field logourl;
+
+ private Field contactemail;
+
+ private Field namespaceprefix;
+
+ private Field latitude;
+
+ private Field longitude;
+
+ private Field dateofvalidation;
+
+ private Field description;
+
+ private List subjects;
+
+ // opendoar specific fields (od*)
+ private Field odnumberofitems;
+
+ private Field odnumberofitemsdate;
+
+ private Field odpolicies;
+
+ private List> odlanguages;
+
+ private List> odcontenttypes;
+
+ private List> accessinfopackage;
+
+ // re3data fields
+ private Field releasestartdate;
+
+ private Field releaseenddate;
+
+ private Field missionstatementurl;
+
+ private Field dataprovider;
+
+ private Field serviceprovider;
+
+ // {open, restricted or closed}
+ private Field databaseaccesstype;
+
+ // {open, restricted or closed}
+ private Field datauploadtype;
+
+ // {feeRequired, registration, other}
+ private Field databaseaccessrestriction;
+
+ // {feeRequired, registration, other}
+ private Field datauploadrestriction;
+
+ private Field versioning;
+
+ private Field citationguidelineurl;
+
+ // {yes, no, uknown}
+ private Field qualitymanagementkind;
+
+ private Field pidsystems;
+
+ private Field certificates;
+
+ private List policies;
+
+ private Journal journal;
+
+ public Qualifier getDatasourcetype() {
+ return datasourcetype;
+ }
+
+ public void setDatasourcetype(Qualifier datasourcetype) {
+ this.datasourcetype = datasourcetype;
+ }
+
+ public Qualifier getOpenairecompatibility() {
+ return openairecompatibility;
+ }
+
+ public void setOpenairecompatibility(Qualifier openairecompatibility) {
+ this.openairecompatibility = openairecompatibility;
+ }
+
+ public Field getOfficialname() {
+ return officialname;
+ }
+
+ public void setOfficialname(Field officialname) {
+ this.officialname = officialname;
+ }
+
+ public Field getEnglishname() {
+ return englishname;
+ }
+
+ public void setEnglishname(Field englishname) {
+ this.englishname = englishname;
+ }
+
+ public Field getWebsiteurl() {
+ return websiteurl;
+ }
+
+ public void setWebsiteurl(Field websiteurl) {
+ this.websiteurl = websiteurl;
+ }
+
+ public Field getLogourl() {
+ return logourl;
+ }
+
+ public void setLogourl(Field logourl) {
+ this.logourl = logourl;
+ }
+
+ public Field getContactemail() {
+ return contactemail;
+ }
+
+ public void setContactemail(Field contactemail) {
+ this.contactemail = contactemail;
+ }
+
+ public Field getNamespaceprefix() {
+ return namespaceprefix;
+ }
+
+ public void setNamespaceprefix(Field namespaceprefix) {
+ this.namespaceprefix = namespaceprefix;
+ }
+
+ public Field getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(Field latitude) {
+ this.latitude = latitude;
+ }
+
+ public Field getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(Field