Using one model for the A and T box
This commit is contained in:
parent
4b64764b82
commit
27ca4898e7
|
@ -24,21 +24,19 @@ public class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void readAndHandleFiles(String inputPath) {
|
private static void readAndHandleFiles(String inputPath) {
|
||||||
Model tboxModel = ModelFactory.createDefaultModel();
|
Model model = ModelFactory.createDefaultModel();
|
||||||
Model aboxModel = ModelFactory.createDefaultModel();
|
|
||||||
|
|
||||||
InputStream inT, inA;
|
InputStream inT, inA;
|
||||||
try {
|
try {
|
||||||
inT = new FileInputStream(new File(inputPath + "/" + Generator.T_BOX_FILENAME_XML));
|
inT = new FileInputStream(new File(inputPath + "/" + Generator.T_BOX_FILENAME_XML));
|
||||||
inA = new FileInputStream(new File(inputPath + "/" + Generator.A_BOX_FILENAME_XML));
|
inA = new FileInputStream(new File(inputPath + "/" + Generator.A_BOX_FILENAME_XML));
|
||||||
tboxModel.read(inT, "");
|
model.read(inT, "");
|
||||||
aboxModel.read(inA, "");
|
model.read(inA, "");
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(tboxModel);
|
System.out.println(model);
|
||||||
System.out.println(aboxModel);
|
|
||||||
|
|
||||||
Query query = QueryFactory.create("" + "PREFIX : <" + Generator.OWN_URI + ">" + "" + "SELECT ?console\n"
|
Query query = QueryFactory.create("" + "PREFIX : <" + Generator.OWN_URI + ">" + "" + "SELECT ?console\n"
|
||||||
+ "WHERE {\n" + " ?console :madeBy :Nintendo .\n" + " ?console :releaseYear ?releaseYear . \n"
|
+ "WHERE {\n" + " ?console :madeBy :Nintendo .\n" + " ?console :releaseYear ?releaseYear . \n"
|
||||||
|
@ -47,7 +45,7 @@ public class App {
|
||||||
// Query query = QueryFactory
|
// Query query = QueryFactory
|
||||||
// .create("PREFIX : <" + Generator.OWN_URI + ">" + " " + " SELECT ?s ?p ?p WHERE {" + "?s ?p ?o .}");
|
// .create("PREFIX : <" + Generator.OWN_URI + ">" + " " + " SELECT ?s ?p ?p WHERE {" + "?s ?p ?o .}");
|
||||||
|
|
||||||
QueryExecution queryExec = QueryExecutionFactory.create(query, aboxModel);
|
QueryExecution queryExec = QueryExecutionFactory.create(query, model);
|
||||||
|
|
||||||
ResultSet rs = queryExec.execSelect();
|
ResultSet rs = queryExec.execSelect();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue