Project

General

Profile

« Previous | Next » 

Revision 43514

created dataset dedicated entities

View differences:

HBaseTableUtils.java
4 4
import java.util.Set;
5 5

  
6 6
import com.google.common.base.Function;
7
import com.google.common.base.Predicate;
8 7
import com.google.common.collect.Iterables;
9 8
import com.google.common.collect.Lists;
10 9
import com.google.common.collect.Sets;
11
import eu.dnetlib.data.proto.DatasourceOrganizationProtos.DatasourceOrganization.Provision;
12
import eu.dnetlib.data.proto.DedupProtos.Dedup;
13
import eu.dnetlib.data.proto.DedupSimilarityProtos.DedupSimilarity;
14
import eu.dnetlib.data.proto.PersonPersonProtos.PersonPerson.CoAuthorship;
15
import eu.dnetlib.data.proto.PersonResultProtos.PersonResult.Authorship;
16
import eu.dnetlib.data.proto.ProjectOrganizationProtos.ProjectOrganization.Participation;
17
import eu.dnetlib.data.proto.ProjectPersonProtos.ProjectPerson.ContactPerson;
18 10
import eu.dnetlib.data.proto.RelTypeProtos.RelType;
19 11
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType;
20
import eu.dnetlib.data.proto.ResultOrganizationProtos.ResultOrganization.Affiliation;
21
import eu.dnetlib.data.proto.ResultProjectProtos.ResultProject.Outcome;
22
import eu.dnetlib.data.proto.ResultResultProtos.ResultResult.Part;
23
import eu.dnetlib.data.proto.ResultResultProtos.ResultResult.PublicationDataset;
24
import eu.dnetlib.data.proto.ResultResultProtos.ResultResult.Similarity;
25
import eu.dnetlib.data.proto.ResultResultProtos.ResultResult.Supplement;
12
import eu.dnetlib.data.proto.SubRelProtos.*;
26 13
import eu.dnetlib.data.proto.TypeProtos.Type;
27 14

  
28 15
/**
......
34 21

  
35 22
	private static final String SEPARATOR = "_";
36 23

  
37
	private static final Function<Type, String> typeName = new Function<Type, String>() {
24
	private static final Function<Type, String> typeName = type -> type.toString();
38 25

  
39
		@Override
40
		public String apply(final Type type) {
41
			return type.toString();
42
		}
43
	};
44

  
45 26
	public static Set<String> listAllColumns() {
46 27
		final Set<String> union = Sets.union(listEntities(), listRelationships());
47 28
		return Sets.union(union, listDedupRelationships());
......
62 43
		cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn);
63 44
		cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo);
64 45

  
65
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges);
66
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn);
67
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo);
46
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges);
47
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn);
48
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo);
68 49

  
50
		cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo);
51
		cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.isRelatedTo + SEPARATOR + IsRelatedTo.RelName.isRelatedTo);
52

  
53
		cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges);
54
		cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn);
55
		cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo);
56

  
69 57
		return cfs;
70 58
	}
71 59

  
72 60
	private static Set<String> listEntities(final Collection<String> entityType) {
73
		return Sets.newHashSet(Iterables.filter(Iterables.transform(Lists.newArrayList(Type.values()), typeName), new Predicate<String>() {
74

  
75
			@Override
76
			public boolean apply(final String s) {
77
				return entityType.contains(s);
78
			}
61
		return Sets.newHashSet(Iterables.filter(Iterables.transform(Lists.newArrayList(Type.values()), typeName), s -> {
62
			return entityType.contains(s);
79 63
		}));
80 64
	}
81 65

  
......
90 74

  
91 75
		cfs.add(RelType.personPerson + SEPARATOR + SubRelType.coauthorship + SEPARATOR + CoAuthorship.RelName.isCoauthorOf);
92 76

  
93
		cfs.add(RelType.personResult + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.isAuthorOf);
94
		cfs.add(RelType.personResult + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.hasAuthor);
77
		cfs.add(RelType.personPublication + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.isAuthorOf);
78
		cfs.add(RelType.personPublication + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.hasAuthor);
95 79

  
80
		cfs.add(RelType.personDataset + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.isAuthorOf);
81
		cfs.add(RelType.personDataset + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.hasAuthor);
82

  
96 83
		cfs.add(RelType.projectOrganization + SEPARATOR + SubRelType.participation + SEPARATOR + Participation.RelName.hasParticipant);
97 84
		cfs.add(RelType.projectOrganization + SEPARATOR + SubRelType.participation + SEPARATOR + Participation.RelName.isParticipant);
98 85

  
99 86
		cfs.add(RelType.projectPerson + SEPARATOR + SubRelType.contactPerson + SEPARATOR + ContactPerson.RelName.isContact);
100 87
		cfs.add(RelType.projectPerson + SEPARATOR + SubRelType.contactPerson + SEPARATOR + ContactPerson.RelName.hasContact);
101 88

  
102
		cfs.add(RelType.resultProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy);
103
		cfs.add(RelType.resultProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces);
89
		cfs.add(RelType.publicationProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy);
90
		cfs.add(RelType.publicationProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces);
104 91

  
105
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.hasAmongTopNSimilarDocuments);
106
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.isAmongTopNSimilarDocuments);
92
		cfs.add(RelType.datasetProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy);
93
		cfs.add(RelType.datasetProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces);
107 94

  
108
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.supplement + SEPARATOR + Supplement.RelName.isSupplementedBy);
109
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.supplement + SEPARATOR + Supplement.RelName.isSupplementTo);
110
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.part + SEPARATOR + Part.RelName.isPartOf);
111
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.part + SEPARATOR + Part.RelName.hasPart);
95
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.hasAmongTopNSimilarDocuments);
96
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.isAmongTopNSimilarDocuments);
112 97

  
113
		cfs.add(RelType.resultResult + SEPARATOR + SubRelType.publicationDataset + SEPARATOR + PublicationDataset.RelName.isRelatedTo);
98
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.supplement + SEPARATOR + Supplement.RelName.isSupplementedBy);
99
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.supplement + SEPARATOR + Supplement.RelName.isSupplementTo);
100
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.part + SEPARATOR + Part.RelName.isPartOf);
101
		cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.part + SEPARATOR + Part.RelName.hasPart);
114 102

  
115
		cfs.add(RelType.resultOrganization + SEPARATOR + SubRelType.affiliation + SEPARATOR + Affiliation.RelName.isAffiliatedWith);
103
		cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.isRelatedTo + SEPARATOR + IsRelatedTo.RelName.isRelatedTo);
116 104

  
105
		cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.hasAmongTopNSimilarDocuments);
106
		cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.isAmongTopNSimilarDocuments);
107

  
108
		cfs.add(RelType.publicationOrganization + SEPARATOR + SubRelType.affiliation + SEPARATOR + Affiliation.RelName.isAffiliatedWith);
109

  
117 110
		return cfs;
118 111
	}
119 112

  

Also available in: Unified diff