Skip to content

Commit

Permalink
Update paths to server1
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccrae committed Mar 8, 2024
1 parent c35eec1 commit 60f1bf0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@ naisc-meas/.classpath
naisc-meas/.project
naisc-rest/.classpath
naisc-rest/.project
.project
.project
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ private static List<String> verifyOrDownload(String name) throws IOException {
}
if(!new File("models/" + name).exists()) {
System.err.println("Downloading resource: " + name);
URL website = new URL("http://server1.nlp.insight-centre.org/naisc-models/" + name + ".gz");
URL website = new URL("https://server1.nlp.insight-centre.org/naisc-models/" + name + ".gz");
ReadableByteChannel rbc = Channels.newChannel(new GZIPInputStream(website.openStream()));
try(FileOutputStream fos = new FileOutputStream("models/" + name)) {
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
}
}
return Collections.emptyList();
} catch(IOException x) {
x.printStackTrace();
return Collections.singletonList(name);
}

Expand All @@ -45,18 +46,19 @@ private static void getConfigs() throws IOException {
if(!new File("configs").exists()) {
new File("configs").mkdir();
System.err.println("Downloading configurations");
URL website = new URL("http://server1.nlp.insight-centre.org/naisc-models/configs.zip");
URL website = new URL("https://server1.nlp.insight-centre.org/naisc-models/configs.zip");
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream("configs.zip");
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
unzip("configs.zip", "configs");
new File("configs.zip").delete();
try(FileOutputStream fos = new FileOutputStream("configs.zip")) {
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
unzip("configs.zip", "configs");
new File("configs.zip").delete();
}

}
} catch(IOException x) {
throw new IOException("Could not download a resource. You can fix this by manually downloading and installing it\n" +
"For example on a Linux machine use the following commands:\n" +
" wget http://server1.nlp.insight-centre.org/naisc-models/configs.zip\n" +
" wget https://server1.nlp.insight-centre.org/naisc-models/configs.zip\n" +
" unzip configs.zip -d configs/\n", x);
}
}
Expand Down Expand Up @@ -110,7 +112,7 @@ public static void verify() throws IOException {
System.err.println("Could not download a resource. You can fix this by manually downloading and installing it\n" +
"For example on a Linux machine use the following commands:");
for (String name : missing) {
System.err.println(" wget http://server1.nlp.insight-centre.org/naisc-models/" + name + ".gz");
System.err.println(" wget https://server1.nlp.insight-centre.org/naisc-models/" + name + ".gz");
}
for (String name : missing) { System.err.println(" gunzip " + name + ".gz");
System.err.println(" mv " + name + " models/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
if (!directory.mkdirs() && !directory.exists() && !directory.isDirectory()) {
throw new ServletException("Could not create directoy");
}
downloadRDF("http://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/left",
downloadRDF("https://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/left",
directory, "left");
downloadRDF("http://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/right",
downloadRDF("https://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/right",
directory, "right");
try {
downloadRDF("http://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/align",
downloadRDF("https://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/align",
directory, "align");
} catch(IOException x) {
// Ignore: not all datasets have a gold standard
}
try {
downloadURL("http://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/blocks.nt",
downloadURL("https://server1.nlp.insight-centre.org/naisc-datasets/" + datasetName + "/blocks.nt",
new File(directory, "blocks.nt"));
} catch(IOException x) {
// Ignore: not all datasets have a blocking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ public static void updateRun(String id, Run newRun) {

private static List<String> getAvailableDataset() {
try (BufferedReader in = new BufferedReader(new InputStreamReader(
new URL("http://server1.nlp.insight-centre.org/naisc-datasets/").
new URL("https://server1.nlp.insight-centre.org/naisc-datasets/").
openConnection().getInputStream()))) {
List<String> datasets = new ArrayList<>();
String line = in.readLine();
while (line != null) {
if (line.contains("[DIR]")) {
if (line.contains("<a href=\"")) {
int i1 = line.indexOf("href=\"") + 6;
int i2 = line.indexOf("\"", i1) - 1;
datasets.add(line.substring(i1, i2));
String dataset = line.substring(i1, i2);
if (!dataset.contains(".")) {
datasets.add(dataset);
}
}
line = in.readLine();
}
Expand Down

0 comments on commit 60f1bf0

Please sign in to comment.