Kode program halaman detail (persondetail.jsp)
LAMPIRAN 8 Kode program halaman detail (persondetail.jsp)
<%@ include file= "header.jsp" %> <%@ include file= "libvar.jsp" %> <%@ include file= "ontologi.jsp" %>
//----------MENGAMBIL NILAI PARAMETER--------------------------------------
answerdetail= request.getParameter("answerdetail"); out.println("<center><b>INFORMASI DETAIL</b></center><br><br>");
//----------DETAIL PERSON-------------------------------------------------------
querystring = "SELECT DISTINCT ?person ?pname ?pgender "+ "WHERE {?person <"+NS+"name> ?pname."+ "?person <"+NS+"gender> ?pgender."+ "filter regex ('"+answerdetail+"',?pname,'i')}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; persondetail = soln.getResource("person"); personname = soln.getLiteral("pname").getString();
persongender = soln.getLiteral("pgender").getString(); } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIEDIRECTOR --------------------
querystring = "SELECT DISTINCT ?mtitle "+ "WHERE {?movie <"+NS+"title> ?mtitle."+ "?movie <"+NS+"director> <"+persondetail+">}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; movietitle = soln.getLiteral("mtitle").getString(); moviedirector = moviedirector + "<a
href='moviedetail.jsp?answerdetail="+movietitle+"'>"+movietitle+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIECAST --------------------
querystring = "SELECT DISTINCT ?mtitle "+ "WHERE {?movie <"+NS+"title> ?mtitle."+ "?movie <"+NS+"cast> <"+persondetail+">}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) { try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
href='moviedetail.jsp?answerdetail="+movietitle+"'>"+movietitle+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIE PRODUCER -------------------- querystring = "SELECT DISTINCT ?mtitle "+
"WHERE {?movie <"+NS+"title> ?mtitle."+ "?movie <"+NS+"producer> <"+persondetail+">}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; movietitle = soln.getLiteral("mtitle").getString(); movieproducer = movieproducer + "<a
href='moviedetail.jsp?answerdetail="+movietitle+"'>"+movietitle+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIE WRITER --------------------
querystring = "SELECT DISTINCT ?mtitle "+ "WHERE {?movie <"+NS+"title> ?mtitle."+ "?movie <"+NS+"writer> <"+persondetail+">}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; movietitle = soln.getLiteral("mtitle").getString(); moviewriter = moviewriter + "<a
href='moviedetail.jsp?answerdetail="+movietitle+"'>"+movietitle+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------------------------------------------------------------------
querystring = "SELECT DISTINCT ?awname ?awcat ?awyear "+ "WHERE {?award <"+NS+"awardName> ?awname."+ "?award <"+NS+"awardCategory> ?awcat."+ "?award <"+NS+"awardYear> ?awyear."+ "?award <"+NS+"winner> <"+persondetail+">}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; awardname = soln.getLiteral("awname").getString(); awardcategory = soln.getLiteral("awcat").getString(); awardyear = soln.getLiteral("awyear").getString();
personaward = personaward +
awardname+"("+awardcategory+","+awardyear+") | ";
} catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------------------------------------------------------------------
out.print("<table width='100%' border='0'>"); out.print("<tr align='left' valign='top'>"); out.print("<td width='10%'>Nama</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='75%'><a
href='persondetail.jsp?answerdetail="+personname+"'>"+personname+"</a></td>"); out.print("</tr>"); out.print("<tr align='left' valign='top'>"); out.print("<td width='10%'>Jenis Kelamin</td>");
out.print("<td width='1%'>:</td>"); out.print("<td width='75%'>"+persongender+"</td>"); out.print("</tr>");
if (moviedirector != ""){ out.print("<tr align='left' valign='top'>"); out.print("<td width='10%'>Sutradara pada film</td>");
out.print("<td width='1%'>:</td>"); out.print("<td width='75%'>"+moviedirector+"</td>"); out.print("</tr>"); }
if (moviecast != ""){ out.print("<tr align='left' valign='top'>"); out.print("<td width='10%'>Pemain pada film</td>");
out.print("<td width='1%'>:</td>"); out.print("<td width='75%'>"+moviecast+"</td>"); out.print("</tr>"); }
if (movieproducer != ""){ out.print("<tr align='left' valign='top'>"); out.print("<td width='10%'>Produser pada film</td>");
out.print("<td width='1%'>:</td>"); out.print("<td width='75%'>"+movieproducer+"</td>"); out.print("</tr>"); }
if (moviewriter != ""){ out.print("<tr align='left' valign='top'>"); out.print("<td width='10%'>Penulis pada film</td>");
out.print("<td width='1%'>:</td>"); out.print("<td width='75%'>"+moviewriter+"</td>"); out.print("</tr>"); }
if (personaward != ""){ out.print("<tr align='left' valign='top'>");
out.print("<td width='10%'>Penghargaan</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+personaward+"</td>"); out.print("</tr>"); } out.print("</table>");
%> <%@ include file= "footer.jsp" %>
LAMPIRAN 9
Kode program halaman detail (moviedetail.jsp)
<%@ include file= "header.jsp" %> <%@ include file= "libvar.jsp" %> <%@ include file= "ontologi.jsp" %>
//-------------------- MENGAMBIL NILAI PARAMETER --------------------
answerdetail= request.getParameter("answerdetail"); out.println("<center><b>INFORMASI DETAIL</b></center><br><br>");
//-------------------- DETAIL PERSON--------------------
querystring = "SELECT DISTINCT ?movie ?mtitle ?mgenre ?mduration ?mlocation ?myear ?mreleasedate "+ "WHERE {?movie <"+NS+"title> ?mtitle."+ "?movie <"+NS+"genres> ?mgenre."+ "?movie <"+NS+"duration> ?mduration."+ "?movie <"+NS+"location> ?mlocation."+ "?movie <"+NS+"year> ?myear."+ "?movie <"+NS+"releaseDate> ?mreleasedate."+ "filter regex ('"+answerdetail+"',?mtitle,'i')}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ;
moviedetail = soln.getResource("movie"); movietitle = soln.getLiteral("mtitle").getString();
moviegenre = soln.getLiteral("mgenre").getString(); movieyear = soln.getLiteral("myear").getString(); movierelease = soln.getLiteral("mreleasedate").getString(); movieduration = soln.getLiteral("mduration").getString(); movielocation = soln.getLiteral("mlocation").getString();
} } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIEDIRECTOR--------------------
querystring = "SELECT DISTINCT ?pname "+ "WHERE {<"+moviedetail+"> <"+NS+"director> ?person."+ "?person <"+NS+"name> ?pname}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; personname = soln.getLiteral("pname").getString(); moviedirector = moviedirector + "<a
href='persondetail.jsp?answerdetail="+personname+"'>"+personname+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIECAST --------------------
querystring = "SELECT DISTINCT ?pname "+ "WHERE {<"+moviedetail+"> <"+NS+"cast> ?person."+ "?person <"+NS+"name> ?pname}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; personname = soln.getLiteral("pname").getString(); moviecast = moviecast + "<a
href='persondetail.jsp?answerdetail="+personname+"'>"+personname+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIE PRODUCER --------------------
querystring = "SELECT DISTINCT ?pname "+ "WHERE {<"+moviedetail+"> <"+NS+"producer> ?person."+ "?person <"+NS+"name> ?pname}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; personname = soln.getLiteral("pname").getString(); movieproducer = movieproducer + "<a
href='persondetail.jsp?answerdetail="+personname+"'>"+personname+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------- MOVIE WRITER --------------------
querystring = "SELECT DISTINCT ?pname "+ "WHERE {<"+moviedetail+"> <"+NS+"writer> ?person."+ "?person <"+NS+"name> ?pname}";
query = QueryFactory.create(querystring) ; qexec = QueryExecutionFactory.create (query,m);
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; personname = soln.getLiteral("pname").getString(); moviewriter = moviewriter + "<a
href='persondetail.jsp?answerdetail="+personname+"'>"+personname+"</a> | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-----------------------------------------------------------------------------
querystring = "SELECT DISTINCT ?awname ?awcat ?awyear "+ "WHERE {?award <"+NS+"awardName> ?awname."+ "?award <"+NS+"awardCategory> ?awcat."+ "?award <"+NS+"awardYear> ?awyear."+ "<"+moviedetail+"> <"+NS+"movieAward> ?award}"; querystring = "SELECT DISTINCT ?awname ?awcat ?awyear "+ "WHERE {?award <"+NS+"awardName> ?awname."+ "?award <"+NS+"awardCategory> ?awcat."+ "?award <"+NS+"awardYear> ?awyear."+ "<"+moviedetail+"> <"+NS+"movieAward> ?award}";
try { results = qexec.execSelect() ; for ( ; results.hasNext() ; ) {
soln = results.nextSolution() ; awardname = soln.getLiteral("awname").getString(); awardcategory = soln.getLiteral("awcat").getString(); awardyear = soln.getLiteral("awyear").getString();
personaward = personaward + awardname+"
("+awardcategory+","+awardyear+") | "; } } catch (Exception e) {out.print("maaf ada kesalahan "+e);} finally { qexec.close() ; }
//-------------------------------------------------------------------------------
out.print("<table width='100%' border='0'>"); out.print("<tr align='left' valign='top'>");
out.print("<td width='9%'>Judul</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'><a
href='moviedetail.jsp?answerdetail="+movietitle+"'>"+movietitle+"</a></td>"); out.print("</tr>"); out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Genre</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+moviegenre+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Tahun</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+movieyear+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Rilis</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+movierelease+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Durasi</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+movieduration+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Lokasi</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+movielocation+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Sutradara</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+moviedirector+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Pemain</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+moviecast+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Produser</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+movieproducer+"</td>"); out.print("</tr>");
out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Penulis</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+moviewriter+"</td>"); out.print("<tr align='left' valign='top'>"); out.print("<td width='9%'>Penulis</td>"); out.print("<td width='1%'>:</td>"); out.print("<td width='80%'>"+moviewriter+"</td>");
%> <%@ include file= "footer.jsp" %>