4 |
4 |
import eu.dnetlib.data.proto.DatasourceProtos.Datasource.Metadata;
|
5 |
5 |
import eu.dnetlib.data.proto.FieldTypeProtos;
|
6 |
6 |
import eu.dnetlib.data.proto.FieldTypeProtos.StringField;
|
|
7 |
import eu.dnetlib.data.proto.FieldTypeProtos.Author;
|
7 |
8 |
import eu.dnetlib.data.proto.FieldTypeProtos.StructuredProperty;
|
8 |
9 |
import eu.dnetlib.data.proto.OafProtos.Oaf;
|
9 |
10 |
import eu.dnetlib.data.proto.OafProtos.OafEntity;
|
10 |
11 |
import eu.dnetlib.data.proto.OafProtos.OafRel;
|
11 |
12 |
import eu.dnetlib.data.proto.OrganizationProtos.Organization;
|
12 |
|
//import eu.dnetlib.data.proto.PersonProtos;
|
13 |
|
import eu.dnetlib.data.proto.PersonProtos;
|
14 |
13 |
import eu.dnetlib.data.proto.ProjectProtos.Project;
|
15 |
14 |
import eu.dnetlib.data.proto.ResultProtos.Result;
|
16 |
15 |
import eu.dnetlib.data.proto.ResultProtos.Result.Instance;
|
... | ... | |
41 |
40 |
return buildProject(valueEntity, DELIM);
|
42 |
41 |
case result:
|
43 |
42 |
return buildResult(valueEntity, DELIM);
|
44 |
|
/*
|
45 |
|
case person:
|
46 |
|
return buildPerson(valueEntity, DELIM);
|
47 |
|
*/
|
48 |
43 |
default:
|
49 |
44 |
break;
|
50 |
45 |
}
|
... | ... | |
93 |
88 |
buff.append(Rel.getRelType().name()).append(DELIM).append("result").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
94 |
89 |
.append("result").append(DELIM).append(cleanId(Rel.getTarget())).append(DELIM);
|
95 |
90 |
return buff.toString();
|
96 |
|
/*
|
97 |
|
case personPerson:
|
98 |
|
buff = new StringBuilder();
|
99 |
|
buff.append(Rel.getRelType().name()).append(DELIM).append("person").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
100 |
|
.append("person").append(DELIM).append(cleanId(Rel.getTarget())).append(DELIM);
|
101 |
|
return buff.toString();
|
102 |
|
*/
|
103 |
91 |
case organizationOrganization:
|
104 |
92 |
buff = new StringBuilder();
|
105 |
93 |
buff.append(Rel.getRelType().name()).append(DELIM).append("organization").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
106 |
94 |
.append("organization").append(DELIM).append(cleanId(Rel.getTarget())).append(DELIM);
|
107 |
95 |
return buff.toString();
|
108 |
|
/*
|
109 |
|
case personResult:
|
110 |
|
buff = new StringBuilder();
|
111 |
|
buff.append(Rel.getRelType().name()).append(DELIM).append("person").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
112 |
|
.append("result").append(DELIM).append(cleanId(Rel.getTarget())).append(DELIM);
|
113 |
|
return buff.toString();
|
114 |
|
*/
|
115 |
96 |
case projectOrganization:
|
116 |
97 |
buff = new StringBuilder();
|
117 |
98 |
buff.append(Rel.getRelType().name()).append(DELIM).append("project").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
118 |
99 |
.append("organization").append(DELIM).append(cleanId(Rel.getTarget())).append(DELIM);
|
119 |
100 |
return buff.toString();
|
120 |
|
/*
|
121 |
|
case projectPerson:
|
122 |
|
buff = new StringBuilder();
|
123 |
|
buff.append(Rel.getRelType().name()).append(DELIM).append("project").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
124 |
|
.append("person").append(DELIM).append(cleanId(Rel.getTarget())).append(DELIM);
|
125 |
|
return buff.toString();
|
126 |
|
*/
|
127 |
101 |
case resultOrganization:
|
128 |
102 |
buff = new StringBuilder();
|
129 |
103 |
buff.append(Rel.getRelType().name()).append(DELIM).append("result").append(DELIM).append(cleanId(Rel.getSource())).append(DELIM)
|
... | ... | |
494 |
468 |
|
495 |
469 |
//Authors
|
496 |
470 |
dataStr = " ";
|
497 |
|
for(PersonProtos.Person p : data.getResult().getAuthorList()){
|
498 |
|
dataStr += clean(p.getMetadata().getFullname().getValue()) + SEPERATOR;
|
|
471 |
for(Author p : metadata.getAuthorList()){
|
|
472 |
dataStr += clean(p.getFullname()) + SEPERATOR;
|
499 |
473 |
}
|
500 |
474 |
|
501 |
475 |
buff.append(dataStr).append(DELIM);
|
... | ... | |
580 |
554 |
|
581 |
555 |
}
|
582 |
556 |
|
583 |
|
|
584 |
|
/*
|
585 |
|
private static String buildPerson(OafEntity data, String DELIM) {
|
586 |
|
String SEPERATOR = ";";
|
587 |
|
|
588 |
|
PersonProtos.Person person = data.getPerson();
|
589 |
|
PersonProtos.Person.Metadata metadata = person.getMetadata();
|
590 |
|
|
591 |
|
StringBuilder buff = new StringBuilder();
|
592 |
|
|
593 |
|
buff.append(getHeader(data, DELIM));
|
594 |
|
|
595 |
|
// `firstname`,
|
596 |
|
buff.append(clean(metadata.getFirstname().getValue())).append(DELIM);
|
597 |
|
|
598 |
|
// `secondNames`,
|
599 |
|
String dataStr = new String();
|
600 |
|
|
601 |
|
for (StringField s : metadata.getSecondnamesList()) {
|
602 |
|
dataStr += clean(s.getValue()) + ' ';
|
603 |
|
}
|
604 |
|
|
605 |
|
buff.append(dataStr).append(DELIM);
|
606 |
|
|
607 |
|
// `fullname`,
|
608 |
|
buff.append(clean(metadata.getFullname().getValue())).append(DELIM);
|
609 |
|
|
610 |
|
// `Fax`,
|
611 |
|
buff.append(clean(metadata.getFax().getValue())).append(DELIM);
|
612 |
|
|
613 |
|
// `Email`,
|
614 |
|
buff.append(clean(metadata.getEmail().getValue())).append(DELIM);
|
615 |
|
|
616 |
|
// `Phone`,
|
617 |
|
buff.append(clean(metadata.getPhone().getValue())).append(DELIM);
|
618 |
|
|
619 |
|
// `Nationality`,
|
620 |
|
buff.append(clean(metadata.getNationality().getClassid())).append(DELIM);
|
621 |
|
|
622 |
|
// `PIDS`,
|
623 |
|
dataStr = " ";
|
624 |
|
for (StructuredProperty s : data.getPidList()) {
|
625 |
|
|
626 |
|
dataStr += clean(s.getValue()) + ";";
|
627 |
|
}
|
628 |
|
buff.append(dataStr).append(DELIM);
|
629 |
|
|
630 |
|
buff.append(getTrust(data)).append(DELIM);
|
631 |
|
|
632 |
|
return buff.toString();
|
633 |
|
|
634 |
|
}
|
635 |
|
*/
|
636 |
|
|
637 |
|
|
638 |
557 |
private static void getResultDatasources(OafEntity valueEntity, String DELIM, Set<String> returnList) {
|
639 |
558 |
String SEPERATOR = ";";
|
640 |
559 |
|
... | ... | |
766 |
685 |
FieldTypeProtos.Qualifier bestLicense = null;
|
767 |
686 |
LicenseComparator lc = new LicenseComparator();
|
768 |
687 |
for (Instance instance : (result.getInstanceList())) {
|
769 |
|
if (lc.compare(bestLicense, instance.getLicence()) > 0) {
|
770 |
|
bestLicense = instance.getLicence();
|
|
688 |
if (lc.compare(bestLicense, instance.getAccessright()) > 0) {
|
|
689 |
bestLicense = instance.getAccessright();
|
771 |
690 |
}
|
772 |
691 |
}
|
773 |
692 |
if (bestLicense != null) {
|
replace PersonProto with Author