code: public static boolean isVariableSet(QuerySolution resultRow, String variableName) {
  
          if (resultRow != null) {
              return resultRow.contains(variableName);
          }
  
          return false;
      }
docs: Given a query result from a SPARQL query, check if the given variable has
  a value or not
  
  @param resultRow    the result from a SPARQL query
  @param variableName the name of the variable to obtain
  @return true if the variable has a value, false otherwise