[SKG-IF] denormalization fixing issue and new properties

This commit is contained in:
Miriam Baglioni 2024-03-12 14:58:42 +01:00
parent cb9a081236
commit 2811e2ebd7
9 changed files with 20 additions and 19 deletions

View File

@ -158,7 +158,7 @@ public class Grant implements Serializable {
this.contributors = contributors;
}
public void setGrantCode(String value) {
public void setGrantCode(String value) {
grantCode = value;
}
}
}

View File

@ -112,7 +112,7 @@ public class DumpDatasource implements Serializable {
eu.dnetlib.dhp.skgif.model.Datasource datasource = new eu.dnetlib.dhp.skgif.model.Datasource();
Tuple2<Datasource, Tuple2<String, EncloseMinElement>> first = vs.next();
Datasource d = first._1();
//datasource.setLocal_identifier(Utils.getIdentifier(Prefixes.DATASOURCE, d.getId()));
// datasource.setLocal_identifier(Utils.getIdentifier(Prefixes.DATASOURCE, d.getId()));
datasource.setLocal_identifier(d.getId());
datasource
.setIdentifiers(

View File

@ -110,7 +110,7 @@ public class DumpGrant implements Serializable {
(MapGroupsFunction<String, Tuple2<Project, Tuple2<String, EncloseMinElement>>, Grant>) (k, v) -> {
Grant g = new Grant();
Tuple2<Project, Tuple2<String, EncloseMinElement>> first = v.next();
g.setLocal_identifier( k);
g.setLocal_identifier(k);
g.setGrantCode(first._1().getCode().getValue());
g.setIdentifiers(getProjectIdentifier(first._1()));
g.setTitle(first._1().getTitle().getValue());

View File

@ -74,7 +74,7 @@ public class DumpOrganization implements Serializable {
&& !o.getDataInfo().getInvisible())
.map((MapFunction<Organization, eu.dnetlib.dhp.skgif.model.Organization>) o -> {
eu.dnetlib.dhp.skgif.model.Organization organization = new eu.dnetlib.dhp.skgif.model.Organization();
//organization.setLocal_identifier(Utils.getIdentifier(Prefixes.ORGANIZATION, o.getId()));
// organization.setLocal_identifier(Utils.getIdentifier(Prefixes.ORGANIZATION, o.getId()));
organization.setLocal_identifier(o.getId());
organization
.setCountry(

View File

@ -289,8 +289,8 @@ public class DumpResult implements Serializable {
.setHosting_datasource(
MinVenue
.newInstance(
//Utils.getIdentifier(Prefixes.DATASOURCE, epm.getInstance().getHostedby().getKey()),
epm.getInstance().getHostedby().getKey(),
// Utils.getIdentifier(Prefixes.DATASOURCE, epm.getInstance().getHostedby().getKey()),
epm.getInstance().getHostedby().getKey(),
epm.getInstance().getHostedby().getValue()));
return manifestation;

View File

@ -123,8 +123,9 @@ public class EmitFromEntities implements Serializable {
.setMinDatsource(
MinVenue
.newInstance(
//Utils.getIdentifier(Prefixes.DATASOURCE, d.getId()), d.getOfficialname().getValue()));
d.getId(), d.getOfficialname().getValue()));
// Utils.getIdentifier(Prefixes.DATASOURCE, d.getId()),
// d.getOfficialname().getValue()));
d.getId(), d.getOfficialname().getValue()));
eme.setEnclosedEntityId(d.getId());
return eme;
}, Encoders.bean(EncloseMinElement.class))
@ -222,8 +223,8 @@ public class EmitFromEntities implements Serializable {
.stream()
.filter(
s -> s.getQualifier().getClassid().equalsIgnoreCase("fos")
//|| s.getQualifier().getClassid().equalsIgnoreCase("sdg"))
)
// || s.getQualifier().getClassid().equalsIgnoreCase("sdg"))
)
.map(s -> {
Topic t = new Topic();
t

View File

@ -27,7 +27,7 @@ public class ResultMapper implements Serializable {
Optional<Qualifier> ort = Optional.ofNullable(input.getResulttype());
if (ort.isPresent()) {
try {
//out.setLocal_identifier(Utils.getIdentifier(Prefixes.RESEARCH_PRODUCT, input.getId()));
// out.setLocal_identifier(Utils.getIdentifier(Prefixes.RESEARCH_PRODUCT, input.getId()));
out.setLocal_identifier(input.getId());
mapPid(out, input);
mapTitle(out, input);
@ -93,7 +93,7 @@ public class ResultMapper implements Serializable {
.getSubject()
.stream()
.filter(
s -> s.getQualifier().getClassid().equalsIgnoreCase("fos") )
s -> s.getQualifier().getClassid().equalsIgnoreCase("fos"))
// ||
// s.getQualifier().getClassid().equalsIgnoreCase("sdg"))
.map(s -> {

View File

@ -87,14 +87,14 @@ public class Utils implements Serializable {
public static MinOrganization getMinOrganization(Organization o) {
MinOrganization mo = new MinOrganization();
//mo.setLocal_identifier(Utils.getIdentifier(Prefixes.ORGANIZATION, o.getId()));
// mo.setLocal_identifier(Utils.getIdentifier(Prefixes.ORGANIZATION, o.getId()));
mo.setLocal_identifier(o.getId());
if (Optional.ofNullable(o.getLegalname()).isPresent())
mo.setName(o.getLegalname().getValue());
if (Optional.ofNullable(o.getPid()).isPresent())
for (StructuredProperty pid : o.getPid()) {
if(Optional.ofNullable(pid.getQualifier()).isPresent() &&
Optional.ofNullable(pid.getQualifier().getClassid()).isPresent())
if (Optional.ofNullable(pid.getQualifier()).isPresent() &&
Optional.ofNullable(pid.getQualifier().getClassid()).isPresent())
switch (pid.getQualifier().getClassid().toLowerCase()) {
case "ror":
mo.setRor(pid.getValue());
@ -119,7 +119,7 @@ public class Utils implements Serializable {
public static MinGrant getMinGrant(Project p) throws DocumentException {
MinGrant mg = new MinGrant();
//mg.setLocal_identifier(Utils.getIdentifier(Prefixes.GRANT, p.getId()));
// mg.setLocal_identifier(Utils.getIdentifier(Prefixes.GRANT, p.getId()));
mg.setLocal_identifier(p.getId());
if (Optional.ofNullable(p.getCode()).isPresent())
mg.setCode(p.getCode().getValue());
@ -136,7 +136,7 @@ public class Utils implements Serializable {
public static <R extends Result> MinProduct getMinProduct(R r) throws JsonProcessingException {
MinProduct mp = new MinProduct();
//mp.setLocal_identifier(Utils.getIdentifier(Prefixes.RESEARCH_PRODUCT, r.getId()));
// mp.setLocal_identifier(Utils.getIdentifier(Prefixes.RESEARCH_PRODUCT, r.getId()));
mp.setLocal_identifier(r.getId());
for (StructuredProperty title : r.getTitle()) {
if (title.getQualifier().getClassid().equalsIgnoreCase("main title")) {

View File

@ -251,7 +251,7 @@ public class EmitFromEntitiesJobTest {
Dataset<EmitPerManifestation> manifestationDataset = spark
.createDataset(manifestation.rdd(), Encoders.bean(EmitPerManifestation.class));
manifestation.foreach(m-> System.out.println(OBJECT_MAPPER.writeValueAsString(m)));
manifestation.foreach(m -> System.out.println(OBJECT_MAPPER.writeValueAsString(m)));
}
}