|
@@ -37,7 +37,7 @@ public class PMRepository {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- public PM getPM(String pmiri) {
|
|
|
+ public PM getPM(String pmiri) throws Exception {
|
|
|
String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n"
|
|
|
+ "PREFIX obj: <http://ua.be/sdo2l/vocabulary/formalisms/object_diagram#>\n"
|
|
@@ -47,13 +47,19 @@ public class PMRepository {
|
|
|
+ " owl:sameAs <" + pmiri + "> .\n"
|
|
|
+ "}";
|
|
|
ResultSet results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
- PM pm = new PM();
|
|
|
- QuerySolution soln = results.nextSolution();
|
|
|
- RDFNode iri = soln.get("?pm");
|
|
|
- RDFNode name = soln.get("?pmName");
|
|
|
- pm.setIri(iri.toString());
|
|
|
- pm.setName(name.toString());
|
|
|
- return pm;
|
|
|
+
|
|
|
+ if (results.hasNext()) {
|
|
|
+ PM pm = new PM();
|
|
|
+ QuerySolution soln = results.nextSolution();
|
|
|
+ RDFNode iri = soln.get("?pm");
|
|
|
+ RDFNode name = soln.get("?pmName");
|
|
|
+ pm.setIri(iri.toString());
|
|
|
+ pm.setName(name.toString());
|
|
|
+ return pm;
|
|
|
+ } else {
|
|
|
+ throw new Exception("No data returned by query: \n" + query );
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public List<Pair<String,String>> findNextNodes(String iri) {
|