1
|
package eu.dnetlib.parthenos.workflows.nodes;
|
2
|
|
3
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
4
|
import eu.dnetlib.msro.workflows.procs.Env;
|
5
|
import eu.dnetlib.rmi.common.ResultSet;
|
6
|
import org.apache.commons.logging.Log;
|
7
|
import org.apache.commons.logging.LogFactory;
|
8
|
import org.springframework.web.client.RestTemplate;
|
9
|
|
10
|
/**
|
11
|
* Created by Alessia Bardi on 26/01/2018.
|
12
|
*
|
13
|
* @author Alessia Bardi
|
14
|
*/
|
15
|
public class ReadVirtuosoByTypeJobNode extends ReadVirtuosoJobNode {
|
16
|
|
17
|
private static final Log log = LogFactory.getLog(ReadVirtuosoByTypeJobNode.class);
|
18
|
|
19
|
private String typeNamespace;
|
20
|
private String typeName;
|
21
|
|
22
|
@Override
|
23
|
protected String execute(final Env env){
|
24
|
log.info("Using virtuoso reader at : " + getVirtuosoReaderAPIUrl());
|
25
|
RestTemplate restTemplate = new RestTemplate(getClientHttpRequestFactory());
|
26
|
|
27
|
VirtuosoParthenosByTypeIterator iterator = new VirtuosoParthenosByTypeIterator().typeNamespace(typeNamespace).typeName(typeName).datasourceInterface(getDatasourceInterface()).virtuosoReaderAPIUrl(getVirtuosoReaderAPIUrl()).datasourceName(getDatasourceName()).restTemplate(restTemplate);
|
28
|
log.debug(String.format("Created iterator for %s:%s : ", typeNamespace, typeName ));
|
29
|
ResultSet<String> rs = getRsFactory().createResultSet(() -> iterator);
|
30
|
|
31
|
env.setAttribute("virtuoso_rs", rs);
|
32
|
|
33
|
return Arc.DEFAULT_ARC;
|
34
|
}
|
35
|
|
36
|
public String getTypeNamespace() {
|
37
|
return typeNamespace;
|
38
|
}
|
39
|
|
40
|
public void setTypeNamespace(final String typeNamespace) {
|
41
|
this.typeNamespace = typeNamespace;
|
42
|
}
|
43
|
|
44
|
public String getTypeName() {
|
45
|
return typeName;
|
46
|
}
|
47
|
|
48
|
public void setTypeName(final String typeName) {
|
49
|
this.typeName = typeName;
|
50
|
}
|
51
|
}
|