Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Commit 44ada16

Browse files
committed
Adjusted javadoc
1 parent 186844d commit 44ada16

File tree

8 files changed

+156
-55
lines changed

8 files changed

+156
-55
lines changed

commons-module/src/main/java/cz/cuni/mff/xrg/odcs/commons/module/utils/AddTripleWorkaround.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public class AddTripleWorkaround {
1919
* pred, Value obj, cannot define whether literal should be single/triple
2020
* quoted.
2121
*
22-
* @param subj
23-
* @param pred
24-
* @param obj
22+
* @param subj Subject of the triple
23+
* @param pred Predicate of the triple
24+
* @param obj Object of the triple
2525
* @return TTL serialization if the triple
2626
*/
2727
public static String prepareTriple(Resource subj, URI pred, Value obj) {

commons-module/src/main/java/cz/cuni/mff/xrg/odcs/commons/module/utils/DataUnitUtils.java

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,41 @@
88
import java.nio.charset.StandardCharsets;
99
import java.nio.file.Files;
1010
import java.nio.file.Paths;
11-
import java.util.Date;
12-
import java.util.concurrent.TimeUnit;
1311
import org.slf4j.LoggerFactory;
1412

1513
/**
16-
*
14+
* Utility class with common functionality usable by data units
1715
* @author tomasknap
1816
*/
1917
public class DataUnitUtils {
2018

2119
private static final org.slf4j.Logger log = LoggerFactory.getLogger(
2220
DataUnitUtils.class);
2321

24-
public static void printBytes(byte[] array, String name) {
25-
for (int k = 0; k < array.length; k++) {
26-
System.out.println(name + "[" + k + "]:" + array[k]);
27-
}
28-
}
29-
22+
// public static void printBytes(byte[] array, String name) {
23+
// for (int k = 0; k < array.length; k++) {
24+
// System.out.println(name + "[" + k + "]:" + array[k]);
25+
// }
26+
// }
27+
//
28+
/**
29+
* Stores string to a file
30+
* @param s String being stored
31+
* @param fileName Name of the file
32+
* @return Reference to the created file
33+
*/
3034
public static File storeStringToTempFile(String s, String fileName) {
3135
return storeStringToTempFile(s, fileName, StandardCharsets.UTF_8);
3236
}
3337

3438
/**
35-
* Stores string to a file
36-
*
37-
* TODO call directly removeTrailingQuotes(fileContent)?
38-
*
39-
* @param s
40-
* @param filePath
41-
* @param charset
42-
* @return Stored file
43-
*/
39+
* Stores string to a file
40+
*
41+
* @param s String being stored
42+
* @param fileName Name of the file
43+
* @param charset Encoding
44+
* @return Reference to the created file
45+
*/
4446
public static File storeStringToTempFile(String s, String filePath, Charset charset) {
4547

4648
if (s == null || s.isEmpty()) {
@@ -85,10 +87,21 @@ public static File storeStringToTempFile(String s, String filePath, Charset char
8587

8688
}
8789

90+
/**
91+
* Reads content of a file to string
92+
* @param path Path to a file
93+
* @return Content of a file
94+
*/
8895
public static String readFile(String path) {
8996
return readFile(path, StandardCharsets.UTF_8);
9097
}
9198

99+
/**
100+
* Reads content of a file to string
101+
* @param path Path to a file
102+
* @param encoding Encoding
103+
* @return Content of a file
104+
*/
92105
public static String readFile(String path, Charset encoding) {
93106
byte[] encoded;
94107
try {
@@ -101,6 +114,10 @@ public static String readFile(String path, Charset encoding) {
101114
return encoding.decode(ByteBuffer.wrap(encoded)).toString();
102115
}
103116

117+
/**
118+
* Checks existence of a directory
119+
* @param file Path to the directory
120+
*/
104121
public static void checkExistanceOfDir(String file) {
105122
if (new File(file).mkdirs()) {
106123
log.debug("Dir {} created", file);
@@ -109,20 +126,26 @@ public static void checkExistanceOfDir(String file) {
109126
}
110127
}
111128

112-
public static String encode(String literalValue, String escapedMappings) {
113-
String val = literalValue;
114-
String[] split = escapedMappings.split("\\s*");
115-
for (String s : split) {
116-
String[] keyAndVal = s.split(":");
117-
if (keyAndVal.length == 2) {
118-
val = val.replaceAll(keyAndVal[0], keyAndVal[1]);
119-
120-
} else {
121-
log.warn("Wrong format of escaped character mappings, skipping the mapping");
122-
123-
}
124-
}
125-
return val;
126-
}
129+
// /**
130+
// * Encodes string with
131+
// * @param literalValue
132+
// * @param escapedMappings
133+
// * @return
134+
// */
135+
// public static String encode(String literalValue, String escapedMappings) {
136+
// String val = literalValue;
137+
// String[] split = escapedMappings.split("\\s*");
138+
// for (String s : split) {
139+
// String[] keyAndVal = s.split(":");
140+
// if (keyAndVal.length == 2) {
141+
// val = val.replaceAll(keyAndVal[0], keyAndVal[1]);
142+
//
143+
// } else {
144+
// log.warn("Wrong format of escaped character mappings, skipping the mapping");
145+
//
146+
// }
147+
// }
148+
// return val;
149+
// }
127150

128151
}

dataunit-rdf-impl/src/main/java/cz/cuni/mff/xrg/odcs/rdf/metadata/FileRDFMetadataExtractor.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.slf4j.LoggerFactory;
1616

1717
/**
18-
*
18+
* Class responsible for extracting metadata from RDF data unit.
1919
* @author tomasknap
2020
*/
2121
public class FileRDFMetadataExtractor {
@@ -25,8 +25,12 @@ public class FileRDFMetadataExtractor {
2525
private static final org.slf4j.Logger log = LoggerFactory.getLogger(
2626
FileRDFMetadataExtractor.class);
2727

28-
public FileRDFMetadataExtractor(BaseRDFRepo aThis) {
29-
this.rdfDataUnit = aThis;
28+
/**
29+
* Constructor
30+
* @param rdfDataUnit
31+
*/
32+
public FileRDFMetadataExtractor(BaseRDFRepo rdfDataUnit) {
33+
this.rdfDataUnit = rdfDataUnit ;
3034
}
3135

3236
//returns list of mappings predicate-values
@@ -73,12 +77,18 @@ private List<String> getMetadataValue(String subjectURI, String predicateURI) {
7377

7478
}
7579

80+
/**
81+
* Collects metadata for the given subject URI
82+
* @param subjectURI Subject URI for which metadata is collected
83+
* @param predicates Predicates holding metadataawhich are looked up in the rdf data unit
84+
* @return Map of all metadata values for all desired predicates of the given subject URI
85+
*/
7686
public Map<String, List<String>> getMetadataForSubject(String subjectURI,
77-
List<String> optionalPredicates) {
87+
List<String> predicates) {
7888

7989
Map<String, List<String>> metadata = new HashMap<>();
8090

81-
for (String predicate : optionalPredicates) {
91+
for (String predicate : predicates) {
8292
List<String> values = getMetadataValue(subjectURI, predicate);
8393
if (!values.isEmpty()) {
8494
metadata.put(predicate, values);
@@ -92,8 +102,14 @@ public Map<String, List<String>> getMetadataForSubject(String subjectURI,
92102

93103
}
94104

95-
public Map<String, List<String>> getMetadataForFilePath(String filePath,
96-
List<String> optionalPredicates) {
105+
/**
106+
* Collects metadata for file identified via filePath
107+
* @param filePath File path for a file in file data unit
108+
* @param predicates Predicates holding metadataawhich are looked up in the rdf data unit
109+
* @return Map of all metadata values for all desired predicates
110+
*/
111+
public Map<String, List<String>> getMetadataForFilePath(String filePath,
112+
List<String> predicates) {
97113

98114
Map<String, List<String>> metadata = new HashMap<>();
99115

@@ -131,7 +147,7 @@ public Map<String, List<String>> getMetadataForFilePath(String filePath,
131147
subjectURI, filePath);
132148

133149
//for the subject, try to get more metadata:
134-
return getMetadataForSubject(subjectURI, optionalPredicates);
150+
return getMetadataForSubject(subjectURI, predicates);
135151
}
136152
} catch (QueryEvaluationException ex) {
137153
log.error(

deploy/odcsTestDeploy.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ scp -r -P 42222 /Users/tomasknap/Documents/PROJECTS/ETL-SWProj/intlib/target/lib
2828

2929
#db import
3030
#TODO ask if import db?
31-
scp -r -P 42222 /Users/tomasknap/Documents/PROJECTS/ETL-SWProj/intlib/db/virtuoso/rdbms/* [email protected]:/home/knap/tmp/odcs-test/$1
31+
ssh -p 42222 [email protected] mkdir /home/knap/tmp/odcs-test/$1/virtuoso
32+
ssh -p 42222 [email protected] mkdir /home/knap/tmp/odcs-test/$1/mysql
33+
scp -r -P 42222 /Users/tomasknap/Documents/PROJECTS/ETL-SWProj/intlib/db/virtuoso/rdbms/* [email protected]:/home/knap/tmp/odcs-test/$1/virtuoso
34+
scp -r -P 42222 /Users/tomasknap/Documents/PROJECTS/ETL-SWProj/intlib/db/mysql/rdbms/* [email protected]:/home/knap/tmp/odcs-test/$1/mysql
3235
#ssh -p 42222 [email protected] /usr/local/bin/isql-v -U dba -P dba01OD -S 1119 < ~/tmp/$1/schema.sql
3336
#ssh -p 42222 [email protected] /usr/local/bin/isql-v -U dba -P dba01OD -S 1119 < ~/tmp/$1/data.sql
3437

module/Silk_Linker/src/main/java/cz/cuni/mff/xrg/odcs/extractor/silklinker/SilkLinker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@ public class SilkLinker extends ConfigurableBase<SilkLinkerConfig>
4747

4848
private static final Logger log = LoggerFactory.getLogger(
4949
SilkLinker.class);
50+
5051
@OutputDataUnit(name = "links_confirmed")
5152
public RDFDataUnit outputConfirmed;
5253
@OutputDataUnit(name = "links_to_be_verified")
5354
public RDFDataUnit outputToVerify;
5455

56+
/**
57+
* Constructor
58+
*/
5559
public SilkLinker() {
5660
super(SilkLinkerConfig.class);
5761
}

module/Silk_Linker/src/main/java/cz/cuni/mff/xrg/odcs/extractor/silklinker/SilkLinkerConfig.java

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
/**
66
*
7-
* Put your DPU's configuration here.
8-
*
7+
* Configuration for SilkLinker
8+
* @author tomasknap
99
*/
1010
public class SilkLinkerConfig extends DPUConfigObjectBase {
1111

@@ -19,26 +19,48 @@ public class SilkLinkerConfig extends DPUConfigObjectBase {
1919

2020
private String confFileLabel = "";
2121

22+
/**
23+
* Constructor
24+
*/
2225
public SilkLinkerConfig() {
2326
confFile = null;
2427
}
2528

29+
/**
30+
* Constructor
31+
* @param confFile Configuration file for Silk
32+
* @param confFileLabel Label for the configuration file from which the configuration was created
33+
* @param minConfirmed Minimum score for the links to be considered as confirmed
34+
* @param minToBeVerified Minimum score for the links to be considered as "to be verified"
35+
*/
2636
public SilkLinkerConfig(String confFile, String confFileLabel, String minConfirmed, String minToBeVerified) {
2737
this.confFile = confFile;
2838
this.confFileLabel = confFileLabel;
2939
this.minConfirmedLinks = minConfirmed;
3040
this.minLinksToBeVerified = minToBeVerified;
3141
}
3242

43+
/**
44+
* Constructor
45+
* @param confFile Configuration file for Silk
46+
*/
3347
public SilkLinkerConfig(String confFile) {
3448
this.confFile = confFile;
3549

3650
}
3751

52+
/**
53+
* Gets configuration file
54+
* @return configuration file
55+
*/
3856
String getSilkConf() {
3957
return confFile;
4058
}
4159

60+
/**
61+
* Gets label for the configuration file from which the configuration was created
62+
* @return Label for the configuration file from which the configuration was created
63+
*/
4264
public String getConfFileLabel() {
4365
return confFileLabel;
4466
}
@@ -50,14 +72,18 @@ public boolean isValid() {
5072
return confFile != null;
5173
}
5274

53-
public String getConfFile() {
54-
return confFile;
55-
}
56-
75+
/**
76+
* Gets minimum score for the links to be considered as confirmed
77+
* @return Minimum score for the links to be considered as confirmed
78+
*/
5779
public String getMinConfirmedLinks() {
5880
return minConfirmedLinks;
5981
}
6082

83+
/**
84+
* Gets minimum score for the links to be considered as "to be verified"
85+
* @return Minimum score for the links to be considered as "to be verified"
86+
*/
6187
public String getMinLinksToBeVerified() {
6288
return minLinksToBeVerified;
6389
}

module/Silk_Linker/src/main/java/cz/cuni/mff/xrg/odcs/extractor/silklinker/SilkLinkerDialog.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import cz.cuni.mff.xrg.odcs.commons.configuration.ConfigException;
1717
import cz.cuni.mff.xrg.odcs.commons.module.dialog.BaseConfigDialog;
18-
import cz.cuni.mff.xrg.odcs.commons.ontology.OdcsTerms;
1918

2019
import java.io.ByteArrayOutputStream;
2120
import java.io.IOException;
@@ -214,6 +213,11 @@ public void validate(Object value) throws Validator.InvalidValueException {
214213
}
215214

216215

216+
/**
217+
* Sets configuration from an object to dialog
218+
* @param conf Configuration
219+
* @throws ConfigException
220+
*/
217221
@Override
218222
public void setConfiguration(SilkLinkerConfig conf) throws ConfigException {
219223

@@ -231,6 +235,11 @@ public void setConfiguration(SilkLinkerConfig conf) throws ConfigException {
231235

232236
}
233237

238+
/**
239+
* Gets configuration from dialog to configuration object
240+
* @return Configuration Object
241+
* @throws ConfigException
242+
*/
234243
@Override
235244
public SilkLinkerConfig getConfiguration() throws ConfigException {
236245
//get the conf from textArea

0 commit comments

Comments
 (0)