WIP: model simplification
This commit is contained in:
parent
4d70508ad9
commit
3b5b4c565b
|
@ -6,8 +6,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class Dataset extends Result implements Serializable {
|
public class Dataset extends Result implements Serializable {
|
||||||
|
|
||||||
private static final String DATASET_RESULTTYPE = "dataset";
|
|
||||||
|
|
||||||
private String storagedate;
|
private String storagedate;
|
||||||
|
|
||||||
// candidate for removal
|
// candidate for removal
|
||||||
|
@ -24,7 +22,7 @@ public class Dataset extends Result implements Serializable {
|
||||||
private List<GeoLocation> geolocation;
|
private List<GeoLocation> geolocation;
|
||||||
|
|
||||||
public Dataset() {
|
public Dataset() {
|
||||||
setResulttype(DATASET_RESULTTYPE);
|
setResulttype(RESULTTYPE.dataset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStoragedate() {
|
public String getStoragedate() {
|
||||||
|
|
|
@ -6,8 +6,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class OtherResearchProduct extends Result implements Serializable {
|
public class OtherResearchProduct extends Result implements Serializable {
|
||||||
|
|
||||||
private static final String ORP_RESULTTYPE = "otherresearchproduct";
|
|
||||||
|
|
||||||
private List<String> contactperson;
|
private List<String> contactperson;
|
||||||
|
|
||||||
private List<String> contactgroup;
|
private List<String> contactgroup;
|
||||||
|
@ -15,7 +13,7 @@ public class OtherResearchProduct extends Result implements Serializable {
|
||||||
private List<String> tool;
|
private List<String> tool;
|
||||||
|
|
||||||
public OtherResearchProduct() {
|
public OtherResearchProduct() {
|
||||||
setResulttype(ORP_RESULTTYPE);
|
setResulttype(RESULTTYPE.otherresearchproduct);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getContactperson() {
|
public List<String> getContactperson() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.dnetlib.dhp.schema.oaf;
|
package eu.dnetlib.dhp.schema.oaf;
|
||||||
|
|
||||||
public class Provenance {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Provenance implements Serializable {
|
||||||
|
|
||||||
private KeyValue collectedfrom;
|
private KeyValue collectedfrom;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,8 @@ import java.io.Serializable;
|
||||||
|
|
||||||
public class Publication extends Result implements Serializable {
|
public class Publication extends Result implements Serializable {
|
||||||
|
|
||||||
private static final String PUBLICATION_RESULTTYPE = "publication";
|
|
||||||
|
|
||||||
public Publication() {
|
public Publication() {
|
||||||
setResulttype(PUBLICATION_RESULTTYPE);
|
setResulttype(RESULTTYPE.publication);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.schema.oaf;
|
package eu.dnetlib.dhp.schema.oaf;
|
||||||
|
|
||||||
|
import java.beans.Transient;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,139 +15,335 @@ import java.util.Objects;
|
||||||
*/
|
*/
|
||||||
public class Relation extends Oaf implements Serializable {
|
public class Relation extends Oaf implements Serializable {
|
||||||
|
|
||||||
/**
|
public enum RELTYPE {
|
||||||
* Main relationship classifier, values include 'resultResult', 'resultProject', 'resultOrganization', etc.
|
resultResult,
|
||||||
*/
|
resultProject,
|
||||||
private String relType;
|
resultOrganization,
|
||||||
|
projectOrganization,
|
||||||
|
datasourceOrganization
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public enum SUBRELTYPE {
|
||||||
* Further classifies a relationship, values include 'affiliation', 'similarity', 'supplement', etc.
|
affiliation,
|
||||||
*/
|
citation,
|
||||||
private String subRelType;
|
dedup,
|
||||||
|
outcome,
|
||||||
|
part,
|
||||||
|
participation,
|
||||||
|
provision,
|
||||||
|
relationship,
|
||||||
|
review,
|
||||||
|
similarity,
|
||||||
|
supplement,
|
||||||
|
version;
|
||||||
|
|
||||||
/**
|
public boolean exists(String subreltype) {
|
||||||
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges,
|
try {
|
||||||
* 'isMergedIn'.
|
SUBRELTYPE.valueOf(subreltype);
|
||||||
*/
|
return true;
|
||||||
private String relClass;
|
} catch (IllegalArgumentException | NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public enum RELCLASS {
|
||||||
* The source entity id.
|
IsVersionOf,
|
||||||
*/
|
IsSourceOf,
|
||||||
private String source;
|
isMergedIn,
|
||||||
|
IsIdenticalTo,
|
||||||
|
Documents,
|
||||||
|
IsAmongTopNSimilarDocuments,
|
||||||
|
IsSupplementedBy,
|
||||||
|
IsObsoletedBy,
|
||||||
|
Continues,
|
||||||
|
IsParentOf,
|
||||||
|
IsReferencedBy,
|
||||||
|
IsCitedBy,
|
||||||
|
Compiles,
|
||||||
|
IsPreviousVersionOf,
|
||||||
|
HasPart,
|
||||||
|
IsDocumentedBy,
|
||||||
|
HasAmongTopNSimilarDocuments,
|
||||||
|
isParticipant,
|
||||||
|
hasAuthorInstitution,
|
||||||
|
IsRelatedTo,
|
||||||
|
Requires,
|
||||||
|
Describes,
|
||||||
|
IsReviewedBy,
|
||||||
|
IsContinuedBy,
|
||||||
|
provides,
|
||||||
|
IsChildOf,
|
||||||
|
IsDescribedBy,
|
||||||
|
IsNewVersionOf,
|
||||||
|
IsPartOf,
|
||||||
|
HasVersion,
|
||||||
|
hasParticipant,
|
||||||
|
isAuthorInstitutionOf,
|
||||||
|
IsVariantFormOf,
|
||||||
|
isProducedBy,
|
||||||
|
IsMetadataFor,
|
||||||
|
Cites,
|
||||||
|
IsRequiredBy,
|
||||||
|
IsOriginalFormOf,
|
||||||
|
IsSupplementTo,
|
||||||
|
IsMetadataOf,
|
||||||
|
References,
|
||||||
|
IsCompiledBy,
|
||||||
|
isProvidedBy,
|
||||||
|
merges,
|
||||||
|
IsDerivedFrom,
|
||||||
|
Obsoletes,
|
||||||
|
Reviews,
|
||||||
|
produces;
|
||||||
|
|
||||||
/**
|
public static boolean exists(String relclass) {
|
||||||
* The target entity id.
|
try {
|
||||||
*/
|
RELCLASS.valueOf(relclass);
|
||||||
private String target;
|
return true;
|
||||||
|
} catch (IllegalArgumentException | NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
@Transient
|
||||||
* Was this relationship authoritatively validated?
|
public RELCLASS getInverse() {
|
||||||
*/
|
switch (this) {
|
||||||
private Boolean validated;
|
case IsVersionOf:
|
||||||
|
return HasVersion;
|
||||||
|
case IsSourceOf:
|
||||||
|
return IsDerivedFrom;
|
||||||
|
case isMergedIn:
|
||||||
|
return merges;
|
||||||
|
case IsIdenticalTo:
|
||||||
|
return IsIdenticalTo;
|
||||||
|
case Documents:
|
||||||
|
return IsDocumentedBy;
|
||||||
|
case IsAmongTopNSimilarDocuments:
|
||||||
|
return HasAmongTopNSimilarDocuments;
|
||||||
|
case IsSupplementedBy:
|
||||||
|
return IsSupplementTo;
|
||||||
|
case IsObsoletedBy:
|
||||||
|
return Obsoletes;
|
||||||
|
case Continues:
|
||||||
|
return IsContinuedBy;
|
||||||
|
case IsParentOf:
|
||||||
|
return IsChildOf;
|
||||||
|
case IsReferencedBy:
|
||||||
|
return References;
|
||||||
|
case IsCitedBy:
|
||||||
|
return Cites;
|
||||||
|
case Compiles:
|
||||||
|
return IsCompiledBy;
|
||||||
|
case IsPreviousVersionOf:
|
||||||
|
return IsNewVersionOf;
|
||||||
|
case HasPart:
|
||||||
|
return IsPartOf;
|
||||||
|
case IsDocumentedBy:
|
||||||
|
return Documents;
|
||||||
|
case HasAmongTopNSimilarDocuments:
|
||||||
|
return IsAmongTopNSimilarDocuments;
|
||||||
|
case isParticipant:
|
||||||
|
return hasParticipant;
|
||||||
|
case hasAuthorInstitution:
|
||||||
|
return isAuthorInstitutionOf;
|
||||||
|
case IsRelatedTo:
|
||||||
|
return IsRelatedTo;
|
||||||
|
case Requires:
|
||||||
|
return IsRequiredBy;
|
||||||
|
case Describes:
|
||||||
|
return IsDescribedBy;
|
||||||
|
case IsReviewedBy:
|
||||||
|
return Reviews;
|
||||||
|
case IsContinuedBy:
|
||||||
|
return Continues;
|
||||||
|
case provides:
|
||||||
|
return isProvidedBy;
|
||||||
|
case IsChildOf:
|
||||||
|
return IsParentOf;
|
||||||
|
case IsDescribedBy:
|
||||||
|
return Describes;
|
||||||
|
case IsNewVersionOf:
|
||||||
|
return IsPreviousVersionOf;
|
||||||
|
case IsPartOf:
|
||||||
|
return HasPart;
|
||||||
|
case HasVersion:
|
||||||
|
return IsVersionOf;
|
||||||
|
case hasParticipant:
|
||||||
|
return isParticipant;
|
||||||
|
case isAuthorInstitutionOf:
|
||||||
|
return hasAuthorInstitution;
|
||||||
|
case IsVariantFormOf:
|
||||||
|
return IsOriginalFormOf;
|
||||||
|
case isProducedBy:
|
||||||
|
return produces;
|
||||||
|
case IsMetadataFor:
|
||||||
|
return IsMetadataOf;
|
||||||
|
case Cites:
|
||||||
|
return IsCitedBy;
|
||||||
|
case IsRequiredBy:
|
||||||
|
return Requires;
|
||||||
|
case IsOriginalFormOf:
|
||||||
|
return IsVariantFormOf;
|
||||||
|
case IsSupplementTo:
|
||||||
|
return IsSupplementedBy;
|
||||||
|
case IsMetadataOf:
|
||||||
|
return IsMetadataFor;
|
||||||
|
case References:
|
||||||
|
return IsReferencedBy;
|
||||||
|
case IsCompiledBy:
|
||||||
|
return Compiles;
|
||||||
|
case isProvidedBy:
|
||||||
|
return provides;
|
||||||
|
case merges:
|
||||||
|
return isMergedIn;
|
||||||
|
case IsDerivedFrom:
|
||||||
|
return IsSourceOf;
|
||||||
|
case Obsoletes:
|
||||||
|
return IsObsoletedBy;
|
||||||
|
case Reviews:
|
||||||
|
return IsReviewedBy;
|
||||||
|
case produces:
|
||||||
|
return isProducedBy;
|
||||||
|
}
|
||||||
|
// makes the compiler happy
|
||||||
|
throw new IllegalArgumentException("missing inverse mapping for" + this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When was this relationship authoritatively validated.
|
* Main relationship classifier, values include 'resultResult', 'resultProject', 'resultOrganization', etc.
|
||||||
*/
|
*/
|
||||||
private String validationDate;
|
private RELTYPE relType;
|
||||||
|
|
||||||
private List<Provenance> provenance;
|
/**
|
||||||
|
* Further classifies a relationship, values include 'affiliation', 'similarity', 'supplement', etc.
|
||||||
|
*/
|
||||||
|
private SUBRELTYPE subRelType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of relation specific properties. Values include 'similarityLevel', indicating the similarity score between a
|
* Indicates the direction of the relationship, values include 'isSupplementTo', 'isSupplementedBy', 'merges,
|
||||||
* pair of publications.
|
* 'isMergedIn'.
|
||||||
*/
|
*/
|
||||||
private List<KeyValue> properties = new ArrayList<>();
|
private RELCLASS relClass;
|
||||||
|
|
||||||
public String getRelType() {
|
/**
|
||||||
return relType;
|
* The source entity id.
|
||||||
}
|
*/
|
||||||
|
private String source;
|
||||||
|
|
||||||
public void setRelType(final String relType) {
|
/**
|
||||||
this.relType = relType;
|
* The target entity id.
|
||||||
}
|
*/
|
||||||
|
private String target;
|
||||||
|
|
||||||
public String getSubRelType() {
|
/**
|
||||||
return subRelType;
|
* Was this relationship authoritatively validated?
|
||||||
}
|
*/
|
||||||
|
private Boolean validated;
|
||||||
|
|
||||||
public void setSubRelType(final String subRelType) {
|
/**
|
||||||
this.subRelType = subRelType;
|
* When was this relationship authoritatively validated.
|
||||||
}
|
*/
|
||||||
|
private String validationDate;
|
||||||
|
|
||||||
public String getRelClass() {
|
private List<Provenance> provenance;
|
||||||
return relClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRelClass(final String relClass) {
|
/**
|
||||||
this.relClass = relClass;
|
* List of relation specific properties. Values include 'similarityLevel', indicating the similarity score between a
|
||||||
}
|
* pair of publications.
|
||||||
|
*/
|
||||||
|
private List<KeyValue> properties = new ArrayList<>();
|
||||||
|
|
||||||
public String getSource() {
|
public RELTYPE getRelType() {
|
||||||
return source;
|
return relType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSource(final String source) {
|
public void setRelType(final RELTYPE relType) {
|
||||||
this.source = source;
|
this.relType = relType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTarget() {
|
public SUBRELTYPE getSubRelType() {
|
||||||
return target;
|
return subRelType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarget(final String target) {
|
public void setSubRelType(final SUBRELTYPE subRelType) {
|
||||||
this.target = target;
|
this.subRelType = subRelType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<KeyValue> getProperties() {
|
public RELCLASS getRelClass() {
|
||||||
return properties;
|
return relClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperties(List<KeyValue> properties) {
|
public void setRelClass(final RELCLASS relClass) {
|
||||||
this.properties = properties;
|
this.relClass = relClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getValidated() {
|
public String getSource() {
|
||||||
return Objects.nonNull(validated) && validated;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidated(Boolean validated) {
|
public void setSource(final String source) {
|
||||||
this.validated = validated;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValidationDate() {
|
public String getTarget() {
|
||||||
return validationDate;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidationDate(String validationDate) {
|
public void setTarget(final String target) {
|
||||||
this.validationDate = validationDate;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Provenance> getProvenance() {
|
public List<KeyValue> getProperties() {
|
||||||
return provenance;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProvenance(List<Provenance> provenance) {
|
public void setProperties(List<KeyValue> properties) {
|
||||||
this.provenance = provenance;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Boolean getValidated() {
|
||||||
public boolean equals(Object o) {
|
return Objects.nonNull(validated) && validated;
|
||||||
if (this == o)
|
}
|
||||||
return true;
|
|
||||||
if (o == null || getClass() != o.getClass())
|
|
||||||
return false;
|
|
||||||
Relation relation = (Relation) o;
|
|
||||||
return relType.equals(relation.relType)
|
|
||||||
&& subRelType.equals(relation.subRelType)
|
|
||||||
&& relClass.equals(relation.relClass)
|
|
||||||
&& source.equals(relation.source)
|
|
||||||
&& target.equals(relation.target);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public void setValidated(Boolean validated) {
|
||||||
public int hashCode() {
|
this.validated = validated;
|
||||||
return Objects.hash(relType, subRelType, relClass, source, target, provenance);
|
}
|
||||||
}
|
|
||||||
|
public String getValidationDate() {
|
||||||
|
return validationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidationDate(String validationDate) {
|
||||||
|
this.validationDate = validationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Provenance> getProvenance() {
|
||||||
|
return provenance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvenance(List<Provenance> provenance) {
|
||||||
|
this.provenance = provenance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
Relation relation = (Relation) o;
|
||||||
|
return relType.equals(relation.relType)
|
||||||
|
&& subRelType.equals(relation.subRelType)
|
||||||
|
&& relClass.equals(relation.relClass)
|
||||||
|
&& source.equals(relation.source)
|
||||||
|
&& target.equals(relation.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(relType, subRelType, relClass, source, target, provenance);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class Result extends Entity implements Serializable {
|
public class Result extends Entity implements Serializable {
|
||||||
|
|
||||||
|
public enum RESULTTYPE {
|
||||||
|
publication,
|
||||||
|
dataset,
|
||||||
|
software,
|
||||||
|
otherresearchproduct
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ( article | book ) processing charges.
|
* ( article | book ) processing charges.
|
||||||
*/
|
*/
|
||||||
|
@ -27,7 +34,7 @@ public class Result extends Entity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* The Resulttype. It allows subclassing results into publications | datasets | software | orp
|
* The Resulttype. It allows subclassing results into publications | datasets | software | orp
|
||||||
*/
|
*/
|
||||||
private String resulttype;
|
private RESULTTYPE resulttype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Language.
|
* The Language.
|
||||||
|
@ -172,7 +179,7 @@ public class Result extends Entity implements Serializable {
|
||||||
*
|
*
|
||||||
* @return the resulttype
|
* @return the resulttype
|
||||||
*/
|
*/
|
||||||
public String getResulttype() {
|
public RESULTTYPE getResulttype() {
|
||||||
return resulttype;
|
return resulttype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +188,7 @@ public class Result extends Entity implements Serializable {
|
||||||
*
|
*
|
||||||
* @param resulttype the resulttype
|
* @param resulttype the resulttype
|
||||||
*/
|
*/
|
||||||
public void setResulttype(String resulttype) {
|
public void setResulttype(RESULTTYPE resulttype) {
|
||||||
this.resulttype = resulttype;
|
this.resulttype = resulttype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class Software extends Result implements Serializable {
|
public class Software extends Result implements Serializable {
|
||||||
|
|
||||||
private static final String SOFTWARE_RESULTTYPE = "software";
|
|
||||||
|
|
||||||
private List<String> documentationUrl;
|
private List<String> documentationUrl;
|
||||||
|
|
||||||
// candidate for removal
|
// candidate for removal
|
||||||
|
@ -16,7 +14,7 @@ public class Software extends Result implements Serializable {
|
||||||
private Qualifier programmingLanguage;
|
private Qualifier programmingLanguage;
|
||||||
|
|
||||||
public Software() {
|
public Software() {
|
||||||
setResulttype(SOFTWARE_RESULTTYPE);
|
setResulttype(RESULTTYPE.software);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDocumentationUrl() {
|
public List<String> getDocumentationUrl() {
|
||||||
|
|
|
@ -22,9 +22,9 @@ class AtomicActionTest {
|
||||||
Relation rel = new Relation();
|
Relation rel = new Relation();
|
||||||
rel.setSource("1");
|
rel.setSource("1");
|
||||||
rel.setTarget("2");
|
rel.setTarget("2");
|
||||||
rel.setRelType("resultResult");
|
rel.setRelType(Relation.RELTYPE.resultResult);
|
||||||
rel.setSubRelType("dedup");
|
rel.setSubRelType(Relation.SUBRELTYPE.dedup);
|
||||||
rel.setRelClass("merges");
|
rel.setRelClass(Relation.RELCLASS.merges);
|
||||||
|
|
||||||
AtomicAction aa1 = new AtomicAction(Relation.class, rel);
|
AtomicAction aa1 = new AtomicAction(Relation.class, rel);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue