[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; this.contributors = contributors;
} }
public void setGrantCode(String value) { public void setGrantCode(String value) {
grantCode = 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(); eu.dnetlib.dhp.skgif.model.Datasource datasource = new eu.dnetlib.dhp.skgif.model.Datasource();
Tuple2<Datasource, Tuple2<String, EncloseMinElement>> first = vs.next(); Tuple2<Datasource, Tuple2<String, EncloseMinElement>> first = vs.next();
Datasource d = first._1(); 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.setLocal_identifier(d.getId());
datasource datasource
.setIdentifiers( .setIdentifiers(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -251,7 +251,7 @@ public class EmitFromEntitiesJobTest {
Dataset<EmitPerManifestation> manifestationDataset = spark Dataset<EmitPerManifestation> manifestationDataset = spark
.createDataset(manifestation.rdd(), Encoders.bean(EmitPerManifestation.class)); .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)));
} }
} }