Revision 44949
Added by Sandro La Bruzzo over 7 years ago
modules/dnet-graph-domain/trunk/src/test/java/eu/dnetlib/pace/model/gt/AuthorTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.pace.model.gt; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertTrue; |
|
3 |
import com.google.common.collect.Sets; |
|
4 |
import org.junit.Test; |
|
4 | 5 |
|
5 | 6 |
import java.util.Set; |
6 | 7 |
|
7 |
import org.junit.Test;
|
|
8 |
import static org.junit.Assert.assertTrue;
|
|
8 | 9 |
|
9 |
import com.google.common.collect.Sets; |
|
10 |
|
|
11 |
import eu.dnetlib.pace.model.gt.Author; |
|
12 |
import eu.dnetlib.pace.model.gt.Authors; |
|
13 |
|
|
14 | 10 |
public class AuthorTest { |
15 | 11 |
|
16 | 12 |
@Test |
modules/dnet-graph-domain/trunk/src/test/java/eu/dnetlib/data/mapreduce/util/DNGFRelDecoderTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mapreduce.util; |
2 | 2 |
|
3 |
import com.google.protobuf.Descriptors.FieldDescriptor; |
|
4 | 3 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFRel; |
5 |
import eu.dnetlib.data.proto.RelTypeProtos.RelType; |
|
6 |
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType; |
|
7 |
import eu.dnetlib.data.proto.SubRelProtos.Authorship; |
|
8 | 4 |
import org.junit.Before; |
9 | 5 |
import org.junit.Test; |
10 | 6 |
|
11 |
import static org.junit.Assert.assertEquals; |
|
12 |
import static org.junit.Assert.assertNotNull; |
|
13 |
|
|
14 | 7 |
public class DNGFRelDecoderTest { |
15 | 8 |
|
16 | 9 |
private DNGFRel dngfRel; |
... | ... | |
27 | 20 |
|
28 | 21 |
@Test |
29 | 22 |
public void testGetCF() { |
30 |
assertEquals("personPublication_authorship_isAuthorOf", DNGFRelDecoder.getCFQ(RelType.personPublication, SubRelType.authorship, Authorship.RelName.isAuthorOf)); |
|
31 |
assertEquals("personPublication_authorship_isAuthorOf", DNGFRelDecoder.getCFQ(RelType.personPublication, SubRelType.authorship, "isAuthorOf")); |
|
32 |
} |
|
33 | 23 |
|
24 |
} |
|
25 |
|
|
34 | 26 |
} |
modules/dnet-graph-domain/trunk/src/test/java/eu/dnetlib/data/mapreduce/util/DNGFTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mapreduce.util; |
2 | 2 |
|
3 |
import java.io.InputStream; |
|
4 |
|
|
5 | 3 |
import com.google.protobuf.GeneratedMessage; |
6 | 4 |
import com.google.protobuf.InvalidProtocolBufferException; |
7 | 5 |
import eu.dnetlib.data.proto.DNGFProtos.DNGF; |
... | ... | |
16 | 14 |
import eu.dnetlib.data.proto.ProjectProtos.Project; |
17 | 15 |
import eu.dnetlib.data.proto.PublicationProtos.Publication; |
18 | 16 |
import eu.dnetlib.data.proto.RelMetadataProtos.RelMetadata; |
19 |
import eu.dnetlib.data.proto.RelProtos.*; |
|
20 |
import eu.dnetlib.data.proto.RelTypeProtos.RelType; |
|
21 |
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType; |
|
22 |
import eu.dnetlib.data.proto.SubRelProtos.*; |
|
23 | 17 |
import eu.dnetlib.data.proto.TypeProtos.Type; |
24 | 18 |
import org.apache.commons.logging.Log; |
25 | 19 |
import org.apache.commons.logging.LogFactory; |
26 |
import org.dom4j.Document; |
|
27 |
import org.dom4j.DocumentException; |
|
28 |
import org.dom4j.io.SAXReader; |
|
29 | 20 |
|
30 | 21 |
public class DNGFTest { |
31 | 22 |
|
32 |
private static final Log log = LogFactory.getLog(DNGFTest.class); |
|
33 |
|
|
34 |
private static String basePathProfiles = "/eu/dnetlib/test/profiles/OntologyDSResources/OntologyDSResourceType"; |
|
35 |
|
|
36 | 23 |
public static final String CITATION_JSON = |
37 | 24 |
"<citations>\n <citation>\n <rawText>[10] M. Foret et al., Phys. Rev. B 66, 024204 (2002).</rawText>\n </citation>\n <citation>\n <rawText>[11] B. Ru\175404\264e et al., Phys. Rev. Lett. 90, 095502 (2003).</rawText>\n </citation>\n <citation>\n <rawText>[12] U. Buchenau et al., Phys. Rev. B 34, 5665 (1986).</rawText>\n </citation>\n <citation>\n <rawText>[13] S.N. Taraskin and S.R. Elliott, J. Phys.: Condens. Mat- ter 11, A219 (1999).</rawText>\n </citation>\n <citation>\n <rawText>[14] B. Hehlen et al., Phys. Rev. Lett. 84, 5355 (2000).</rawText>\n </citation>\n <citation>\n <rawText>[15] N.V. Surotsev et al., J. Phys.: Condens. Matter 10, L113 (1998).</rawText>\n </citation>\n <citation>\n <rawText>[16] D.A. Parshin and C. Laermans, Phys. Rev. B 63, 132203 (2001).</rawText>\n </citation>\n <citation>\n <rawText>[17] V.L. Gurevich et al., Phys. Rev. B 67, 094203 (2003).</rawText>\n </citation>\n <citation>\n <rawText>[18] A. Matic et al., Phys. Rev. Lett. 86, 3803 (2001).</rawText>\n </citation>\n <citation>\n <rawText>[19] E. Rat et al., arXiv:cond-mat/0505558, 23 May 2005.</rawText>\n </citation>\n <citation>\n <rawText>[1] R.C. Zeller and R.O. Pohl, Phys. Rev. B 4, 2029 (1971).</rawText>\n </citation>\n <citation>\n <rawText>[20] C.A. Angell, J. Non-Cryst. Solids 131\20023133, 13 (1991).</rawText>\n </citation>\n <citation>\n <rawText>[21] A.P. Sokolov et al., Phys. Rev. Lett. 71, 2062 (1993).</rawText>\n </citation>\n <citation>\n <rawText>[22] T. Matsuo et al., Solid State Ionics 154-155, 759 (2002).</rawText>\n </citation>\n <citation>\n <rawText>[23] V.K. Malinovsky et al., Europhys. Lett. 11, 43 (1990).</rawText>\n </citation>\n <citation>\n <rawText>[24] J. Lor\250osch et al., J. Non-Cryst. Solids 69, 1 (1984).</rawText>\n </citation>\n <citation>\n <rawText>[25] U. Buchenau, Z. Phys. B 58, 181 (1985).</rawText>\n </citation>\n <citation>\n <rawText>[26] A.F. Io\175400e and A.R. Regel, Prog. Semicond. 4, 237 (1960).</rawText>\n </citation>\n <citation>\n <rawText>[27] R. Dell\20031Anna et al., Phys. Rev. Lett. 80, 1236 (1998).</rawText>\n </citation>\n <citation>\n <rawText>[28] D. Fioretto et al., Phys. Rev. E 59, 4470 (1999).</rawText>\n </citation>\n <citation>\n <rawText>[29] U. Buchenau et al., Phys. Rev. Lett. 77, 4035 (1996).</rawText>\n </citation>\n <citation>\n <rawText>[2] M. Rothenfusser et al., Phys. Rev. B 27, 5196 (1983).</rawText>\n </citation>\n <citation>\n <rawText>[30] J. Mattsson et al., J. Phys.: Condens. Matter 15, S1259 (2003).</rawText>\n </citation>\n <citation>\n <rawText>[31] T. Scopigno et al., Phys. Rev. Lett. 92, 025503 (2004).</rawText>\n </citation>\n <citation>\n <rawText>[32] M. Foret et al., Phys. Rev. Lett. 81, 2100 (1998).</rawText>\n </citation>\n <citation>\n <rawText>[33] F. Sette et al., Science 280, 1550 (1998).</rawText>\n </citation>\n <citation>\n <rawText>[34] J. Wuttke et al., Phys. Rev. E 52, 4026 (1995).</rawText>\n </citation>\n <citation>\n <rawText>[35] M.A. Ramos et al., Phys. Rev. Lett. 78, 82 (1997).</rawText>\n </citation>\n <citation>\n <rawText>[36] G. Monaco et al., Phys. Rev. Lett. 80, 2161 (1998).</rawText>\n </citation>\n <citation>\n <rawText>[37] A. T\250olle, Rep. Prog. Phys. 64, 1473 (2001).</rawText>\n </citation>\n <citation>\n <rawText>[38] As the straight lines do not cross the origin, this does not 2 imply \1623 \21035 \1651 .</rawText>\n </citation>\n <citation>\n <rawText>[39] A. Matic et al., Europhys. Lett. 54, 77 (2001).</rawText>\n </citation>\n <citation>\n <rawText>[3] S. Hunklinger and W. Arnold, in Physical Acoustics, Vol. XII, W.P. Mason and R.N. Thurston Eds. (Academic Press, N.Y. 1976), p. 155.</rawText>\n </citation>\n <citation>\n <rawText>[40] IXS data are usually not available below \1651co, mostly for experimental reasons. E.g., that the rapid onset was not evidenced in vitreous silica [27], is not indicative of its absence but rather of a low qco \21074 1 nm\210221.</rawText>\n </citation>\n <citation>\n <rawText>[41] G. Ruocco et al., Phys. Rev. Lett. 83, 5583 (1999).</rawText>\n </citation>\n <citation>\n <rawText>[42] D. C\1307 iplys et al., J. Physique (Paris) 42, C6-184 (1981).</rawText>\n </citation>\n <citation>\n <rawText>[43] R. Vacher et al., Rev. Sci. Instrum. 51, 288 (1980).</rawText>\n </citation>\n <citation>\n <rawText>[44] R. Vacher et al., arXiv:cond-mat/0505560, 23 May 2005.</rawText>\n </citation>\n <citation>\n <rawText>[45] T.N. Claytor et al., Phys. Rev. B 18, 5842 (1978).</rawText>\n </citation>\n <citation>\n <rawText>[46] M. Arai et al., Physica B 263-264, 268 (1999).</rawText>\n </citation>\n <citation>\n <rawText>[4] R. Vacher et al., J. Non-Cryst. Solids 45, 397 (1981); T.C. Zhu et al., Phys. Rev. B 44, 4281 (1991).</rawText>\n </citation>\n <citation>\n <rawText>[5] J.E. Graebner et al., Phys. Rev. B 34, 5696 (1986).</rawText>\n </citation>\n <citation>\n <rawText>[6] E. Duval and A. Mermet, Phys. Rev. B 58, 8159 (1998).</rawText>\n </citation>\n <citation>\n <rawText>[7] A. Matic et al., Phys. Rev. Lett. 93, 145502 (2004).</rawText>\n </citation>\n <citation>\n <rawText>[8] Often alluded to, e.g. in the Encyclopedia of Materials: Science and Technology, K.H.J. Buschow et al., Eds., Vol. 1 (Elsevier, Oxford, 2001), articles by S.R. Elliott on pp. 171-174 and U. Buchenau on pp. 212-215.</rawText>\n </citation>\n <citation>\n <rawText>[9] E. Rat et al., Phys. Rev. Lett. 83, 1355 (1999).</rawText>\n </citation>\n</citations>"; |
38 |
|
|
39 | 25 |
public static final String STATISTICS_JSON = |
40 | 26 |
"[{ \"citationsPerYear\": \"many\", \"anotherCoolStatistic\": \"WoW\", \"nestedStat\": { \"firstNestedStat\" : \"value 1\", \"secondNestedStat\" : \"value 2\"}, \"listingStat\" : [ \"one\", \"two\" ] }]"; |
27 |
private static final Log log = LogFactory.getLog(DNGFTest.class); |
|
28 |
private static String basePathProfiles = "/eu/dnetlib/test/profiles/OntologyDSResources/OntologyDSResourceType"; |
|
41 | 29 |
|
42 | 30 |
public static StructuredProperty.Builder getStructuredproperty(final String value, final String classname, final String schemename) { |
43 | 31 |
return getStructuredproperty(value, classname, schemename, null); |
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/openaire/hadoop/utils/HBaseTableUtils.java | ||
---|---|---|
7 | 7 |
import com.google.common.collect.Iterables; |
8 | 8 |
import com.google.common.collect.Lists; |
9 | 9 |
import com.google.common.collect.Sets; |
10 |
import eu.dnetlib.data.proto.RelTypeProtos.RelType; |
|
11 |
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType; |
|
12 |
import eu.dnetlib.data.proto.SubRelProtos.*; |
|
10 |
|
|
13 | 11 |
import eu.dnetlib.data.proto.TypeProtos.Type; |
14 | 12 |
|
15 | 13 |
/** |
... | ... | |
35 | 33 |
|
36 | 34 |
private static Set<String> listDedupRelationships() { |
37 | 35 |
final Set<String> cfs = Sets.newHashSet(); |
38 |
cfs.add(RelType.organizationOrganization + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges); |
|
39 |
cfs.add(RelType.organizationOrganization + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn); |
|
40 |
cfs.add(RelType.organizationOrganization + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
36 |
// cfs.add(RelType.organizationOrganization + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges); |
|
37 |
// cfs.add(RelType.organizationOrganization + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn); |
|
38 |
// cfs.add(RelType.organizationOrganization + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
39 |
// |
|
40 |
// cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges); |
|
41 |
// cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn); |
|
42 |
// cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
43 |
// |
|
44 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges); |
|
45 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn); |
|
46 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
47 |
// |
|
48 |
// cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
49 |
// cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.isRelatedTo + SEPARATOR + IsRelatedTo.RelName.isRelatedTo); |
|
50 |
// |
|
51 |
// cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges); |
|
52 |
// cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn); |
|
53 |
// cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
41 | 54 |
|
42 |
cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.merges); |
|
43 |
cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedup + SEPARATOR + Dedup.RelName.isMergedIn); |
|
44 |
cfs.add(RelType.personPerson + SEPARATOR + SubRelType.dedupSimilarity + SEPARATOR + DedupSimilarity.RelName.isSimilarTo); |
|
45 |
|
|
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); |
|
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 |
|
|
57 | 55 |
return cfs; |
58 | 56 |
} |
59 | 57 |
|
60 | 58 |
private static Set<String> listEntities(final Collection<String> entityType) { |
61 |
return Sets.newHashSet(Iterables.filter(Iterables.transform(Lists.newArrayList(Type.values()), typeName), s -> { |
|
62 |
return entityType.contains(s); |
|
63 |
})); |
|
64 |
} |
|
59 |
return Sets.newHashSet( |
|
60 |
Iterables.filter( |
|
61 |
Iterables.transform(Lists.newArrayList(Type.values()), typeName), |
|
62 |
s -> entityType.contains(s))); |
|
63 |
} |
|
65 | 64 |
|
66 | 65 |
public static Set<String> listEntities() { |
67 | 66 |
return Sets.newHashSet(Iterables.transform(Lists.newArrayList(Type.values()), typeName)); |
... | ... | |
69 | 68 |
|
70 | 69 |
public static Set<String> listRelationships() { |
71 | 70 |
final Set<String> cfs = Sets.newHashSet(); |
72 |
cfs.add(RelType.datasourceOrganization + SEPARATOR + SubRelType.provision + SEPARATOR + Provision.RelName.isProvidedBy); |
|
73 |
cfs.add(RelType.datasourceOrganization + SEPARATOR + SubRelType.provision + SEPARATOR + Provision.RelName.provides); |
|
71 |
// cfs.add(RelType.datasourceOrganization + SEPARATOR + SubRelType.provision + SEPARATOR + Provision.RelName.isProvidedBy); |
|
72 |
// cfs.add(RelType.datasourceOrganization + SEPARATOR + SubRelType.provision + SEPARATOR + Provision.RelName.provides); |
|
73 |
// |
|
74 |
// cfs.add(RelType.personPerson + SEPARATOR + SubRelType.coauthorship + SEPARATOR + CoAuthorship.RelName.isCoauthorOf); |
|
75 |
// |
|
76 |
// cfs.add(RelType.personPublication + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.isAuthorOf); |
|
77 |
// cfs.add(RelType.personPublication + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.hasAuthor); |
|
78 |
// |
|
79 |
// cfs.add(RelType.personDataset + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.isAuthorOf); |
|
80 |
// cfs.add(RelType.personDataset + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.hasAuthor); |
|
81 |
// |
|
82 |
// cfs.add(RelType.projectOrganization + SEPARATOR + SubRelType.participation + SEPARATOR + Participation.RelName.hasParticipant); |
|
83 |
// cfs.add(RelType.projectOrganization + SEPARATOR + SubRelType.participation + SEPARATOR + Participation.RelName.isParticipant); |
|
84 |
// |
|
85 |
// cfs.add(RelType.projectPerson + SEPARATOR + SubRelType.contactPerson + SEPARATOR + ContactPerson.RelName.isContact); |
|
86 |
// cfs.add(RelType.projectPerson + SEPARATOR + SubRelType.contactPerson + SEPARATOR + ContactPerson.RelName.hasContact); |
|
87 |
// |
|
88 |
// cfs.add(RelType.publicationProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy); |
|
89 |
// cfs.add(RelType.publicationProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces); |
|
90 |
// |
|
91 |
// cfs.add(RelType.datasetProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy); |
|
92 |
// cfs.add(RelType.datasetProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces); |
|
93 |
// |
|
94 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.hasAmongTopNSimilarDocuments); |
|
95 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.isAmongTopNSimilarDocuments); |
|
96 |
// |
|
97 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.supplement + SEPARATOR + Supplement.RelName.isSupplementedBy); |
|
98 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.supplement + SEPARATOR + Supplement.RelName.isSupplementTo); |
|
99 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.part + SEPARATOR + Part.RelName.isPartOf); |
|
100 |
// cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.part + SEPARATOR + Part.RelName.hasPart); |
|
101 |
// |
|
102 |
// cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.isRelatedTo + SEPARATOR + IsRelatedTo.RelName.isRelatedTo); |
|
103 |
// |
|
104 |
// cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.hasAmongTopNSimilarDocuments); |
|
105 |
// cfs.add(RelType.datasetDataset + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.isAmongTopNSimilarDocuments); |
|
106 |
// |
|
107 |
// cfs.add(RelType.publicationOrganization + SEPARATOR + SubRelType.affiliation + SEPARATOR + Affiliation.RelName.isAffiliatedWith); |
|
74 | 108 |
|
75 |
cfs.add(RelType.personPerson + SEPARATOR + SubRelType.coauthorship + SEPARATOR + CoAuthorship.RelName.isCoauthorOf); |
|
76 |
|
|
77 |
cfs.add(RelType.personPublication + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.isAuthorOf); |
|
78 |
cfs.add(RelType.personPublication + SEPARATOR + SubRelType.authorship + SEPARATOR + Authorship.RelName.hasAuthor); |
|
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 |
|
|
83 |
cfs.add(RelType.projectOrganization + SEPARATOR + SubRelType.participation + SEPARATOR + Participation.RelName.hasParticipant); |
|
84 |
cfs.add(RelType.projectOrganization + SEPARATOR + SubRelType.participation + SEPARATOR + Participation.RelName.isParticipant); |
|
85 |
|
|
86 |
cfs.add(RelType.projectPerson + SEPARATOR + SubRelType.contactPerson + SEPARATOR + ContactPerson.RelName.isContact); |
|
87 |
cfs.add(RelType.projectPerson + SEPARATOR + SubRelType.contactPerson + SEPARATOR + ContactPerson.RelName.hasContact); |
|
88 |
|
|
89 |
cfs.add(RelType.publicationProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy); |
|
90 |
cfs.add(RelType.publicationProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces); |
|
91 |
|
|
92 |
cfs.add(RelType.datasetProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.isProducedBy); |
|
93 |
cfs.add(RelType.datasetProject + SEPARATOR + SubRelType.outcome + SEPARATOR + Outcome.RelName.produces); |
|
94 |
|
|
95 |
cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.hasAmongTopNSimilarDocuments); |
|
96 |
cfs.add(RelType.publicationPublication + SEPARATOR + SubRelType.similarity + SEPARATOR + Similarity.RelName.isAmongTopNSimilarDocuments); |
|
97 |
|
|
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); |
|
102 |
|
|
103 |
cfs.add(RelType.publicationDataset + SEPARATOR + SubRelType.isRelatedTo + SEPARATOR + IsRelatedTo.RelName.isRelatedTo); |
|
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 |
|
|
110 | 109 |
return cfs; |
111 | 110 |
} |
112 | 111 |
|
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/data/mapreduce/util/RelDescriptor.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mapreduce.util; |
2 | 2 |
|
3 |
import eu.dnetlib.data.proto.RelTypeProtos.RelType; |
|
4 |
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType; |
|
5 | 3 |
|
6 | 4 |
public class RelDescriptor { |
7 | 5 |
|
8 |
private final String it;
|
|
6 |
private final String code;
|
|
9 | 7 |
|
10 |
private final RelType relType;
|
|
8 |
private final String ontologyCode;
|
|
11 | 9 |
|
12 |
private final SubRelType subRelType;
|
|
10 |
private final String termCode;
|
|
13 | 11 |
|
14 |
private final String relClass; |
|
15 |
|
|
16 | 12 |
public RelDescriptor(final String value) { |
17 | 13 |
super(); |
18 |
this.it = value;
|
|
14 |
this.code = value;
|
|
19 | 15 |
|
20 | 16 |
String[] s = value.split("_"); |
21 | 17 |
|
22 |
this.relType = RelType.valueOf(s[0]); |
|
23 |
this.subRelType = SubRelType.valueOf(s[1]); |
|
24 |
this.relClass = s[2]; |
|
25 |
} |
|
18 |
this.ontologyCode = s[0]; |
|
19 |
this.termCode = s[1]; |
|
20 |
} |
|
26 | 21 |
|
27 |
public SubRelType getSubRelType() { |
|
28 |
return subRelType; |
|
29 |
} |
|
30 | 22 |
|
31 |
public RelType getRelType() {
|
|
32 |
return relType;
|
|
33 |
}
|
|
23 |
public String getCode() {
|
|
24 |
return code;
|
|
25 |
}
|
|
34 | 26 |
|
35 |
public String getRelClass() {
|
|
36 |
return relClass;
|
|
37 |
}
|
|
27 |
public String getOntologyCode() {
|
|
28 |
return ontologyCode;
|
|
29 |
}
|
|
38 | 30 |
|
39 |
public String getIt() {
|
|
40 |
return it;
|
|
41 |
}
|
|
31 |
public String getTermCode() {
|
|
32 |
return termCode;
|
|
33 |
}
|
|
42 | 34 |
|
43 |
@Override |
|
35 |
|
|
36 |
@Override |
|
44 | 37 |
public String toString() { |
45 |
return getIt();
|
|
46 |
}
|
|
38 |
return getCode();
|
|
39 |
}
|
|
47 | 40 |
|
48 | 41 |
@Override |
49 | 42 |
public int hashCode() { |
50 | 43 |
final int prime = 31; |
51 | 44 |
int result = 1; |
52 |
result = (prime * result) + ((it == null) ? 0 : it.hashCode());
|
|
53 |
return result;
|
|
45 |
result = (prime * result) + ((code == null) ? 0 : code.hashCode());
|
|
46 |
return result;
|
|
54 | 47 |
} |
55 | 48 |
|
56 | 49 |
@Override |
... | ... | |
59 | 52 |
if (obj == null) return false; |
60 | 53 |
if (getClass() != obj.getClass()) return false; |
61 | 54 |
RelDescriptor other = (RelDescriptor) obj; |
62 |
if (it == null) {
|
|
63 |
if (other.it != null) return false;
|
|
64 |
} else if (!it.equals(other.it)) return false;
|
|
65 |
return true;
|
|
55 |
if (code == null) {
|
|
56 |
if (other.code != null) return false;
|
|
57 |
} else if (!code.equals(other.code)) return false;
|
|
58 |
return true;
|
|
66 | 59 |
} |
67 | 60 |
|
68 | 61 |
} |
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/data/mapreduce/util/DNGFDecoder.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mapreduce.util; |
2 | 2 |
|
3 |
import java.util.Arrays; |
|
4 |
import java.util.List; |
|
5 |
import java.util.Map.Entry; |
|
6 |
|
|
7 |
import com.google.protobuf.*; |
|
8 | 3 |
import com.google.protobuf.Descriptors.EnumValueDescriptor; |
9 | 4 |
import com.google.protobuf.Descriptors.FieldDescriptor; |
10 |
|
|
5 |
import com.google.protobuf.ExtensionRegistry; |
|
6 |
import com.google.protobuf.GeneratedMessage; |
|
11 | 7 |
import com.google.protobuf.GeneratedMessage.GeneratedExtension; |
8 |
import com.google.protobuf.InvalidProtocolBufferException; |
|
9 |
import com.google.protobuf.Message; |
|
12 | 10 |
import eu.dnetlib.data.proto.DNGFProtos.DNGF; |
13 | 11 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFEntity; |
14 | 12 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFRel; |
15 | 13 |
import eu.dnetlib.data.proto.FieldTypeProtos.Qualifier; |
16 | 14 |
import eu.dnetlib.data.proto.KindProtos.Kind; |
17 | 15 |
|
16 |
import java.util.List; |
|
17 |
import java.util.Map.Entry; |
|
18 |
|
|
18 | 19 |
/** |
19 | 20 |
* Helper class, to be used as accessor helper over the DNGF structure. |
20 | 21 |
* |
... | ... | |
116 | 117 |
return dngf.getRel(); |
117 | 118 |
} |
118 | 119 |
|
119 |
public GeneratedMessage getRel() { |
|
120 |
return decodeRel().getRel(); |
|
121 |
} |
|
122 |
|
|
123 | 120 |
public Qualifier relType() { |
124 | 121 |
return decodeRel().getRelType(); |
125 | 122 |
} |
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/OafToHbaseXsltFunctions.java | ||
---|---|---|
216 | 216 |
e.printStackTrace(); |
217 | 217 |
throw new RuntimeException(e); |
218 | 218 |
} |
219 |
|
|
220 |
|
|
221 |
public static String personPublication_Authorship( |
|
222 |
final String personIdentifier, |
|
223 |
final String datasetIdentifier, |
|
224 |
final int position, |
|
225 |
final String relation, |
|
226 |
final String provenance, |
|
227 |
final String trust, |
|
228 |
final NodeList about) { |
|
229 |
|
|
230 |
return authorship(personIdentifier, "person", |
|
231 |
datasetIdentifier, "publication", position, |
|
232 |
relation, provenance, trust, about); |
|
233 |
|
|
234 |
|
|
235 |
} |
|
219 | 236 |
} |
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/AbstractDNetXsltFunctions.java | ||
---|---|---|
73 | 73 |
final Type targetType, |
74 | 74 |
final Qualifier relType, |
75 | 75 |
final boolean isChild) { |
76 |
return DNGFRel.newBuilder().setSource(sourceId).setTarget(targetId).setRelType(relType) |
|
76 |
return DNGFRel.newBuilder().setSource(sourceId).setTarget(targetId) |
|
77 |
.setSourceType(sourceType) |
|
78 |
.setTargetType(targetType).setRelType(relType) |
|
77 | 79 |
.setChild(isChild); |
78 | 80 |
} |
79 | 81 |
|
... | ... | |
484 | 486 |
} |
485 | 487 |
|
486 | 488 |
public static String oafSimpleId(final String entityType, final String id) { |
487 |
return (Type.valueOf(entityType).getNumber() + "|" + id).replaceAll("\\s|\\n", ""); |
|
489 |
String returnValue = (Type.valueOf(entityType).getNumber() + "|" + id).replaceAll("\\s|\\n", ""); |
|
490 |
return returnValue; |
|
488 | 491 |
} |
489 | 492 |
|
490 | 493 |
public static String oafSplitId(final String entityType, final String fullId) { |
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/OdfToHbaseXsltFunctions.java | ||
---|---|---|
6 | 6 |
import com.google.common.collect.Lists; |
7 | 7 |
import com.google.common.collect.Maps; |
8 | 8 |
import eu.dnetlib.data.mapreduce.util.DNGFRowKeyDecoder; |
9 |
import eu.dnetlib.data.proto.DNGFProtos; |
|
9 | 10 |
import eu.dnetlib.data.proto.DNGFProtos.DNGF; |
10 | 11 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFEntity; |
12 |
import eu.dnetlib.data.proto.DatasetProtos; |
|
11 | 13 |
import eu.dnetlib.data.proto.DatasetProtos.Dataset; |
12 | 14 |
import eu.dnetlib.data.proto.FieldTypeProtos.Instance; |
13 | 15 |
import eu.dnetlib.data.proto.FieldTypeProtos.StructuredProperty; |
... | ... | |
79 | 81 |
} |
80 | 82 |
|
81 | 83 |
// title |
82 |
for (int i = 0; i < titles.getLength(); i++) { |
|
83 |
Node currentNode = titles.item(i); |
|
84 |
NodeList childNodes = currentNode.getChildNodes(); |
|
85 |
if (childNodes.getLength() > 0) { |
|
86 |
String titleValue = childNodes.item(0).getNodeValue(); |
|
87 |
String classname = "main title"; |
|
88 |
String classid = "main title"; |
|
89 |
if (currentNode.hasAttributes()) { |
|
90 |
NamedNodeMap attributes = currentNode.getAttributes(); |
|
91 |
Node titleType = attributes.getNamedItem("titleType"); |
|
84 |
manageTitle(titles, metadataProto); |
|
92 | 85 |
|
93 |
if (titleType != null && titleType.getNodeValue().equals("AlternativeTitle")) { |
|
94 |
classname = "alternative title"; |
|
95 |
classid = "alternative title"; |
|
96 |
} |
|
97 |
if (titleType != null && titleType.getNodeValue().equals("Subtitle")) { |
|
98 |
classname = "subtitle"; |
|
99 |
classid = "subtitle"; |
|
100 |
} |
|
101 |
if (titleType != null && titleType.getNodeValue().equals("TranslatedTitle")) { |
|
102 |
classname = "translated title"; |
|
103 |
classid = "translated title"; |
|
104 |
} |
|
105 |
} |
|
106 |
addField(metadataProto, Dataset.Metadata.getDescriptor().findFieldByName("title"), |
|
107 |
getStructuredProperty(titleValue, classname, classid, "dnet:dataCite_title", "dnet:dataCite_title")); |
|
108 |
} |
|
109 |
} |
|
110 |
|
|
111 | 86 |
// description |
112 | 87 |
for (int i = 0; i < descriptions.getLength(); i++) { |
113 | 88 |
Node currentNode = descriptions.item(i); |
... | ... | |
130 | 105 |
addField(metadataProto, Dataset.Metadata.getDescriptor().findFieldByName("publisher"), getFirstItem(publisher)); |
131 | 106 |
|
132 | 107 |
// dates |
133 |
for (int i = 0; i < dates.getLength(); i++) { |
|
134 |
Node currentNode = dates.item(i); |
|
135 |
if (currentNode != null && currentNode.hasAttributes() && currentNode.hasChildNodes()) { |
|
136 |
String dateAttribute = currentNode.getAttributes().getNamedItem("dateType").getNodeValue(); |
|
137 |
String dateValue = currentNode.getChildNodes().item(0).getNodeValue(); |
|
138 |
String protoAttribute = "relevantdate"; |
|
139 |
if ("Accepted".equals(dateAttribute)) { |
|
140 |
protoAttribute = "dateofacceptance"; |
|
141 |
} else if ("Issued".equals(dateAttribute)) { |
|
142 |
protoAttribute = "storagedate"; |
|
143 |
} else if ("Updated".equals(dateAttribute)) { |
|
144 |
protoAttribute = "lastmetadataupdate"; |
|
145 |
} else if ("Available".equals(dateAttribute)) { |
|
146 |
protoAttribute = "embargoenddate"; |
|
147 |
} |
|
148 |
if (protoAttribute.equals("relevantdate") == false) { |
|
149 |
addField(metadataProto, Dataset.Metadata.getDescriptor().findFieldByName(protoAttribute), dateValue); |
|
150 |
} else { |
|
151 |
addField(metadataProto, Dataset.Metadata.getDescriptor().findFieldByName(protoAttribute), |
|
152 |
getStructuredProperty(dateValue, "UNKNOWN", "UNKNOWN", "dnet:dataCite_date", "dnet:dataCite_date")); |
|
153 |
} |
|
154 |
} |
|
155 |
} |
|
108 |
manageDate(dates, metadataProto); |
|
156 | 109 |
|
110 |
|
|
157 | 111 |
// dateofacceptance |
158 | 112 |
addField(metadataProto, Dataset.Metadata.getDescriptor().findFieldByName("dateofacceptance"), getFirstItem(dateaccepted)); |
159 | 113 |
|
... | ... | |
226 | 180 |
return entity; |
227 | 181 |
} |
228 | 182 |
|
229 |
public static String odfDataset( |
|
183 |
|
|
184 |
public static String odfDataset( |
|
230 | 185 |
final String resultId, |
231 | 186 |
final NodeList about, |
232 | 187 |
final NodeList metadata, |
... | ... | |
283 | 238 |
return out; |
284 | 239 |
} |
285 | 240 |
|
241 |
|
|
242 |
//personDataset_Authorship($personId, $datasetId, $position, 'isAuthorOf', $provenance, $trust, $about) |
|
243 |
|
|
244 |
|
|
245 |
public static String personDataset_Authorship( |
|
246 |
final String personIdentifier, |
|
247 |
final String datasetIdentifier, |
|
248 |
final int position, |
|
249 |
final String relation, |
|
250 |
final String provenance, |
|
251 |
final String trust, |
|
252 |
final NodeList about) { |
|
253 |
|
|
254 |
return authorship(personIdentifier, "person", |
|
255 |
datasetIdentifier, "dataset", position, |
|
256 |
relation, provenance, trust, about); |
|
257 |
|
|
258 |
|
|
259 |
} |
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
286 | 264 |
} |
modules/dnet-graph-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/CommonDNetXsltFunctions.java | ||
---|---|---|
9 | 9 |
import eu.dnetlib.data.proto.DNGFProtos.DNGF; |
10 | 10 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFEntity; |
11 | 11 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFRel; |
12 |
import eu.dnetlib.data.proto.DatasetProtos; |
|
12 | 13 |
import eu.dnetlib.data.proto.FieldTypeProtos.Qualifier; |
13 | 14 |
import eu.dnetlib.data.proto.FieldTypeProtos.StructuredProperty; |
14 | 15 |
import eu.dnetlib.data.proto.PersonProtos.Person; |
15 | 16 |
import eu.dnetlib.data.proto.PersonProtos.Person.CoAuthor; |
16 | 17 |
import eu.dnetlib.data.proto.TypeProtos.Type; |
17 | 18 |
import org.apache.commons.lang3.StringUtils; |
19 |
import org.w3c.dom.NamedNodeMap; |
|
18 | 20 |
import org.w3c.dom.Node; |
19 | 21 |
import org.w3c.dom.NodeList; |
20 | 22 |
|
... | ... | |
38 | 40 |
|
39 | 41 |
final Map<String, String> params = Maps.newHashMap(); |
40 | 42 |
params.put("rank", "" + rank); |
41 |
return rel(source, Type.valueOf(sourceType), target, Type.valueOf(targetType), relClass, "", provenanceAction, trust, about, params);
|
|
42 |
}
|
|
43 |
return rel(source, sourceType, target, targetType, relClass, "", provenanceAction, trust, about, params);
|
|
44 |
}
|
|
43 | 45 |
|
44 | 46 |
public static String rel( |
45 |
final String source,
|
|
46 |
final Type sourceType,
|
|
47 |
final String target,
|
|
48 |
final Type targetType,
|
|
49 |
final String relTypeId,
|
|
50 |
final String relTypeScheme,
|
|
51 |
final String provenanceAction,
|
|
52 |
final String trust) {
|
|
47 |
final String source,
|
|
48 |
final String sourceType,
|
|
49 |
final String target,
|
|
50 |
final String targetType,
|
|
51 |
final String relTypeId,
|
|
52 |
final String relTypeScheme,
|
|
53 |
final String provenanceAction,
|
|
54 |
final String trust) {
|
|
53 | 55 |
return rel(source, sourceType, target, targetType, relTypeId, relTypeScheme, provenanceAction, trust, null, null); |
54 | 56 |
} |
55 | 57 |
|
56 | 58 |
public static String rel( |
57 |
final String source,
|
|
58 |
final Type sourceType,
|
|
59 |
final String target,
|
|
60 |
final Type targetType,
|
|
61 |
final String relTypeId,
|
|
62 |
final String relTypeScheme,
|
|
63 |
final String provenanceAction,
|
|
64 |
final String trust,
|
|
65 |
final NodeList about) {
|
|
59 |
final String source,
|
|
60 |
final String sourceType,
|
|
61 |
final String target,
|
|
62 |
final String targetType,
|
|
63 |
final String relTypeId,
|
|
64 |
final String relTypeScheme,
|
|
65 |
final String provenanceAction,
|
|
66 |
final String trust,
|
|
67 |
final NodeList about) {
|
|
66 | 68 |
return rel(source, sourceType, target, targetType, relTypeId, relTypeScheme, provenanceAction, trust, about, null); |
67 | 69 |
} |
68 | 70 |
|
69 | 71 |
// dnet:oafRel($resultId, $datasetId, 'resultResult', 'part' 'isPartOf', $about) |
70 | 72 |
public static String rel( |
71 |
final String source,
|
|
72 |
final Type sourceType,
|
|
73 |
final String target,
|
|
74 |
final Type targetType,
|
|
75 |
final String relTypeId,
|
|
76 |
final String relTypeScheme,
|
|
77 |
final String provenanceAction,
|
|
78 |
final String trust,
|
|
79 |
final NodeList about,
|
|
80 |
final Map<String, String> params) {
|
|
73 |
final String source,
|
|
74 |
final String sourceType,
|
|
75 |
final String target,
|
|
76 |
final String targetType,
|
|
77 |
final String relTypeId,
|
|
78 |
final String relTypeScheme,
|
|
79 |
final String provenanceAction,
|
|
80 |
final String trust,
|
|
81 |
final NodeList about,
|
|
82 |
final Map<String, String> params) {
|
|
81 | 83 |
try { |
82 | 84 |
final String eSource = DNGFRowKeyDecoder.decode(source).getKey(); |
83 | 85 |
final String eTarget = DNGFRowKeyDecoder.decode(target).getKey(); |
84 | 86 |
|
85 | 87 |
final Qualifier.Builder relType = getSimpleQualifier(relTypeId, relTypeScheme); |
86 |
final DNGFRel.Builder rel = getRel(eSource, sourceType, eTarget, targetType, relType.build(), false);
|
|
88 |
final DNGFRel.Builder rel = getRel(eSource, Type.valueOf(sourceType), eTarget, Type.valueOf(targetType), relType.build(), false);
|
|
87 | 89 |
|
88 | 90 |
final DNGF oaf = getOaf(rel, getDataInfo(about, provenanceAction, trust, false, false)); |
89 | 91 |
return base64(oaf.toByteArray()); |
... | ... | |
190 | 192 |
return metadata; |
191 | 193 |
} |
192 | 194 |
|
195 |
protected static void manageTitle(NodeList titles, DatasetProtos.Dataset.Metadata.Builder metadataProto) { |
|
196 |
for (int i = 0; i < titles.getLength(); i++) { |
|
197 |
Node currentNode = titles.item(i); |
|
198 |
NodeList childNodes = currentNode.getChildNodes(); |
|
199 |
if (childNodes.getLength() > 0) { |
|
200 |
String titleValue = childNodes.item(0).getNodeValue(); |
|
201 |
String classname = "main title"; |
|
202 |
String classid = "main title"; |
|
203 |
if (currentNode.hasAttributes()) { |
|
204 |
NamedNodeMap attributes = currentNode.getAttributes(); |
|
205 |
Node titleType = attributes.getNamedItem("titleType"); |
|
206 |
|
|
207 |
if (titleType != null && titleType.getNodeValue().equals("AlternativeTitle")) { |
|
208 |
classname = "alternative title"; |
|
209 |
classid = "alternative title"; |
|
210 |
} |
|
211 |
if (titleType != null && titleType.getNodeValue().equals("Subtitle")) { |
|
212 |
classname = "subtitle"; |
|
213 |
classid = "subtitle"; |
|
214 |
} |
|
215 |
if (titleType != null && titleType.getNodeValue().equals("TranslatedTitle")) { |
|
216 |
classname = "translated title"; |
|
217 |
classid = "translated title"; |
|
218 |
} |
|
219 |
} |
|
220 |
addField(metadataProto, DatasetProtos.Dataset.Metadata.getDescriptor().findFieldByName("title"), |
|
221 |
getStructuredProperty(titleValue, classname, classid, "dnet:dataCite_title", "dnet:dataCite_title")); |
|
222 |
} |
|
223 |
} |
|
224 |
} |
|
225 |
|
|
226 |
protected static void manageDate(NodeList dates, DatasetProtos.Dataset.Metadata.Builder metadataProto) { |
|
227 |
for (int i = 0; i < dates.getLength(); i++) { |
|
228 |
Node currentNode = dates.item(i); |
|
229 |
if (currentNode != null && currentNode.hasAttributes() && currentNode.hasChildNodes()) { |
|
230 |
String dateAttribute = currentNode.getAttributes().getNamedItem("dateType").getNodeValue(); |
|
231 |
String dateValue = currentNode.getChildNodes().item(0).getNodeValue(); |
|
232 |
String protoAttribute = "relevantdate"; |
|
233 |
if ("Accepted".equals(dateAttribute)) { |
|
234 |
protoAttribute = "dateofacceptance"; |
|
235 |
} else if ("Issued".equals(dateAttribute)) { |
|
236 |
protoAttribute = "storagedate"; |
|
237 |
} else if ("Updated".equals(dateAttribute)) { |
|
238 |
protoAttribute = "lastmetadataupdate"; |
|
239 |
} else if ("Available".equals(dateAttribute)) { |
|
240 |
protoAttribute = "embargoenddate"; |
|
241 |
} |
|
242 |
if (protoAttribute.equals("relevantdate") == false) { |
|
243 |
addField(metadataProto, DatasetProtos.Dataset.Metadata.getDescriptor().findFieldByName(protoAttribute), dateValue); |
|
244 |
} else { |
|
245 |
addField(metadataProto, DatasetProtos.Dataset.Metadata.getDescriptor().findFieldByName(protoAttribute), |
|
246 |
getStructuredProperty(dateValue, "UNKNOWN", "UNKNOWN", "dnet:dataCite_date", "dnet:dataCite_date")); |
|
247 |
} |
|
248 |
} |
|
249 |
} |
|
250 |
} |
|
251 |
|
|
193 | 252 |
} |
modules/dnet-graph-domain/trunk/src/main/resources/eu/dnetlib/data/proto/AuthorshipRelations.proto | ||
---|---|---|
1 |
package eu.dnetlib.data.proto; |
|
2 |
|
|
3 |
import "DngfParent.proto"; |
|
4 |
|
|
5 |
|
|
6 |
option java_package = "eu.dnetlib.data.proto"; |
|
7 |
option java_outer_classname = "AuthorshipRelations"; |
|
8 |
|
|
9 |
|
|
10 |
extend DNGFRel { |
|
11 |
required int32 position = 100; |
|
12 |
} |
|
13 |
|
|
14 |
|
modules/dnet-graph-domain/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/TransformationRuleDSResources/TransformationRuleDSResourceType/oaf2insertActions.xml | ||
---|---|---|
96 | 96 |
<xsl:if test="string-length($projectId) > 0"> |
97 | 97 |
|
98 | 98 |
<xsl:variable name="publicationProject" |
99 |
select="dnet:rel($publicationId, $projectId, 'publicationProject', 'outcome', 'isProducedBy', $provenance, $trust, $about)"/>
|
|
99 |
select="dnet:rel($publicationId,'publication', $projectId, 'project', 'outcome', 'isProducedBy', $provenance, $trust, $about)"/>
|
|
100 | 100 |
<xsl:variable name="projectPublication" |
101 |
select="dnet:rel($projectId, $publicationId, 'publicationProject', 'outcome', 'produces', $provenance, $trust, $about)"/>
|
|
101 |
select="dnet:rel($projectId, 'project', $publicationId, 'publication', 'outcome', 'produces', $provenance, $trust, $about)"/>
|
|
102 | 102 |
|
103 | 103 |
<ROW key="{$publicationId}" columnFamily="publicationProject_outcome_isProducedBy"> |
104 | 104 |
<QUALIFIER name="{$projectId}" type="base64"> |
Also available in: Unified diff
fixed test