|
1
|
|
|
package br.ufrj.ppgi.greco.kettle.silk; |
|
2
|
|
|
|
|
3
|
|
|
import java.util.ArrayList; |
|
4
|
|
|
import java.util.List; |
|
5
|
|
|
|
|
6
|
|
|
import javax.xml.bind.annotation.XmlElement; |
|
7
|
|
|
import javax.xml.bind.annotation.XmlRootElement; |
|
8
|
|
|
import javax.xml.bind.annotation.XmlAttribute; |
|
9
|
|
|
|
|
10
|
|
|
@XmlRootElement |
|
11
|
|
|
public class Dataset { |
|
12
|
|
|
|
|
13
|
|
|
public static final String SPARQL = "sparqlEndpoint"; |
|
14
|
|
|
public static final String CSV = "csv"; |
|
15
|
|
|
public static final String RDF = "file"; |
|
16
|
|
|
public static final String XML = "xml"; |
|
17
|
|
|
|
|
18
|
|
|
@XmlAttribute |
|
19
|
|
|
private String id; |
|
20
|
|
|
|
|
21
|
|
|
@XmlAttribute |
|
22
|
|
|
private String type; |
|
23
|
|
|
|
|
24
|
|
|
@XmlElement(name = "Param") |
|
25
|
|
|
protected List<Param> params; |
|
26
|
|
|
|
|
27
|
|
|
public Dataset() {} |
|
28
|
|
|
|
|
29
|
|
|
public Dataset(String id, String type) { |
|
30
|
|
|
params = new ArrayList<>(); |
|
31
|
|
|
this.id = id; |
|
32
|
|
|
this.type = type; |
|
33
|
|
|
|
|
34
|
|
|
switch (this.type) { |
|
35
|
|
|
case SPARQL: |
|
36
|
|
|
this.setDefaultSparqlParams(); |
|
37
|
|
|
break; |
|
38
|
|
|
case CSV: |
|
39
|
|
|
this.setDefaultCsvParams(); |
|
40
|
|
|
break; |
|
41
|
|
|
case RDF: |
|
42
|
|
|
this.setDefaultRdfParams(); |
|
43
|
|
|
break; |
|
44
|
|
|
case XML: |
|
45
|
|
|
this.setDefaultXmlParams(); |
|
46
|
|
|
default: |
|
47
|
|
|
break; |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public void add(Param param) { |
|
52
|
|
|
this.params.add(param); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Set the default Silk SLS parameters that the user |
|
57
|
|
|
* will not be able to set on the view |
|
58
|
|
|
*/ |
|
59
|
|
|
public void setDefaultSparqlParams() { |
|
60
|
|
|
this.params.add(new Param("pageSize", "1000")); |
|
61
|
|
|
this.params.add(new Param("pauseTime", "0")); |
|
62
|
|
|
this.params.add(new Param("retryCount", "3")); |
|
63
|
|
|
this.params.add(new Param("retryPause", "1000")); |
|
64
|
|
|
this.params.add(new Param("queryParameters", "1000")); |
|
65
|
|
|
this.params.add(new Param("login", "")); |
|
66
|
|
|
this.params.add(new Param("useOrderBy", "true")); |
|
67
|
|
|
this.params.add(new Param("entityList", "")); |
|
68
|
|
|
this.params.add(new Param("parallel", "true")); |
|
69
|
|
|
this.params.add(new Param("password", "")); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public void setDefaultCsvParams() { |
|
73
|
|
|
this.params.add(new Param("arraySeparator", "1000")); |
|
74
|
|
|
this.params.add(new Param("separator", ",")); |
|
75
|
|
|
this.params.add(new Param("prefix", "")); |
|
76
|
|
|
this.params.add(new Param("uri", "")); |
|
77
|
|
|
this.params.add(new Param("quote", "\"")); |
|
78
|
|
|
this.params.add(new Param("properties", "")); |
|
79
|
|
|
this.params.add(new Param("regexFilter", "")); |
|
80
|
|
|
this.params.add(new Param("charset", "UTF-8")); |
|
81
|
|
|
this.params.add(new Param("linesToSkip", "0")); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public void setDefaultRdfParams(){ |
|
85
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public void setDefaultXmlParams(){ |
|
89
|
|
|
this.params.add(new Param("basePath", "")); |
|
90
|
|
|
this.params.add(new Param("uriPattern", "")); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
} |