public static ArrayList<QueryData> parseOSMOQueryData(TupleQueryResult qres) { ArrayList<QueryData> queryDataList = new ArrayList<QueryData>(); try { while (qres.hasNext()) { BindingSet b = qres.next(); Set names = b.getBindingNames(); QueryData queryData = new QueryData(); for (Object n : names) { if (((String) n).equalsIgnoreCase("queryID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); queryData.setId(str); System.out.print("srvcStatus id: " + queryData.getId() + " "); } else if (((String) n).equalsIgnoreCase("queryString")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); queryData.setQueryString(str); System.out.print("srvcStatusTime : " + queryData.getQueryString() + " "); } } queryDataList.add(queryData); } // while return queryDataList; } catch (QueryEvaluationException e) { e.printStackTrace(); return null; } catch (Exception e) { e.printStackTrace(); return null; } }
public BindingSet getBindings() { try { return evaluate().next(); } catch (QueryEvaluationException e) { e.printStackTrace(); } return null; }
public static RootOAMOData parseOAMORootData(TupleQueryResult qres) { RootOAMOData rootOAMOData = new RootOAMOData(); try { // while (qres.hasNext()) // { BindingSet b = qres.next(); Set names = b.getBindingNames(); for (Object n : names) { if (((String) n).equalsIgnoreCase("oamoName")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); rootOAMOData.setOamoName(str); System.out.print("oamoName: " + rootOAMOData.getOamoName()); } else if (((String) n).equalsIgnoreCase("userID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); rootOAMOData.setUserID(str); System.out.print("userID: " + rootOAMOData.getUserID()); } // else if(((String) n).equalsIgnoreCase("serviceID")) // { // String str = (b.getValue((String) n)==null) ? null : // b.getValue((String) n).stringValue(); // rootOAMOData.setServiceID(str); // System.out.print("serviceID: "+rootOAMOData.getServiceID()); // } else if (((String) n).equalsIgnoreCase("oamoDesc")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); rootOAMOData.setOamoDesc(str); System.out.println("oamoDesc : " + rootOAMOData.getOamoDesc() + " "); } else if (((String) n).equalsIgnoreCase("oamoGraphMeta")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); rootOAMOData.setOamoGraphMeta(str); System.out.println("oamoGraphMeta : " + rootOAMOData.getOamoGraphMeta() + " "); } } // }//while return rootOAMOData; } catch (QueryEvaluationException e) { e.printStackTrace(); return null; } catch (Exception e) { e.printStackTrace(); return null; } }
public static ArrayList<WidgetPresentationData> parseWidgetPreListByService( TupleQueryResult qres) { ArrayList<WidgetPresentationData> widgetPresentationDataList = new ArrayList<WidgetPresentationData>(); try { while (qres.hasNext()) { BindingSet b = qres.next(); Set names = b.getBindingNames(); WidgetPresentationData widgetPreData = new WidgetPresentationData(); for (Object n : names) { if (((String) n).equalsIgnoreCase("widgetPreID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); widgetPreData.setId(str); System.out.print("widgetPreID: " + widgetPreData.getId() + " "); } else if (((String) n).equalsIgnoreCase("widgetID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); widgetPreData.setWidgetID(str); System.out.print("widgetID: " + widgetPreData.getWidgetID() + " "); } else if (((String) n).equalsIgnoreCase("widgetAttrID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); widgetPreData.setWidgetAttrID(str); System.out.print("widgetAttr: " + widgetPreData.getWidgetAttrID() + " "); } } widgetPresentationDataList.add(widgetPreData); } // while return widgetPresentationDataList; } catch (QueryEvaluationException e) { e.printStackTrace(); return null; } catch (Exception e) { e.printStackTrace(); return null; } }
public static ArrayList<RootOsmoData> parseOSMOListOfOAMO(TupleQueryResult qres) { ArrayList<RootOsmoData> osmoDataList = new ArrayList<RootOsmoData>(); try { while (qres.hasNext()) { BindingSet b = qres.next(); Set names = b.getBindingNames(); RootOsmoData osmoData = new RootOsmoData(); for (Object n : names) { if (((String) n).equalsIgnoreCase("serviceID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); osmoData.setId(str); System.out.print("serviceID: " + osmoData.getId() + " "); } else if (((String) n).equalsIgnoreCase("srvcName")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); osmoData.setName(str); System.out.print("srvcName : " + osmoData.getName() + " "); } else if (((String) n).equalsIgnoreCase("srvcDesc")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); osmoData.setDesc(str); System.out.print("srvcDesc : " + osmoData.getDesc() + " "); } } osmoDataList.add(osmoData); } // while return osmoDataList; } catch (QueryEvaluationException e) { e.printStackTrace(); return null; } catch (Exception e) { e.printStackTrace(); return null; } }
public static ArrayList<WidgetAttr> parseWidgetAttributes(TupleQueryResult qres) { ArrayList<WidgetAttr> widgetAttrList = new ArrayList<WidgetAttr>(); try { while (qres.hasNext()) { BindingSet b = qres.next(); Set names = b.getBindingNames(); WidgetAttr widgetAttr = new WidgetAttr(); for (Object n : names) { if (((String) n).equalsIgnoreCase("widgetAttrID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); widgetAttr.setId(str); System.out.print("widgetattr id: " + widgetAttr.getId() + " "); } else if (((String) n).equalsIgnoreCase("widgetAttrName")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); widgetAttr.setName(str); System.out.print("widgetAttrName: " + widgetAttr.getName() + " "); } else if (((String) n).equalsIgnoreCase("widgetAttrDesc")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); widgetAttr.setValue(str); System.out.print("widgetAttrDesc: " + widgetAttr.getValue() + " "); } } widgetAttrList.add(widgetAttr); } // while return widgetAttrList; } catch (QueryEvaluationException e) { e.printStackTrace(); return null; } catch (Exception e) { e.printStackTrace(); return null; } }
public static ArrayList<ServiceStatusData> parseServiceStatusOfOSMO(TupleQueryResult qres) { ArrayList<ServiceStatusData> serviceStatusDataList = new ArrayList<ServiceStatusData>(); try { while (qres.hasNext()) { BindingSet b = qres.next(); Set names = b.getBindingNames(); ServiceStatusData srvcStatusData = new ServiceStatusData(); for (Object n : names) { if (((String) n).equalsIgnoreCase("srvcStatusID")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); srvcStatusData.setSrvcStatusID(str); System.out.print("srvcStatus id: " + srvcStatusData.getSrvcStatusID() + " "); } else if (((String) n).equalsIgnoreCase("srvcStatusTime")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); srvcStatusData.setSrvcStatusTime(str); System.out.print("srvcStatusTime : " + srvcStatusData.getSrvcStatusTime() + " "); } else if (((String) n).equalsIgnoreCase("srvcStatus")) { String str = (b.getValue((String) n) == null) ? null : b.getValue((String) n).stringValue(); srvcStatusData.setSrvcStatus(str); System.out.print("srvcStatusStatus : " + srvcStatusData.getSrvcStatus() + " "); } } serviceStatusDataList.add(srvcStatusData); } // while return serviceStatusDataList; } catch (QueryEvaluationException e) { e.printStackTrace(); return null; } catch (Exception e) { e.printStackTrace(); return null; } }