Project

General

Profile

« Previous | Next » 

Revision 62879

Added by Michele Artini 10 months ago

new branch for project id corrections

View differences:

modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/objects/DsmDatasourceInfo.java
1
package eu.dnetlib.openaire.directindex.objects;
2

  
3
import java.io.Serializable;
4

  
5
public class DsmDatasourceInfo implements Serializable {
6

  
7
	private static final long serialVersionUID = -593392381920400974L;
8

  
9
	private String id;
10
	private String officialname;
11
	private String namespaceprefix;
12

  
13
	public String getId() {
14
		return id;
15
	}
16

  
17
	public void setId(final String id) {
18
		this.id = id;
19
	}
20

  
21
	public String getOfficialname() {
22
		return officialname;
23
	}
24

  
25
	public void setOfficialname(final String officialname) {
26
		this.officialname = officialname;
27
	}
28

  
29
	public String getNamespaceprefix() {
30
		return namespaceprefix;
31
	}
32

  
33
	public void setNamespaceprefix(final String namespaceprefix) {
34
		this.namespaceprefix = namespaceprefix;
35
	}
36

  
37
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/api/RecentResultsQueue.java
1
package eu.dnetlib.openaire.directindex.api;
2

  
3
import java.io.StringReader;
4
import java.util.Iterator;
5
import java.util.List;
6

  
7
import com.mongodb.*;
8
import com.mongodb.client.model.IndexOptions;
9
import eu.dnetlib.miscutils.datetime.DateUtils;
10
import org.apache.commons.logging.Log;
11
import org.apache.commons.logging.LogFactory;
12
import org.dom4j.io.SAXReader;
13
import org.springframework.beans.factory.annotation.Required;
14

  
15
/**
16
 * Created by michele on 11/11/15.
17
 */
18
public class RecentResultsQueue implements Iterable<String> {
19

  
20
	private static final Log log = LogFactory.getLog(RecentResultsQueue.class);
21

  
22
	private DB db;
23
	private String collection;
24

  
25
	public void init() {
26
		if (!db.collectionExists(collection)) {
27
			log.info(String.format("creating collection %s", collection));
28
			db.createCollection(collection, new BasicDBObject());
29
		}
30
		db.getCollection(collection).createIndex(new BasicDBObject("id", 1), new BasicDBObject("background", true));
31
	}
32

  
33
	@Override
34
	public Iterator<String> iterator() {
35

  
36
		final DBCursor cursor = db.getCollection(collection).find();
37

  
38
		return new Iterator<String>() {
39

  
40
			@Override
41
			public boolean hasNext() {
42
				return cursor.hasNext();
43
			}
44

  
45
			@Override
46
			public String next() {
47
				final DBObject obj = cursor.next();
48
				return ((obj != null) && obj.containsField("record")) ? obj.get("record").toString() : "";
49
			}
50

  
51
			@Override
52
			public void remove() {
53
				throw new RuntimeException("NOT IMPLEMENTED");
54
			}
55
		};
56
	}
57

  
58
	synchronized public void add(final String oaf) throws Exception {
59
		final String id = (new SAXReader()).read(new StringReader(oaf)).valueOf("//*[local-name() = 'objIdentifier']");
60

  
61
		log.info("Saving record " + id + " in db: " + db.getName() + ", coll: " + collection);
62

  
63
		final DBCollection coll = db.getCollection(collection);
64
		final DBObject obj = BasicDBObjectBuilder.start()
65
				.append("id", id)
66
				.append("record", oaf)
67
				.append("date", DateUtils.now())
68
				.get();
69
		coll.update(new BasicDBObject("id", id), obj, true, false);
70
	}
71

  
72
	public void remove(final List<String> list) {
73
		final DBCollection coll = db.getCollection(collection);
74
		for (final String id : list) {
75
			coll.remove(new BasicDBObject("id", id));
76
		}
77
	}
78

  
79
	public void remove(final String... ids) {
80
		final DBCollection coll = db.getCollection(collection);
81
		for (final String id : ids) {
82
			coll.remove(new BasicDBObject("id", id));
83
		}
84
	}
85

  
86
	public DB getDb() {
87
		return db;
88
	}
89

  
90
	@Required
91
	public void setDb(final DB db) {
92
		this.db = db;
93
	}
94

  
95
	public String getCollection() {
96
		return collection;
97
	}
98

  
99
	@Required
100
	public void setCollection(final String collection) {
101
		this.collection = collection;
102
	}
103
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/objects/DsmSearchResponse.java
1
package eu.dnetlib.openaire.directindex.objects;
2

  
3
import java.io.Serializable;
4
import java.util.List;
5

  
6
public class DsmSearchResponse implements Serializable {
7

  
8
	private static final long serialVersionUID = 8944122902111813747L;
9

  
10
	private List<DsmDatasourceInfo> datasourceInfo;
11

  
12
	public List<DsmDatasourceInfo> getDatasourceInfo() {
13
		return datasourceInfo;
14
	}
15

  
16
	public void setDatasourceInfo(final List<DsmDatasourceInfo> datasourceInfo) {
17
		this.datasourceInfo = datasourceInfo;
18
	}
19
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/objects/ZenodoContextList.java
1
package eu.dnetlib.openaire.directindex.objects;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6

  
7
@JsonIgnoreProperties(ignoreUnknown = true)
8
public class ZenodoContextList {
9

  
10

  
11
        private String zenodoid;
12

  
13

  
14
        private List<String> openAirecommunitylist;
15

  
16

  
17

  
18
        public List<String> getOpenAirecommunitylist() {
19
            return openAirecommunitylist;
20
        }
21

  
22
        public void setOpenAirecommunitylist(List<String> openAirecommunitylist) {
23
            this.openAirecommunitylist = openAirecommunitylist;
24

  
25
        }
26

  
27
        public String getZenodoid() {
28
            return zenodoid;
29
        }
30

  
31
        public void setZenodoid(String zenodoid) {
32
            this.zenodoid = zenodoid;
33

  
34
        }
35

  
36

  
37

  
38
    }
39

  
40

  
41

  
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/api/ResultSubmitterService.java
1
package eu.dnetlib.openaire.directindex.api;
2

  
3
import org.apache.commons.logging.Log;
4
import org.apache.commons.logging.LogFactory;
5
import org.apache.solr.client.solrj.impl.CloudSolrClient;
6
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.beans.factory.annotation.Value;
8

  
9
import javax.annotation.Resource;
10
import java.util.concurrent.Executors;
11
import java.util.concurrent.ScheduledExecutorService;
12
import java.util.concurrent.TimeUnit;
13

  
14
public class ResultSubmitterService {
15

  
16
    private static final Log log = LogFactory.getLog(ResultSubmitterService.class);
17

  
18
    @Autowired
19
    private IndexDSRetriever indexDSRetriever;
20

  
21
    @Resource(name = "indexClientManager")
22
    private IndexClientManager clientManager;
23

  
24
    /**
25
     * Autocommit feature activation flag
26
     */
27
    @Value(value = "${openaire.api.directindex.autocommit.active}")
28
    private boolean autocommitactive;
29

  
30
    /**
31
     * Autocommit frequency (Seconds)
32
     */
33
    @Value(value = "${openaire.api.directindex.autocommit.frequency}")
34
    private long commitfrquency = 60;
35

  
36
    private ScheduledExecutorService executor;
37

  
38
    public ResultSubmitterService() {
39
        executor = Executors.newSingleThreadScheduledExecutor();
40
        updateCommitSchedule();
41
    }
42

  
43
    private void updateCommitSchedule() {
44
        log.info("updating commit schedule");
45

  
46
        executor.scheduleAtFixedRate(() -> {
47
            if (isAutocommitactive()) {
48
                try {
49
                    IndexDsInfo info = indexDSRetriever.calculateCurrentIndexDsInfo();
50
                    CloudSolrClient client = clientManager.getClient(info);
51
                    log.info("performing commit on " + info.getColl());
52
                    client.commit();
53
                } catch (Throwable e) {
54
                    log.error("unable to perform commit", e);
55
                }
56
            }
57
        }, 0, getCommitfrquency(), TimeUnit.SECONDS);
58
    }
59

  
60
    public boolean isAutocommitactive() {
61
        return autocommitactive;
62
    }
63

  
64
    public synchronized void setAutocommitactive(boolean autocommitactive) {
65
        this.autocommitactive = autocommitactive;
66
    }
67

  
68
    public long getCommitfrquency() {
69
        return commitfrquency;
70
    }
71

  
72
    public synchronized void setCommitfrquency(long commitfrquency) {
73
        this.commitfrquency = commitfrquency;
74
    }
75

  
76
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/objects/PidEntry.java
1
package eu.dnetlib.openaire.directindex.objects;
2

  
3
import io.swagger.annotations.ApiModelProperty;
4

  
5
/**
6
 * Created by michele on 02/12/15.
7
 */
8
public class PidEntry {
9

  
10
	private String type;
11
	private String value;
12

  
13
	public PidEntry() {
14
	}
15

  
16
	public PidEntry(final String type, final String value) {
17
		this.type = type;
18
		this.value = value;
19
	}
20

  
21
	@ApiModelProperty(required = true, value = "E.g. doi, pmc, urn. See http://api.openaire.eu/vocabularies/dnet:pid_types")
22
	public String getType() {
23
		return type;
24
	}
25

  
26
	public void setType(final String type) {
27
		this.type = type;
28
	}
29

  
30
	@ApiModelProperty(required = true)
31
	public String getValue() {
32
		return value;
33
	}
34

  
35
	public void setValue(final String value) {
36
		this.value = value;
37
	}
38
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/utils/OafToIndexRecordFactory.java
1
package eu.dnetlib.openaire.directindex.utils;
2

  
3
import java.io.IOException;
4
import java.io.StringReader;
5
import java.io.StringWriter;
6
import javax.annotation.Resource;
7
import javax.xml.transform.Transformer;
8
import javax.xml.transform.TransformerException;
9
import javax.xml.transform.TransformerFactory;
10
import javax.xml.transform.stream.StreamResult;
11
import javax.xml.transform.stream.StreamSource;
12

  
13
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
14
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
15
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
16
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
17
import eu.dnetlib.miscutils.functional.xml.ApplyXslt;
18
import org.apache.commons.io.IOUtils;
19
import org.springframework.beans.factory.annotation.Required;
20
import org.springframework.core.io.ClassPathResource;
21

  
22
/**
23
 * Created by michele on 15/12/15.
24
 */
25
public class OafToIndexRecordFactory {
26

  
27
	private ClassPathResource layoutToRecord;
28

  
29
	@Resource
30
	private UniqueServiceLocator serviceLocator;
31

  
32
	public ApplyXslt newTransformer(final String format) throws ISLookUpException, IOException, TransformerException {
33
		final TransformerFactory factory = TransformerFactory.newInstance();
34
		final Transformer layoutTransformer = factory.newTransformer(readLayoutToRecord());
35

  
36
		final StreamResult layoutToXsltXslt = new StreamResult(new StringWriter());
37

  
38
		layoutTransformer.setParameter("format", format);
39
		layoutTransformer.transform(new StreamSource(new StringReader(getLayoutSource(format))), layoutToXsltXslt);
40

  
41
		return new ApplyXslt(layoutToXsltXslt.getWriter().toString());
42
	}
43

  
44
	private StreamSource readLayoutToRecord() throws IOException {
45
		return new StreamSource(new StringReader(IOUtils.toString(layoutToRecord.getInputStream())));
46
	}
47

  
48
	private String getLayoutSource(final String format) throws ISLookUpDocumentNotFoundException, ISLookUpException {
49
		return serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(
50
				"collection('/db/DRIVER/MDFormatDSResources/MDFormatDSResourceType')[.//NAME='" + format + "']//LAYOUT[@name='index']");
51
	}
52

  
53
	public ClassPathResource getLayoutToRecord() {
54
		return layoutToRecord;
55
	}
56

  
57
	@Required
58
	public void setLayoutToRecord(final ClassPathResource layoutToRecord) {
59
		this.layoutToRecord = layoutToRecord;
60
	}
61

  
62
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/resources/eu/dnetlib/openaire/directindex/applicationContext-api.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:p="http://www.springframework.org/schema/p"
4
       xmlns="http://www.springframework.org/schema/beans"
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
6

  
7
	<bean id="recentResultsQueue" class="eu.dnetlib.openaire.directindex.api.RecentResultsQueue"
8
	      p:db-ref="msroApiMongoDB" p:collection="${openaire.api.directindex.mongo.collection}"
9
	      init-method="init"/>
10

  
11

  
12
	<bean id="apiMongoServer" class="com.mongodb.Mongo">
13
		<constructor-arg index="0" type="com.mongodb.ServerAddress">
14
			<bean class="com.mongodb.ServerAddress">
15
				<constructor-arg index="0"
16
				                 value="${openaire.api.directindex.mongo.host}"/>
17
				<constructor-arg index="1"
18
				                 value="${openaire.api.directindex.mongo.port}"/>
19
			</bean>
20
		</constructor-arg>
21
	</bean>
22

  
23
	<bean id="apiOafToIndexRecordFactory" class="eu.dnetlib.openaire.directindex.utils.OafToIndexRecordFactory"
24
	      p:layoutToRecord="${openaire.api.directindex.layoutToRecord.xslt}"/>
25

  
26

  
27
	<bean id="msroApiMongoDB" factory-bean="apiMongoServer"
28
	      factory-method="getDB">
29
		<constructor-arg index="0" value="${openaire.api.directindex.mongo.db}"/>
30
	</bean>
31

  
32
	<bean id="openaireplusApisVelocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
33
		<property name="velocityProperties">
34
			<value>
35
				resource.loader=class
36
				class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
37
				runtime.log.logsystem.class=org.apache.velocity.runtime.log.Log4JLogChute
38
			</value>
39
		</property>
40
	</bean>
41

  
42
	<bean id="indexClientManager" class="eu.dnetlib.openaire.directindex.api.IndexClientManager" />
43

  
44
	<bean id="resultSubmitterService" class="eu.dnetlib.openaire.directindex.api.ResultSubmitterService" />
45

  
46
	<bean id="indexDSRetriever" class="eu.dnetlib.openaire.directindex.api.IndexDSRetriever" />
47

  
48
	<bean id="directIndexCacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
49
	      p:cacheManager-ref="directIndexCache" />
50

  
51
	<bean id="directIndexCache"
52
	      class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
53
	      p:cacheManagerName="directIndexCache"
54
	      p:configLocation="classpath:/eu/dnetlib/openaire/directindex/api/ehcache.xml" />
55

  
56
</beans>
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/api/OpenAIRESubmitterUtils.java
1
package eu.dnetlib.openaire.directindex.api;
2

  
3
import java.io.StringWriter;
4
import java.util.ArrayList;
5
import java.util.Collection;
6
import java.util.HashMap;
7
import java.util.HashSet;
8
import java.util.List;
9
import java.util.Map;
10
import java.util.stream.Collectors;
11

  
12
import org.apache.commons.lang.StringUtils;
13
import org.springframework.web.client.RestClientException;
14
import org.springframework.web.client.RestTemplate;
15

  
16
import com.google.common.collect.Sets;
17

  
18
import eu.dnetlib.miscutils.functional.hash.Hashing;
19
import eu.dnetlib.openaire.directindex.objects.DatasourceEntry;
20
import eu.dnetlib.openaire.directindex.objects.DsmSearchRequest;
21
import eu.dnetlib.openaire.directindex.objects.DsmSearchResponse;
22
import eu.dnetlib.openaire.directindex.objects.ZenodoContextList;
23

  
24
/**
25
 * Created by michele on 15/01/16.
26
 */
27
public class OpenAIRESubmitterUtils {
28

  
29
	private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(OpenAIRESubmitterUtils.class);
30
	private static final String ZENODO_COMMUNITY = "zenodo.org/communities/";
31
	private final String community_api;
32
	private final String dsm_api;
33

  
34
	public OpenAIRESubmitterUtils(final String community_api, final String dsm_api) {
35
		this.community_api = community_api;
36
		this.dsm_api = dsm_api;
37
	}
38

  
39
	public DatasourceEntry findDatasource(final String dsId) {
40
		final RestTemplate rt = new RestTemplate();
41
		final String url = dsm_api + "/searchdetails/0/1?requestSortBy=id&order=ASCENDING";
42
		try {
43
			final DsmSearchResponse res = rt.postForObject(url, new DsmSearchRequest(dsId), DsmSearchResponse.class);
44
			return res.getDatasourceInfo()
45
				.stream()
46
				.map(ds -> new DatasourceEntry(ds.getId(), ds.getOfficialname(), ds.getNamespaceprefix()))
47
				.findFirst()
48
				.orElse(null);
49
		} catch (final RestClientException rce) {
50
			log.error("Unable to get object for " + url);
51
			return null;
52
		}
53
	}
54

  
55
	public Map<String, String> calculateProjectInfo(final String link) {
56
		final Map<String, String> info = new HashMap<>();
57
		final String[] arr = link.split("/");
58
		// info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble
59

  
60
		if (arr.length > 4) {
61
			final String acronym = arr.length > 7 ? arr[7] : "";
62
			final String title = arr.length > 6 ? StringUtils.isNotBlank(arr[6]) ? arr[6] : acronym : "";
63
			final String jurisdiction = arr.length > 5 ? arr[5] : "";
64
			final String funderId = calculateFunderId(arr[2], arr[3]);
65
			final String funderShortName = fixFunderShortName(arr[2]);
66
			final String fundingName = fixFundingName(funderShortName, arr[3]);
67
			info.put("id", calculateProjectId(arr[2], arr[3], arr[4]));
68
			info.put("funderShortName", fixFunderShortName(arr[2]));
69
			info.put("fundingName", fundingName);
70
			info.put("code", unescape(arr[4]));
71
			info.put("jurisdiction", jurisdiction);
72
			info.put("title", title);
73
			info.put("acronym", acronym);
74
			info.put("funderId", funderId);
75
			info.put("funderName", calculateFunderName(arr[2]));
76
			if (StringUtils.isNotBlank(arr[3])) {
77
				info.put("fundingId", funderId + "::" + fundingName);
78
			}
79
		}
80
		return info;
81
	}
82

  
83
	// TODO: remove me when Zenodo ingests the good UKRI projects
84
	protected String fixFunderShortName(final String funderShortName) {
85
		switch (funderShortName) {
86
		case "RCUK":
87
			return "UKRI";
88
		default:
89
			return funderShortName;
90
		}
91
	}
92

  
93
	protected String calculateFunderPrefix(final String funderShortName, final String funding) {
94
		switch (funderShortName.toLowerCase()) {
95
		case "chist-era":
96
			return "chistera____::";
97
		case "conicyt":
98
			return "conicytf____::";
99
		case "dfg":
100
			return "dfgf________::";
101
		case "ec":
102
			switch (funding.toLowerCase()) {
103
			case "fp7":
104
				return "corda_______::";
105
			case "h2020":
106
				return "corda__h2020::";
107
			default:
108
				return "corda_____he::";
109
			}
110
		case "eea":
111
			return "euenvagency_::";
112
		case "hrzz":
113
		case "mzos":
114
			return "irb_hr______::";
115
		case "tara":
116
			return "taraexp_____::";
117
		case "tubitak":
118
			return "tubitakf____::";
119
		case "rcuk":
120
			return "ukri________::";
121
		default:
122
			String prefix = funderShortName.toLowerCase();
123
			// ensure we have 12 chars
124
			while (prefix.length() < 12) {
125
				prefix += "_";
126
			}
127
			return prefix + "::";
128
		}
129
	}
130

  
131
	protected String calculateProjectId(final String funderShortName, final String funding, final String code) {
132
		final String suffix = Hashing.md5(unescape(code));
133
		final String funderPrefix = calculateFunderPrefix(funderShortName, funding);
134
		return funderPrefix + suffix;
135
	}
136

  
137
	private String unescape(final String code) {
138
		return code.replace("%2F", "/");
139
	}
140

  
141
	protected String calculateFunderId(final String funderShortName, final String funding) {
142
		switch (funderShortName.toLowerCase()) {
143
		case "ec":
144
			return "ec__________::EC";
145
		default:
146
			final String fixedFunderShortName = fixFunderShortName(funderShortName);
147
			final String prefix = calculateFunderPrefix(fixedFunderShortName, funding);
148
			return prefix + fixedFunderShortName.toUpperCase();
149
		}
150
	}
151

  
152
	protected String calculateFunderName(final String funderShortName) {
153

  
154
		switch (funderShortName.toLowerCase()) {
155
		case "aff":
156
		case "aka":
157
			return "Academy of Finland";
158
		case "anr":
159
			return "French National Research Agency (ANR)";
160
		case "arc":
161
			return "Australian Research Council (ARC)";
162
		case "asap":
163
			return "Aligning Science Across Parkinson's";
164
		case "chist-era":
165
			return "CHIST-ERA";
166
		case "cihr":
167
			return "Canadian Institutes of Health Research";
168
		case "conicyt":
169
			return "Comisión Nacional de Investigación Científica y Tecnológica";
170
		case "dfg":
171
			return "Deutsche Forschungsgemeinschaft";
172
		case "ec":
173
			return "European Commission";
174
		case "eea":
175
			return "European Environment Agency";
176
		case "fct":
177
			return "Fundação para a Ciência e a Tecnologia, I.P.";
178
		case "fwf":
179
			return "Austrian Science Fund (FWF)";
180
		case "gsrt":
181
			return "General Secretariat of Research and Technology (GSRT)";
182
		case "hrzz":
183
			return "Croatian Science Foundation (CSF)";
184
		case "innoviris":
185
			return "INNOVIRIS";
186
		case "mestd":
187
			return "Ministry of Education, Science and Technological Development of Republic of Serbia";
188
		case "miur":
189
			return "Ministero dell'Istruzione dell'Università e della Ricerca";
190
		case "mzos":
191
			return "Ministry of Science, Education and Sports of the Republic of Croatia (MSES)";
192
		case "nhmrc":
193
			return "National Health and Medical Research Council (NHMRC)";
194
		case "nih":
195
			return "National Institutes of Health";
196
		case "nsf":
197
			return "National Science Foundation";
198
		case "nserc":
199
			return "Natural Sciences and Engineering Research Council of Canada";
200
		case "nwo":
201
			return "Netherlands Organisation for Scientific Research (NWO)";
202
		case "rcuk":
203
		case "ukri":
204
			return "UK Research and Innovation";
205
		case "rif":
206
		case "rpf":
207
			return "Research and Innovation Foundation";
208
		case "rsf":
209
			return "Russian Science Foundation";
210
		case "sfi":
211
			return "Science Foundation Ireland";
212
		case "sgov":
213
			return "Gobierno de España";
214
		case "snsf":
215
			return "Swiss National Science Foundation";
216
		case "sshrc":
217
			return "Social Sciences and Humanities Research Council";
218
		case "tara":
219
			return "Tara Expeditions Foundation";
220
		case "tubitak":
221
			return "Türkiye Bilimsel ve Teknolojik Araştırma Kurumu";
222
		case "wt":
223
			return "Wellcome Trust";
224
		default:
225
			log.error("Funder short name '" + funderShortName + "' not managed");
226
			return "";
227
		}
228
	}
229

  
230
	protected String fixFundingName(final String funderShortName, final String fundingName) {
231
		switch (funderShortName) {
232
		case "EC":
233
			if (fundingName.toLowerCase().startsWith("horizon 2020")) { return "H2020"; }
234
			if (fundingName.toLowerCase().startsWith("horizon europe")) { return "HE"; }
235
		default:
236
			return fundingName;
237
		}
238
	}
239

  
240
	public Collection<String> translateZenodoCommunity(final String community) {
241
		if (community.contains(ZENODO_COMMUNITY)) {
242
			final String context = community.substring(community.lastIndexOf("/") + 1);
243
			final RestTemplate rt = new RestTemplate();
244
			try {
245
				return new HashSet<>(rt.getForObject(community_api + context + "/openairecommunities", ZenodoContextList.class)
246
					.getOpenAirecommunitylist());
247
			} catch (final RestClientException rce) {
248
				log.error("Unable to get object for " + community_api + context + "/openairecommunities");
249
				log.error(rce.getMessage());
250
				return new HashSet<>();
251
			}
252
		} else {
253
			return Sets.newHashSet(community);
254
		}
255
	}
256

  
257
	private ContextInfo createContextInfo(final String[] arr, final int pos, final Map<String, String> labelMap) {
258
		final StringWriter id = new StringWriter();
259
		id.write(arr[0]);
260
		for (int i = 0; i < pos; i++) {
261
			id.write("::");
262
			id.write(arr[i + 1]);
263
		}
264
		final String label = labelMap.get(id.toString());
265
		final String elem = pos == 0 ? "context" : pos == 1 ? "category" : "concept";
266
		final ContextInfo info = new ContextInfo(elem, id.toString(), label);
267
		if (pos + 1 < arr.length) {
268
			info.getChildren().add(createContextInfo(arr, pos + 1, labelMap));
269
		}
270
		return info;
271
	}
272

  
273
	public List<ContextInfo> processContexts(final List<String> zenodoCommunities, final Map<String, String> labelMap) {
274
		return zenodoCommunities.stream()
275
			.map(c -> translateZenodoCommunity(c))
276
			.flatMap(coll -> coll.stream())
277
			.map(ctx -> createContextInfo(ctx.split("::"), 0, labelMap))
278
			.filter(info -> StringUtils.isNotBlank(info.getLabel()))
279
			.collect(Collectors.toList());
280
	}
281

  
282
	public class ContextInfo {
283

  
284
		private String elem;
285
		private String id;
286
		private String label;
287
		private List<ContextInfo> children = new ArrayList<>();
288

  
289
		public ContextInfo(final String elem,
290
			final String id, final String label) {
291
			this.elem = elem;
292
			this.id = id;
293
			this.label = label;
294
		}
295

  
296
		public String getElem() {
297
			return elem;
298
		}
299

  
300
		public void setElem(final String elem) {
301
			this.elem = elem;
302
		}
303

  
304
		public String getId() {
305
			return id;
306
		}
307

  
308
		public void setId(final String id) {
309
			this.id = id;
310
		}
311

  
312
		public List<ContextInfo> getChildren() {
313
			return children;
314
		}
315

  
316
		public void setChildren(final List<ContextInfo> children) {
317
			this.children = children;
318
		}
319

  
320
		public boolean isRoot() {
321
			return elem.equals("context");
322
		}
323

  
324
		public String getLabel() {
325
			return label;
326
		}
327

  
328
		public void setLabel(final String label) {
329
			this.label = label;
330
		}
331
	}
332

  
333
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/resources/eu/dnetlib/openaire/directindex/findIndexDsInfo.xquery
1
distinct-values(for $s in collection('/db/DRIVER/ServiceResources/SearchServiceResourceType')//SERVICE_PROPERTIES[./PROPERTY[@key = 'infrastructure' and @value = 'public'] ]
2
let $format := $s/PROPERTY[@key = "mdformat"]/@value/string()
3
return(
4
for $x in collection('/db/DRIVER/IndexDSResources/IndexDSResourceType')
5
where
6
    $x//METADATA_FORMAT =$format and
7
            $x//METADATA_FORMAT_INTERPRETATION = 'openaire' and
8
            $x//METADATA_FORMAT_LAYOUT = 'index'
9
return
10
    concat($x//RESOURCE_IDENTIFIER/@value/string(), ' @@@ ', $format , ' @@@ ', $format , '-index-openaire')
11
))
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/api/IndexDSRetriever.java
1
package eu.dnetlib.openaire.directindex.api;
2

  
3
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
4
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
5
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
6
import org.apache.commons.io.IOUtils;
7
import org.apache.commons.logging.Log;
8
import org.apache.commons.logging.LogFactory;
9
import org.springframework.beans.factory.annotation.Value;
10
import org.springframework.cache.annotation.CacheEvict;
11
import org.springframework.cache.annotation.Cacheable;
12
import org.springframework.core.io.ClassPathResource;
13

  
14
import javax.annotation.Resource;
15
import java.io.IOException;
16

  
17
public class IndexDSRetriever {
18

  
19
	private static final Log log = LogFactory.getLog(IndexDSRetriever.class);
20
	@Value(value = "${openaire.api.directindex.findSolrIndexUrl.xquery}")
21
	private ClassPathResource findSolrIndexUrl;
22

  
23
	@Value(value = "${openaire.api.directindex.findIndexDsInfo.xquery}")
24
	private ClassPathResource findIndexDsInfo;
25

  
26
	@Resource
27
	private UniqueServiceLocator serviceLocator;
28

  
29
	@Cacheable("indexDsInfo")
30
	public IndexDsInfo calculateCurrentIndexDsInfo() throws IOException, ISLookUpException {
31

  
32
		log.info("Not using cache");
33

  
34
		final String queryUrl = IOUtils.toString(findSolrIndexUrl.getInputStream());
35
		final String queryDs = IOUtils.toString(findIndexDsInfo.getInputStream());
36

  
37
		final ISLookUpService lu = serviceLocator.getService(ISLookUpService.class);
38
		final String indexBaseUrl = lu.getResourceProfileByQuery(queryUrl);
39

  
40
		final String idxDs = lu.getResourceProfileByQuery(queryDs);
41

  
42
		if (idxDs.isEmpty()) {
43
			throw new IllegalStateException(queryDs + "\n\nreturned no results, check IS profiles");
44
		}
45

  
46
		final String[] arr = idxDs.split("@@@");
47
		return new IndexDsInfo(indexBaseUrl, arr[0].trim(), arr[1].trim(), arr[2].trim());
48
	}
49

  
50
	@CacheEvict(value="indexDsInfo", allEntries = true)
51
	public void evictCache(){
52
		log.info("Evicting indexDsInfo cache");
53
	}
54
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/java/eu/dnetlib/openaire/directindex/api/DirecIndexApiException.java
1
package eu.dnetlib.openaire.directindex.api;
2

  
3
import eu.dnetlib.common.rmi.RMIException;
4

  
5
public class DirecIndexApiException extends RMIException {
6

  
7
	/**
8
	 *
9
	 */
10
	private static final long serialVersionUID = -3888037031334809448L;
11

  
12
	public DirecIndexApiException(final String string) {
13
		super(string);
14
	}
15

  
16
	public DirecIndexApiException(final String string, final Throwable exception) {
17
		super(string, exception);
18
	}
19

  
20
	public DirecIndexApiException(final Throwable exception) {
21
		super(exception);
22
	}
23

  
24
}
modules/dnet-directindex-api/branches/correct_proj_ids/pom.xml
1
<?xml version="1.0" ?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
	<parent>
4
		<groupId>eu.dnetlib</groupId>
5
		<artifactId>dnet45-parent</artifactId>
6
		<version>1.0.0</version>
7
		<relativePath />
8
	</parent>
9
	<modelVersion>4.0.0</modelVersion>
10
	<groupId>eu.dnetlib</groupId>
11
	<artifactId>dnet-directindex-api</artifactId>
12
	<packaging>jar</packaging>
13
	<version>4.0.2-SNAPSHOT</version>
14

  
15
	<scm>
16
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-directindex-api/trunk</developerConnection>
17
	</scm>
18
	<dependencies>
19
		<dependency>
20
			<groupId>eu.dnetlib</groupId>
21
			<artifactId>dnet-openaireplus-mapping-utils</artifactId>
22
			<version>[7.0.0,8.0.0)</version>
23
			<exclusions>
24
				<exclusion>
25
					<groupId>eu.dnetlib</groupId>
26
					<artifactId>dnet-hadoop-commons</artifactId>
27
				</exclusion>
28
			</exclusions>
29
		</dependency>
30
		<dependency>
31
			<groupId>eu.dnetlib</groupId>
32
			<artifactId>dnet-index-client</artifactId>
33
			<version>[3.0.0,4.0.0)</version>
34
		</dependency>
35
		<dependency>
36
			<groupId>junit</groupId>
37
			<artifactId>junit</artifactId>
38
			<version>${junit.version}</version>
39
			<scope>test</scope>
40
		</dependency>
41
		<dependency>
42
			<groupId>io.springfox</groupId>
43
			<artifactId>springfox-swagger2</artifactId>
44
			<version>${springfox-version}</version>
45
		</dependency>
46
		<dependency>
47
			<groupId>org.mockito</groupId>
48
			<artifactId>mockito-core</artifactId>
49
			<version>1.9.5</version>
50
		</dependency>
51
		<dependency>
52
			<groupId>org.apache.velocity</groupId>
53
			<artifactId>velocity</artifactId>
54
			<version>1.7</version>
55
			<exclusions>
56
				<exclusion>
57
					<artifactId>antlr</artifactId>
58
					<groupId>antlr</groupId>
59
				</exclusion>
60
			</exclusions>
61
		</dependency>
62
		<dependency>
63
			<groupId>org.apache.velocity</groupId>
64
			<artifactId>velocity-tools</artifactId>
65
			<version>2.0</version>
66
			<exclusions>
67
				<exclusion>
68
					<artifactId>antlr</artifactId>
69
					<groupId>antlr</groupId>
70
				</exclusion>
71
			</exclusions>
72
		</dependency>
73
		<dependency>
74
			<groupId>org.springframework</groupId>
75
			<artifactId>spring-context-support</artifactId>
76
			<version>${spring.version}</version>
77
		</dependency>
78
		<dependency>
79
			<groupId>com.fasterxml.jackson.core</groupId>
80
			<artifactId>jackson-annotations</artifactId>
81
			<version>2.9.4</version>
82
		</dependency>
83
    </dependencies>
84

  
85
	<properties>
86
		<springfox-version>2.5.0</springfox-version>
87
	</properties>
88
</project>
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/resources/eu/dnetlib/openaire/directindex/indexRecord.xml.vm
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3

  
4
#macro(context $ctx)
5
        <$!ctx.elem id="$!esc.evaluate($!ctx.id)" label="$!esc.evaluate($!ctx.label)" #if($!ctx.isRoot()) type="community"#end>
6
	#foreach($child in $!ctx.children)#context($child)#end
7
        </$!ctx.elem>
8
#end
9

  
10
<record xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaf="http://namespace.openaire.eu/oaf">
11
	<result>
12
		<header>
13
			<dri:objIdentifier>$!esc.evaluate($!objIdentifier)</dri:objIdentifier>
14
			<dri:dateOfCollection>$!esc.evaluate($!dateOfCollection)</dri:dateOfCollection>
15
			<dri:status>under curation</dri:status>
16
			<counters/>
17
		</header>
18
		<metadata>
19
			<oaf:entity schemaLocation="http://namespace.openaire.eu/oaf $!oafSchemaLocation">
20
				<oaf:result>
21
					<title classid="main title" classname="main title" schemeid="dnet:dataCite_title" schemename="dnet:dataCite_title">
22
						$!esc.evaluate($!pub.title)
23
					</title>
24
					#foreach($author in $!pub.authors)
25
                    	<creator rank="$velocityCount" name="" surname="">$!esc.evaluate($!author)</creator>
26
                    #end
27
					<dateofacceptance/>
28
					<resulttype classid="$!esc.evaluate($!pub.type)" classname="$!esc.evaluate($!resultTypes.get($!pub.type))" schemeid="dnet:result_typologies" schemename="dnet:result_typologies"/>
29
					<language classid="$!esc.evaluate($!pub.language)" classname="$!esc.evaluate($!languages.get($!pub.language))" schemeid="dnet:languages"
30
					          schemename="dnet:languages"/>
31
					<description>
32
						$!esc.evaluate($!pub.description)
33
					</description>
34
					<country classid="" classname="" schemeid="" schemename=""/>
35
					<subject classid="" classname="" schemeid="" schemename=""/>
36
					<relevantdate classid="" classname="" schemeid="" schemename=""/>
37
					<publisher>$!esc.evaluate($!pub.publisher)</publisher>
38
					<embargoenddate>$!esc.evaluate($!pub.embargoEndDate)</embargoenddate>
39
					<journal issn="" eissn="" lissn="" ep="" iss="" sp="" vol=""/>
40
					<source/>
41
					<fulltext/>
42
					<format/>
43
					<storagedate/>
44
					<resourcetype classid="" classname="" schemeid="" schemename=""/>
45
					<device/>
46
					<size/>
47
					<version/>
48
					<lastmetadataupdate/>
49
					<metadataversionnumber/>
50
					<documentationUrl/>
51
					<codeRepositoryUrl/>
52
					<programmingLanguage classid="" classname="" schemeid="" schemename="" />
53
					<contactperson />
54
					<contactgroup />
55
					<tool />
56
					<originalId>$!esc.evaluate($!pub.originalId)</originalId>
57
					<collectedfrom name="$!esc.evaluate($!collectedFrom.name)" id="$!esc.evaluate($!collectedFrom.calculateOpenaireId())"/>
58

  
59
					#foreach($pid in $!pub.pids)
60
						<pid classid="$!esc.evaluate($!pid.type)" classname="$!esc.evaluate($!pidTypes.get($!pid.type))" schemeid="dnet:pid_types"
61
						     schemename="dnet:pid_types">$!esc.evaluate($pid.value)</pid>
62
					#end
63
					#if($!pub.accessRightCode)
64
						<bestaccessright classid="$!esc.evaluate($!pub.accessRightCode)" classname="$!esc.evaluate($!rights.get($!pub.accessRightCode))"
65
						                 schemeid="dnet:access_modes" schemename="dnet:access_modes"/>
66
					#elseif($!pub.licenseCode)
67
							<bestaccessright classid="$!esc.evaluate($!pub.licenseCode)" classname="$!esc.evaluate($!rights.get($!pub.licenseCode))"
68
							                 schemeid="dnet:access_modes" schemename="dnet:access_modes"/>
69
					#else
70
						<bestaccessright classid="UNKNOWN" classname="not available" schemeid="dnet:access_modes" schemename="dnet:access_modes" />
71
					#end
72

  
73
					#foreach($ctx in $contextInfo)
74
                        #context($ctx)
75
                    #end
76

  
77
					<datainfo>
78
						<inferred>false</inferred>
79
						<deletedbyinference>false</deletedbyinference>
80
						<trust>0.9</trust>
81
						<inferenceprovenance/>
82
						<provenanceaction classid="user:insert" classname="user:insert" schemeid="dnet:provenanceActions" schemename="dnet:provenanceActions"/>
83
					</datainfo>
84

  
85
					<rels>
86
						#foreach($link in $!pub.linksToProjects)
87

  
88
							#set( $info = $!util.calculateProjectInfo($!link) )
89
							<rel inferred="false" trust="0.9" inferenceprovenance="" provenanceaction="user:claim">
90
								<to class="isProducedBy" scheme="dnet:result_project_relations" type="project">$!esc.evaluate($!info.id)</to>
91
								<code>$!esc.evaluate($!info.code)</code>
92
								<acronym>$!esc.evaluate($!info.acronym)</acronym>
93
								<title>$!esc.evaluate($!info.title)</title>
94
								<contracttype classid="" classname="" schemeid="" schemename=""/>
95

  
96
								<funding>
97
									<funder id="$!esc.evaluate($!info.funderId)"
98
									        shortname="$!esc.evaluate($!info.funderShortName)"
99
									        name="$!esc.evaluate($!info.funderName)"
100
									        jurisdiction="$!esc.evaluate($!info.jurisdiction)"/>
101
									#if($!info.fundingId)
102
									<funding_level_0 name="$!esc.evaluate($!info.fundingName)">$!esc.evaluate($!info.fundingId)</funding_level_0>
103
									#end
104
								</funding>
105
								<websiteurl/>
106
							</rel>
107
						#end
108
					</rels>
109
					<children>
110
						<instance id="$!esc.evaluate($!objIdentifier)">
111
							<instancetype classid="$!esc.evaluate($!pub.resourceType)" classname="$!esc.evaluate($resourceTypes.get($!pub.resourceType))"
112
							              schemeid="dnet:publication_resource" schemename="dnet:publication_resource"/>
113
							<collectedfrom name="$!esc.evaluate($!collectedFrom.name)" id="$!esc.evaluate($!collectedFrom.calculateOpenaireId())"/>
114
							<hostedby name="$!esc.evaluate($!hostedBy.name)" id="$!esc.evaluate($!hostedBy.calculateOpenaireId())"/>
115
							#if($!pub.accessRightCode)
116
								<accessright classid="$!esc.evaluate($!pub.accessRightCode)" classname="$!esc.evaluate($!rights.get($!pub.accessRightCode))"
117
								                 schemeid="dnet:access_modes" schemename="dnet:access_modes"/>
118
							#elseif($!pub.licenseCode)
119
								<accessright classid="$!esc.evaluate($!pub.licenseCode)" classname="$!esc.evaluate($!rights.get($!pub.licenseCode))"
120
								                 schemeid="dnet:access_modes" schemename="dnet:access_modes"/>
121
							#else
122
								<accessright classid="UNKNOWN" classname="not available" schemeid="dnet:access_modes" schemename="dnet:access_modes" />
123
							#end
124
							<dateofacceptance/>
125
							<webresource>
126
								<url>$!esc.evaluate($!pub.url)</url>
127
							</webresource>
128
						</instance>
129
					</children>
130
				</oaf:result>
131
			</oaf:entity>
132
		</metadata>
133
	</result>
134
</record>
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo_doi.json
1
{
2
  "originalId": "oai:zenodo.org:8282705",
3
  "title": "স্বাধীনতার পঁচাত্তর",
4
  "authors": [
5
    "মহম্মদ সেলিম"
6
  ],
7
  "publisher": "Zenodo",
8
  "description": "\u003cp\u003e\u0026nbsp;স্বাধীনতার পঁচাত্তর\u003c/p\u003e",
9
  "language": "ben",
10
  "pids": [
11
    {
12
      "type": "oai",
13
      "value": "oai:zenodo.org:8282705"
14
    },
15
    {
16
      "type": "doi",
17
      "value": "10.5281/zenodo.8282705"
18
    }
19
  ],
20
  "licenseCode": "OPEN",
21
  "type": "publication",
22
  "resourceType": "0001",
23
  "url": "https://zenodo.org/record/8282705",
24
  "collectedFromId": "opendoar____::2659",
25
  "hostedById": "opendoar____::2659",
26
  "contexts": [],
27
  "linksToProjects": []
28
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/main/resources/eu/dnetlib/openaire/directindex/findSolrIndexUrl.xquery
1
distinct-values(collection("/db/DRIVER/ServiceResources/IndexServiceResourceType")//PROTOCOL[@name = "solr" or @name = "SOLR"]/@address/string())
modules/dnet-directindex-api/branches/correct_proj_ids/deploy.info
1
{"type_source": "SVN", "goal": "package -U source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-directindex-api/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-directindex-api"}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo_dmp_intelcomp.json
1
{
2
  "linksToProjects": [
3
    "info:eu-repo/grantAgreement/EC/H2020/101004870//A Competitive Intelligence Cloud%2FHPC Platform for AI-based STI Policy Making/IntelComp"
4
  ],
5
  "description": "<p>IntelComp sets out to build an innovative Cloud Platform that...",
6
  "publisher": "Zenodo",
7
  "collectedFromId": "opendoar____::2659",
8
  "hostedById": "opendoar____::2659",
9
  "originalId": "oai:zenodo.org:5109933",
10
  "resourceType": "0045",
11
  "version": "1",
12
  "licenseCode": "OPEN",
13
  "authors": [
14
    "Elli Papadopoulou"
15
  ],
16
  "url": "https://zenodo.org/record/5109933",
17
  "title": "Data Management Plan for IntelComp. D8.2.",
18
  "pids": [
19
    {
20
      "type": "oai",
21
      "value": "oai:zenodo.org:5109933"
22
    },
23
    {
24
      "type": "doi",
25
      "value": "10.5281/zenodo.5109933"
26
    }
27
  ],
28
  "type": "publication"
29
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_software.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951",
3
  "originalId": "oai:rudar.ruc.dk:1800/24691",
4
  "type": "software",
5
  "title": "Software test",
6
  "authors": [
7
	"Sloan, Patrick Alexander Raaby",
8
	"Strange, Gustav Valdemar"
9
  ],
10
  "publisher": "",
11
  "description": "This is for testing software",
12
  "language": "eng",
13
  "pids": [],
14
  "licenseCode": "OPEN SOURCE",
15
  "resourceType": "0000",
16
  "url": "http://rudar.ruc.dk/handle/1800/24691",
17
  "collectedFromId": "opendoar____::278",
18
  "hostedById": "opendoar____::278",
19
  "linksToProjects": [],
20
  "contexts": []
21
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_wrong_openaireId.json
1
{
2
  "openaireId":"dedup_wf_001::ab42e811",
3
  "originalId": "ORIG_ID_TEST",
4
  "type": "publication",
5
  "title": "TEST TITLE",
6
  "authors": [
7
	"Michele Artini",
8
	"Claudio Atzori",
9
	"Alessia Bardi"
10
  ],
11
  "publisher": "Test publisher",
12
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
13
  "language": "ita",
14
  "pids": [
15
	{
16
	  "type": "doi",
17
	  "value": "10.000/xyz-123"
18
	},
19
	{
20
	  "type": "oai",
21
	  "value": "oai:1234"
22
	}
23
  ],
24
  "licenseCode": "EMBARGO",
25
  "embargoEndDate": "2018-02-02",
26
  "resourceType": "0001",
27
  "url": "http://test.it/xyz",
28
  "collectedFromId": "opendoar____::2659",
29
  "hostedById": "opendoar____::2659",
30
  "linksToProjects": [
31
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
32
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
33
  ],
34
  "contexts": [
35
	"egi::classification::natsc::math::pure",
36
	"egi::classification::natsc::math::stats"
37
  ]
38
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_openaireId.json
1
{
2
  "openaireId":"dedup_wf_001::ab42e8116f4ae3c4021fb7c643a8167a",
3
  "originalId": "ORIG_ID_TEST",
4
  "type": "publication",
5
  "title": "TEST TITLE",
6
  "authors": [
7
	"Michele Artini",
8
	"Claudio Atzori",
9
	"Alessia Bardi"
10
  ],
11
  "publisher": "Test publisher",
12
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
13
  "language": "ita",
14
  "pids": [
15
	{
16
	  "type": "doi",
17
	  "value": "10.000/xyz-123"
18
	},
19
	{
20
	  "type": "oai",
21
	  "value": "oai:1234"
22
	}
23
  ],
24
  "accessRightCode": "EMBARGO",
25
  "licenseCode": "OPEN",
26
  "embargoEndDate": "2018-02-02",
27
  "resourceType": "0001",
28
  "url": "http://test.it/xyz",
29
  "collectedFromId": "opendoar____::2659",
30
  "hostedById": "opendoar____::2659",
31
  "linksToProjects": [
32
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
33
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
34
  ],
35
  "contexts": [
36
	"egi::classification::natsc::math::pure",
37
	"egi::classification::natsc::math::stats"
38
  ]
39
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record.json
1
{
2
  "originalId": "ORIG_ID_12345",
3
  "title": "TEST TITLE",
4
  "authors": [
5
	"Michele Artini",
6
	"Claudio Atzori",
7
	"Alessia Bardi"
8
  ],
9
  "publisher": "Test publisher",
10
  "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION",
11
  "language": "ita",
12
  "pids": [
13
	{
14
	  "type": "doi",
15
	  "value": "10.000/xyz-123"
16
	},
17
	{
18
	  "type": "oai",
19
	  "value": "oai:1234"
20
	}
21
  ],
22
  "accessRightCode": "OPEN",
23
  "resourceType": "0001",
24
  "url": "http://test.it/xyz",
25
  "collectedFromId": "opendoar____::2659",
26
  "hostedById": "opendoar____::2367",
27
  "linksToProjects": [
28
	"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
29
	"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"
30
  ],
31
  "contexts": [
32
	"egi::classification::natsc::math::pure",
33
	"egi::classification::natsc::math::stats"
34
  ]
35
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_orp.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951",
3
  "originalId": "oai:rudar.ruc.dk:1800/24691",
4
  "type": "other",
5
  "title": "Other test record",
6
  "authors": [
7
    "Sloan, Patrick Alexander Raaby",
8
    "Strange, Gustav Valdemar"
9
  ],
10
  "publisher": "",
11
  "description": "This is for testing software",
12
  "language": "eng",
13
  "pids": [],
14
  "licenseCode": "OPEN SOURCE",
15
  "resourceType": "0000",
16
  "url": "http://rudar.ruc.dk/handle/1800/24691",
17
  "collectedFromId": "opendoar____::278",
18
  "hostedById": "opendoar____::278",
19
  "linksToProjects": [],
20
  "contexts": []
21
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo.json
1
{
2
  "authors":[
3
	"Alouges, Fran\u00e7ois",
4
	"Di Fratta, Giovanni"
5
  ],
6
  "collectedFromId":"opendoar____::2659",
7
  "description":"The paper is about the parking 3-sphere swimmer ($\\text{sPr}_3$). This is a low-Reynolds number model swimmer composed of three balls of equal radii. The three balls can move along three horizontal axes (supported in the same plane) that mutually meet at the center of $\\text{sPr}_3$ with angles of $120^{\u2218}$ . The governing dynamical system is introduced and the implications of its geometric symmetries revealed. It is then shown that, in the first order range of small strokes, optimal periodic strokes are ellipses embedded in 3d space, i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$ and $v$ of $\u211d^3$. A simple analytic expression for the vectors $u$ and $v$ is derived. The results of the paper are used in a second article where the real physical dynamics of $\\text{sPr}_3$ is analyzed in the asymptotic range of very long arms. ; Comment: 17 pages, 4 figures",
8
  "hostedById":"opendoar____::2659",
9
  "licenseCode":"OPEN",
10
  "originalId":"oai:zenodo.org:996201",
11
  "pids":[
12
	{
13
	  "type":"oai",
14
	  "value":"oai:zenodo.org:996201"
15
	},
16
	{
17
	  "type":"doi",
18
	  "value":"10.5281/zenodo.996201"
19
	}
20
  ],
21
  "publisher":"Zenodo",
22
  "resourceType":"0020",
23
  "title":"Parking 3-sphere swimmer. I. Energy minimizing strokes",
24
  "type":"publication",
25
  "url":"https://zenodo.org/record/996201"
26
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodoAmpersandEverywhere.json
1
{
2
  "authors": [
3
	"Conradt, Tobias",
4
	"& members of the ISIMIP project (original data provision), cf. Hempel et al. 2013, https://doi.org/10.5194/esd-4-219-2013"
5
  ],
6
  "collectedFromId": "re3data_____::r3d100010468",
7
  "description": "<p>ISIMIP-2a climate data cutout provided for Sardinia in the framework of SIM4NEXUS & X<\/p>",
8
  "hostedById": "re3data_____::r3d100010468",
9
  "licenseCode": "OPEN",
10
  "linksToProjects": ["info:eu-repo/grantAgreement/EC/H2020/689150//Sustainable Integrated Management FOR the NEXUS of water-land-food-energy-climate for a resource-efficient Europe & beyond/SIM4NEXUS"],
11
  "originalId": "10.5281/zenodo.1460665",
12
  "pids": [
13
	{
14
	  "type": "oai",
15
	  "value": "oai:zenodo.org:1460665"
16
	},
17
	{
18
	  "type": "doi",
19
	  "value": "10.5281/zenodo.1460665"
20
	}
21
  ],
22
  "publisher": "Zenodo & Zenodo",
23
  "resourceType": "0021",
24
  "title": "sardinia_tasmax_MIROC-ESM-CHEM_rcp4p5_2006-2099_daily.nc4 & the title has && in it",
25
  "type": "dataset",
26
  "url": "https://zenodo.org/record/1460665"
27
}
modules/dnet-directindex-api/branches/correct_proj_ids/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_ariadne.json
1
{
2
  "openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982950",
3
  "originalId": "oai:rudar.ruc.dk:1800/24690",
4
  "type": "publication",
5
  "title": "Autofiktion",
6
  "authors": [
7
	"Sloan, Patrick Alexander Raaby",
8
	"Strange, Gustav Valdemar",
9
	"Freund-Jensen, Sofie",
10
	"Canvin, Emilie Meistrup",
11
	"Faaborg, Ida Selvejer",
12
	"Kruse, Mikkel"
13
  ],
14
  "publisher": "",
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff