Merge pull request 'hierarchical_orgs_relations' (#150) from hierarchical_orgs_relations into beta
Reviewed-on: #150
This commit is contained in:
commit
d0cf2963f0
|
@ -186,6 +186,9 @@ public class MigrateDbEntitiesApplication extends AbstractMigrationApplication i
|
||||||
|
|
||||||
log.info("Processing Openorgs Merge Rels...");
|
log.info("Processing Openorgs Merge Rels...");
|
||||||
smdbe.execute("queryOpenOrgsSimilarityForProvision.sql", smdbe::processOrgOrgMergeRels);
|
smdbe.execute("queryOpenOrgsSimilarityForProvision.sql", smdbe::processOrgOrgMergeRels);
|
||||||
|
|
||||||
|
log.info("Processing Openorgs Parent/Child Rels...");
|
||||||
|
smdbe.execute("queryParentChildRelsOpenOrgs.sql", smdbe::processOrgOrgParentChildRels);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case openaire_organizations:
|
case openaire_organizations:
|
||||||
|
@ -689,6 +692,35 @@ public class MigrateDbEntitiesApplication extends AbstractMigrationApplication i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Oaf> processOrgOrgParentChildRels(final ResultSet rs) {
|
||||||
|
try {
|
||||||
|
final DataInfo info = prepareDataInfo(rs); // TODO
|
||||||
|
|
||||||
|
final String orgId1 = createOpenaireId(20, rs.getString("source"), true);
|
||||||
|
final String orgId2 = createOpenaireId(20, rs.getString("target"), true);
|
||||||
|
|
||||||
|
final List<KeyValue> collectedFrom = listKeyValues(
|
||||||
|
createOpenaireId(10, rs.getString("collectedfromid"), true), rs.getString("collectedfromname"));
|
||||||
|
|
||||||
|
final Relation r = new Relation();
|
||||||
|
r.setRelType(ORG_ORG_RELTYPE);
|
||||||
|
r.setSubRelType(ModelConstants.RELATIONSHIP);
|
||||||
|
r
|
||||||
|
.setRelClass(
|
||||||
|
rs.getString("type").equalsIgnoreCase("parent") ? ModelConstants.IS_PARENT_OF
|
||||||
|
: ModelConstants.IS_CHILD_OF);
|
||||||
|
r.setSource(orgId1);
|
||||||
|
r.setTarget(orgId2);
|
||||||
|
r.setCollectedfrom(collectedFrom);
|
||||||
|
r.setDataInfo(info);
|
||||||
|
r.setLastupdatetimestamp(lastUpdateTimestamp);
|
||||||
|
|
||||||
|
return Arrays.asList(r);
|
||||||
|
} catch (final Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Oaf> processOrgOrgSimRels(final ResultSet rs) {
|
public List<Oaf> processOrgOrgSimRels(final ResultSet rs) {
|
||||||
try {
|
try {
|
||||||
final DataInfo info = prepareDataInfo(rs); // TODO
|
final DataInfo info = prepareDataInfo(rs); // TODO
|
||||||
|
|
|
@ -258,7 +258,7 @@
|
||||||
<switch>
|
<switch>
|
||||||
<case to="ImportDB">${wf:conf('reuseDB') eq false}</case>
|
<case to="ImportDB">${wf:conf('reuseDB') eq false}</case>
|
||||||
<case to="reuse_odf">${wf:conf('reuseDB') eq true}</case>
|
<case to="reuse_odf">${wf:conf('reuseDB') eq true}</case>
|
||||||
<default to="ImportDB_claims"/>
|
<default to="ImportDB"/>
|
||||||
</switch>
|
</switch>
|
||||||
</decision>
|
</decision>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
SELECT
|
||||||
|
id1 AS source,
|
||||||
|
id2 AS target,
|
||||||
|
reltype AS type,
|
||||||
|
false AS inferred,
|
||||||
|
false AS deletedbyinference,
|
||||||
|
0.95 AS trust,
|
||||||
|
'' AS inferenceprovenance,
|
||||||
|
'openaire____::openorgs' AS collectedfromid,
|
||||||
|
'OpenOrgs Database' AS collectedfromname,
|
||||||
|
'sysimport:crosswalk:entityregistry@@@dnet:provenance_actions' AS provenanceaction
|
||||||
|
FROM relationships
|
||||||
|
WHERE reltype = 'Child' OR reltype = 'Parent'
|
Loading…
Reference in New Issue