Reformat code

parent d89e68ed
......@@ -19,13 +19,11 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.riot.RDFDataMgr;
......@@ -58,10 +56,12 @@ public class BratAnnotator {
// Read schemas file
JSONObject data = null;
try {
data = new JSONObject(Files.readAllLines(Paths.get(config.getSchemasPath())).stream().collect(Collectors.joining()));
data =
new JSONObject(
Files.readAllLines(Paths.get(config.getSchemasPath())).stream()
.collect(Collectors.joining()));
} catch (JSONException | IOException e) {
BratAnnotator.LOGGER.error(
"Error when parsing schemas: " + e.toString());
BratAnnotator.LOGGER.error("Error when parsing schemas: " + e.toString());
}
Iterator<String> keys = data.keys();
while (keys.hasNext()) {
......@@ -70,7 +70,8 @@ public class BratAnnotator {
JSONArray propertiesArray = (JSONArray) schemaObj.get("properties");
for (int i = 0; i < propertiesArray.length(); i++) {
JSONObject propertyObj = propertiesArray.getJSONObject(i);
propertiesLabelsMap.put(propertyObj.getString("property_ID"), propertyObj.getString("property"));
propertiesLabelsMap.put(
propertyObj.getString("property_ID"), propertyObj.getString("property"));
}
}
......
......@@ -7,7 +7,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
......@@ -34,7 +33,12 @@ public class AgenceFrancePresse {
this.config = config;
}
public void run(final String lang, final String year, final String month, final String day, final boolean withMedia) {
public void run(
final String lang,
final String year,
final String month,
final String day,
final boolean withMedia) {
try {
// For each language dir (eg. ENG, FRA, GER)
Files.list(Paths.get(config.getResourcesPath(), config.getDatasetName()))
......@@ -53,18 +57,27 @@ public class AgenceFrancePresse {
// For each month dir (eg. 01)
Files.list(yearDir)
.filter(file -> file.toFile().isDirectory())
.filter(file -> month == null || file.getFileName().toString().equals(month))
.filter(
file ->
month == null
|| file.getFileName().toString().equals(month))
.forEach(
monthDir -> {
try {
// For each day dir (eg. 31)
Files.list(monthDir)
.filter(file -> file.toFile().isDirectory())
.filter(file -> day == null || file.getFileName().toString().equals(day))
.filter(
file ->
day == null
|| file.getFileName()
.toString()
.equals(day))
.forEach(
dayDir ->
processDir(
dayDir, monthDir, yearDir, langDir, withMedia));
dayDir, monthDir, yearDir, langDir,
withMedia));
} catch (IOException e) {
AgenceFrancePresse.LOGGER.error(e.toString());
}
......@@ -82,7 +95,8 @@ public class AgenceFrancePresse {
}
}
private void processDir(Path dayDir, Path monthDir, Path yearDir, Path langDir, boolean withMedia) {
private void processDir(
Path dayDir, Path monthDir, Path yearDir, Path langDir, boolean withMedia) {
final Path turtleFile =
Paths.get(
config.getDumpPath(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment