public VarDecHelper(QuerySolution qs) throws Exception { try { name = (Literal) qs.get("name"); type = (Resource) qs.get("type"); value = (Resource) qs.get("value"); belongsTo = (Resource) qs.get("belongsTo"); } catch (Exception ex) { ex.printStackTrace(); } }
public For(QuerySolution qs) throws Exception { try { hasInitCounter = (Resource) qs.get("hasInitCounter"); hasSetCondition = (Resource) qs.get("hasSetCondition"); hasSetCondition = (Resource) qs.get("hasForStep"); hasSetCondition = (Resource) qs.get("hasForBody"); belongsTo = (Resource) qs.get("belongsTo"); } catch (Exception ex) { ex.printStackTrace(); } }
public static ChainedJavaObject create(String ID, QuerySolution qs) throws Exception { try { Literal fullPath = (Literal) qs.get("fullPath"); Literal name = (Literal) qs.get("name"); Resource rdfType = (Resource) qs.get("rdfType"); Resource belongsTo = (Resource) qs.get("belongsTo"); String rdfTypeStr = rdfType.toString(); int hashIndex = rdfTypeStr.indexOf("#"); String objectType = rdfTypeStr.substring(hashIndex + 1, rdfTypeStr.length()); ChainedJavaObject cjo = new ChainedJavaObject(ID); if (objectType.equals("Class")) { cjo.setRdfType(ObjectType.CLAZZ); } else if (objectType.equals("Method")) { cjo.setRdfType(ObjectType.METHOD); } else if (objectType.equals("MethodInvoc")) { cjo.setRdfType(ObjectType.METHOD_INVOC); } else { cjo.setRdfType(ObjectType.VARIABLE); } if (name != null) { cjo.setName(name.getValue().toString()); } if (fullPath == null) { cjo.setFullPath("na"); } else { cjo.setFullPath(fullPath.getValue().toString()); } if (belongsTo == null) { cjo.setBelongsTo("na"); } else { cjo.setBelongsTo(belongsTo.toString()); } return cjo; } catch (Exception ex) { ex.printStackTrace(); } return null; }