Commit 0dc1a848 authored by Naga Sai Datta Raviteja Kanagarla's avatar Naga Sai Datta Raviteja Kanagarla
Browse files

Removed Files

parent 0e76f914
This diff is collapsed.
package org.example;
import org.semanticweb.owlapi.model.OWLIndividual;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.ArrayList;
import java.io.Writer;
public class ConvertToTTL {
static final String carcinogenesisPrefix = "@prefix carcinogenesis: <http://dl-learner.org/carcinogenesis#> .";
static final String lpResourcePrefix = "@prefix lpres: <https://lpbenchgen.org/resource/> .";
static final String lpPropertyPrefix = "@prefix lpprop: <https://lpbenchgen.org/property/> .";
static final String outputFileName = "CarcinogenesisClassificationResult";
public static void writeConstants() {
try {
FileWriter outfileConstantWriter = new FileWriter(outputFileName + ".ttl");
outfileConstantWriter.write(carcinogenesisPrefix);
outfileConstantWriter.append("\n");
outfileConstantWriter.append(lpResourcePrefix);
outfileConstantWriter.append("\n");
outfileConstantWriter.append(lpPropertyPrefix);
outfileConstantWriter.append("\n\n");
outfileConstantWriter.close();
} catch (Exception e) {
e.getStackTrace();
}
}
public static void writeToFile(String lp_id, ArrayList<OWLIndividual> results,
boolean isPositiveResultList, int index) {
try {
Writer outfileContentWriter;
int i;
String line1;
String resource;
outfileContentWriter = new BufferedWriter(new FileWriter(outputFileName + ".ttl", true));
if (isPositiveResultList) {
line1 = "lpres:result_" + index + "pos\t" + "lpprop:belongsToLP\t" + "true ;";
} else {
line1 = "lpres:result_" + index + "neg\t" + "lpprop:belongsToLP\t" + "false ;";
}
String line2 = "\tlpprop:pertainsTo\t" + "lpres:" + lp_id + " ;";
String line3Begin = "\tlpprop:resource\t";
outfileContentWriter.append(line1);
outfileContentWriter.append("\n");
outfileContentWriter.append(line2);
outfileContentWriter.append("\n");
outfileContentWriter.append(line3Begin);
for(i = 0; i < (results.size() - 1); i++) {
resource = results.get(i).toString();
outfileContentWriter.append("carcinogenesis:" + resource + " , ");
}
resource = results.get(results.size() - 1).toString();
outfileContentWriter.append("carcinogenesis:" + resource + " .\n\n");
outfileContentWriter.close();
} catch (Exception e) {
e.getStackTrace();
}
}
}
\ No newline at end of file
Supports Markdown
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