そんなときは例外処理を使うのが便利である。
例) SPARQLのOPTIONAL構文で Literal note に値が入っているか不明なとき
…
Literal note = (Literal) qs.get("note");
String note_s;
try{
note_s = note.toString();
}catch(Exception e){
note_s = "null";
}
…
Literal note = (Literal) qs.get("note");
String note_s;
try{
note_s = note.toString();
}catch(Exception e){
note_s = "null";
}
…
0 件のコメント:
コメントを投稿