Beruflich Dokumente
Kultur Dokumente
A PROJECT REPORT
Submitted by
BACHELOR OF ENGINEERING
In
Certified that this project report “Intelligent Question answering System” is the bonafide
work of “Shanmukh Sri Vamsi.N [191511062]” who carried out the project work under my
supervision.
SIGNATURE SIGNATURE
We hereby declare that the mini project entitled “Intelligent Question answering System”
in partial fulfillment of requirement for the award of the degree of Bachelor of Technology is
a record of original project work done by us, during our period of study in SAVEETHA SCHOOL
OF ENGINEERING and no part of it has been submitted for any degree, association, fellowship
or any other similar titles.
SIGNATURE
Name:
Date:
CERTIFICATE BY THE GUIDE
This is to certify that the project entitled “Intelligent Question answering System” is the
bonafide work carried out by “Shanmukh sri vamsi.N” student of B.E., SAVEETHA SCHOOL
OF ENGINEERING ,SAVEETHA UNIVERSITY,CHENNAI 602105, during the year 2017 – 2018 under
my guidance.
Dr.T.Devi
Associative professor
Department of CSE
Saveetha University
Chennai 602105
ACKNOWLEDGEMENT
To begin with we thank the almighty for giving us the strength and knowledge to carry
out this project work. At this outset, we take immense pleasure in expressing our sincere gratitude
to our honorable Chancellor, Dr. N.M.Veeraiyan for being a source of inspiration.
We sincerely thank our Vice-Chancellor, Dr. L. JAWAHAR NESON for providing all the
facilities to complete the project successfully.
We extent our heartiest thanks to our Director, Mrs. Ramya Deepak for providing
constant support and encouragement
We are deeply indebted to our guide and project Co-Ordinator, Mrs.V.Banupriya for her
motivation, guidance and valuable suggestions to carry out our project and her consistent
encouragement throughout the course of our project work.
We extend our hearty thanks to our project guide Mrs.T.Devi for her unstinted support
and guidance besides cooperation during the development of this project.
We profusely thank all the faculty members of department of computer science &
engineering, who have been a source of great help in multiple ways in our venture.
Finally, we owe our special thanks to our parents and friends for their moral support and
care extended during difficult times.
TABLE OF CONTENTS
ABSTRACT i
v
LIST OF FIGURES
LIST OF SYMBOLS vii
xi
LIST OF ABBREVIATIONS
LIST OF TABLES xii
1. CHAPTER 1 : INTRODUCTION
1.1 GENERAL
1.2 OBJECTIVE
1.3 EXISTING SYSTEM
1.4 PROPOSED SYSTEM
1.4.1 PROPOSED SYSTEM ADVANTAGES
2. CHAPTER 2 :PROJECT DESCRIPTION
2.1 METHODOLOGIES
2.1.1 MODULES NAME
2.1.2 MODULES EXPLANATION
2.1.3 MODULE DIAGRAM
3. CHAPTER 3 : REQUIREMENTS
5.3 SERVLETS
5.4 JAVA SERVLETS
CHAPTER 6 : IMPLEMENTATION
6. 6.1 CODING
6.2 DATA BASE TABLE STRUCTURE
7. CHAPTER 7 : SNAPSHOTS
7.1 GENERAL
7.2 VARIOUS SNAPSHOTS
8. CHAPTER 8 : SOFTWARE TESTING
8.1 GENERAL
8.2 DEVELOPING METHODOLOGIES
8.3 TYPES OF TESTING
9. CHAPTER 9 :
APPLICATIONS AND FUTURE ENHANCEMENT
9.1 GENERAL
9.2 APPLICATIONS
9.3 FUTURE ENHANCEMENTS
10 CHAPTER 10 :
10.1 CONCLUSION
10.2 REFERENCES
ABSTRACT:
The question answering system is very hot in natural language processing .users can
propose questions in natural language and get compact and relevant answers rather than relative
documents as done in the search engines. The goal of a question answering system is to retrieve
answers to questions rather than full documents or best-matching passages, as most information
retrieval systems currently do. There are two categories in this system viz: open and closed. The
domain specific QA system involves heavy use of natural language processing systems formalized
by building a domain specific ontology QA research attempts to deal with a wide range of question
types including: fact, list, definition, paragraph and cross-lingual questions. Search collections
vary from small local document collections, internal organization documents to be complied with
newswire reports on the World Wide Web. A QAS returns answer of a user question in concise
form. In order to provide the specific answer, the system must know what precisely a user wants.
The prior knowledge of the estimated answer type helps the QAS to extract correct and precise
answers from the document collection.
LIST OF FIGURES
FIGURE NO NAME OF THE FIGURE PAGE NO.
2.3.2 Module Diagram
LIST OF SYSMBOLS
NOTATION
S.NO NAME NOTATION DESCRIPTION
Class Name
-private -attribute
# protected
+operation
+operation
+operation
5.
Relation uses Used for additional
(uses) process communication.
Extends relationship is
used when one use case is
6. Relation extends
similar to another use
(extends)
case but does a bit more.
Communication between
7. Communication
various use cases.
Represents physical
modules which is a
collection of
14. Component
components.
Represents physical
15. Node modules which are a
collection of
components.
A circle in DFD
represents a state or
16. Data process which has been
triggered due to some
Process/State
event or acion.
Represents external
17. External
entities such as
entity keyboard,sensors,etc.
Represents
Transition
18. communication that
occurs between
processes.
LIST OF ABBREVATION
1. DB DataBase
1.2 OBJECTIVE:
Our system would identify those portions of the knowledge base that are relevant to the
question minimizing the search space and providing exact expected answers to the user.
2.1 METHODOLOGIES
Following modules involves
2.1.1 MODULES
User interface design
Ask query process
Query analysis and user answers
Voting system
User integrated output
Blogger
Register or
Login
Database or
Question and answer
Server
User Login
Ask Question?
User Answer
Data Base
or Server
4. Voting system
Ask Question?
User Answer
Data Base
or Server
Voting System
User Answer
Data
Base
or
Voti No No Server
CHAPTER 3
REQUIREMENTS ENGINEERING
3.1 HARDWARE REQUIREMENTS
The hardware requirements may serve as the basis for a contract for the implementation of
the system and should therefore be a complete and consistent specification of the whole system.
They are used by software engineers as the starting point for the system design. It shows what the
system does and not how it should be implemented.
PROCESSOR : PENTIUM IV 2.6 GHz, Intel Core 2 Duo.
RAM : 512 MB DD RAM
MONITOR : 15” COLOR
HARD DISK : 40 GB
User
Login
Ask Question
Update server
Explanation:
This is a type of behavioral diagram defined by and created from a Use-case analysis. In this UML
diagram we present a actor behavior or role in that project.
4.1.2 CLASS DIAGRAM
User interface
LoginDao_In
terface
Login Dao
String password
String username
loginCheck()
Ask
Voting System
Question
String Text
askQues ()
voting()
Explanation:
This type of static structure diagram that describes the structure of a system by showing the
system’s classes, their attributes, operations (or methods), and the relationships among the classes.
User given query sent to server here user profile was generated. Based on user privacy
customization search it checks whether to personalize search results or not.
Login
Ask Question
username,password
User Answer
Explanation:
This diagram shows how processes operate with one another and in what order. In this
project user given query was matched with user profiles and given to greedy IL after
personalization results given to user.
4.1.5 COLLABORATION DIAGRAM
1: username,password
Verifier
Voting
User System
Answer
Explanation:
In this diagram user given query was sent to server and matched with user profile. Whether data
to be hided depend upon User privacy customization search, results given to user
4.1.6 State diagram
User
Verifier
Ask
Question
Answer
Question
Voting
System
Explanation:
A state diagram is a type of diagram used in computer science and related fields to describe
the behavior of systems. State diagrams require that the system described is composed of a finite
number of states; sometimes, this is indeed the case, while at other times this is a reasonable
abstraction. Here user given query was sent to query analysis and result was filtered. Filtered
results are sent to user
4.1.7 ACTIVITY DIAGRAM
Login
User
Register
Explanation:
In this diagram first we have to create a user profile to user given query. Greedy IL algorithm
generalizes user profiles and depending upon user profile results is personalized. At the end result
was sent to end user. In this diagram represents the behavior of personalization of search results.
4.1.8 COMPONENT DIAGRAM
Interface Package
Operations
Mysql
User Interface
5.5
Tomcat Blogger
Explanation:
This diagram depicts how components are wired together to form larger components. User gives
query in search box server, based on UPS results are filtered. End user receives the personalized
results.
4.1.9 DATA FLOW DIAGRAM
Level-0
User
Login Validate
True
Ask Question
Level-1
Q&A
System
Voting System
4.1.10 E-R DIAGRAM
User
View
or Login
Ask qus
Q&A SYSTEM Answer
system
System
Result
Explanation:
Here sender and receiver is an entity and then password, name and port are all attributes,
then diamond box represents the relationship between the sender and receiver. This diagram
illustrates the relationship between database and entity
4.1.11 SYSTEM ARCHITECTURE
Answer System
Data Base or Server
VS CS Sharing option
Explanation:
User profiles are generalized using greedy IL. The finding motivates us to maintain a priority
queue of candidate prune-leaf operators in descending order of the information loss caused by the
operator. This queue, denoted by Q, enables fast retrieval of the best so- far candidate operator.
Filtering results based on UPS and results are shown to user.
CHAPTER 5
DEVELOPMENT TOOLS
5.1 GENERAL
This chapter is about the software language and the tools used in the development of the project.
The platform used here is JAVA.
5.2 FEATURES OF JAVA
Object Oriented
To be an Object Oriented language, any language must follow at least the four characteristics.
1. Inheritance :It is the process of creating the new classes and using the behavior of the
existing classes by extending them just to reuse the existing code and adding addition a
features as needed.
2. Encapsulation: It is the mechanism of combining the information and providing the
abstraction.
3. Polymorphism: As the name suggest one name multiple form, Polymorphism is the
way of providing the different functionality by thefunctions having the same name based
on the signatures of the methods.
4. Dynamicbinding: Sometimes we don't have the knowledge of objects about their
specific types while writing our code. It is the way of providing the maximum
functionality to a program about the specific type at runtime.
5.2.3 JavaServer Pages - An Overview
Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide
excellent server side scripting support for creating database driven web applications. JSP enable
the developers to directly insert java code into jsp file, this makes the development process very
simple and its maintenance also becomes very easy.
JSP pages are efficient, it loads into the web servers memory on receiving the request very
first time and the subsequent calls are served within a very short period of time.
In today's environment most web sites servers dynamic pages based on user request.
Database is very convenient way to store the data of users and other things. JDBC provide excellent
database connectivity in heterogeneous database environment. Using JSP and JDBC its very
cceasy to develop database driven web application.
Java is known for its characteristic of "write once, run anywhere." JSP pages are
platfJavaServer Pages
JavaServer Pages (JSP) technology is the Java platform technology for delivering dynamic
content to web clients in a portable, secure and well-defined way. The JavaServer Pages
specification extends the Java Servlet API to provide web application developers with a robust
framework for creating dynamic web content on the server using HTML, and XML templates, and
Java code, which is secure, fast, and independent of server platforms.
JSP has been built on top of the Servlet API and utilizes Servlet semantics. JSP has become
the preferred request handler and response mechanism. Although JSP technology is going to be a
powerful successor to basic Servlets, they have an evolutionary relationship and can be used in a
cooperative and complementary manner.
Servlets are powerful and sometimes they are a bit cumbersome when it comes to
generating complex HTML. Most servlets contain a little code that handles application logic and
a lot more code that handles output formatting. This can make it difficult to separate and reuse
portions of the code when a different output format is needed. For these reasons, web application
developers turn towards JSP as their preferred servlet environment.
5.2.4 Evolution of Web Applications
Over the last few years, web server applications have evolved from static to dynamic applications.
This evolution became necessary due to some deficiencies in earlier web site design. For example,
to put more of business processes on the web, whether in business-to-consumer (B2C) or business-
to-business (B2B) markets, conventional web site design technologies are not enough. The main
issues, every developer faces when developing web applications, are:
1. Scalability - a successful site will have more users and as the number of users is increasing
fastly, the web applications have to scale correspondingly.
2. Integration of data and business logic - the web is just another way to conduct business, and so
it should be able to use the same middle-tier and data-access code.
3. Manageability - web sites just keep getting bigger and we need some viable mechanism to
manage the ever-increasing content and its interaction with business systems.
4. Personalization - adding a personal touch to the web page becomes an essential factor to keep
our customer coming back again. Knowing their preferences, allowing them to configure the
information they view, remembering their past transactions or frequent search keywords are all
important in providing feedback and interaction from what is otherwise a fairly one-sided
conversation.
Apart from these general needs for a business-oriented web site, the necessity for new technologies
to create robust, dynamic and compact server-side web applications has been realized. The main
characteristics of today's dynamic web server applications are as follows:
1. Serve HTML and XML, and stream data to the web client
2. Separate presentation, logic and data
3. Interface to databases, other Java applications, CORBA, directory and mail services
4. Make use of application server middleware to provide transactional support.
5. Track client sessions.
5.3Servlets
Earlier in client- server computing, each application had its own client program and it
worked as a user interface and need to be installed on each user's personal computer. Most web
applications use HTML/XHTML that are mostly supported by all the browsers and web pages are
displayed to the client as static documents.
A web page can merely displays static content and it also lets the user navigate through the
content, but a web application provides a more interactive experience.
Any computer running Servlets or JSP needs to have a container. A container is nothing
but a piece of software responsible for loading, executing and unloading the Servlets and JSP.
While servlets can be used to extend the functionality of any Java- enabled server.
They are mostly used to extend web servers, and are efficient replacement for CGI scripts.
CGI was one of the earliest and most prominent server side dynamic content solutions, so before
going forward it is very important to know the difference between CGI and the Servlets.
6.1 CODING
home.jsp
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="com.DBConnection.DBConnection"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="com.impl.QuestionProcessImpl"%>
<%@page import="com.interfaces.QuesandAns"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Qus&&Ans</title>
</head>
<div id="top">
<div id="topc">
<a href="Login.jsp" style="color: white;" id="bg1">Log in</a>
<a href="Register.jsp" style="color: white;">Sign up</a>
</div>
</div>
<script >
function link() {
window.location.replace('http://localhost:8080/OwnConcept/Register.jsp');
}
</script>
<body>
<div id="nav">
<div id="navcontent">
<button id="bg" >Question</button>
<button id="bg">User</button>
</div>
<div id="navsignup">
<h4>Jcup Overflow is a community of 1.7 million programmers, just like you, helping each
other. Join them; it only takes a minute:</h4><button id="ss" onclick="link();">Sign
up</button>
</div>
<%
DBConnection con=new DBConnection();
Connection conn=con.con();
ResultSet rs=null;
Statement st=conn.createStatement();
rs=st.executeQuery("SELECT * FROM quesandans.metatablekey m");
%>
<div id="navqus1">
<table>
<%while(rs.next()){ %>
<tr ><td></td><td></td><td></td><td align="center" style=" border-style: ridge; border-color:
#FFA6FF;background-color: white;"><%=rs.getString(3) %><br>
Vote</td><td></td><td></td><td></td>
<td align="center" style="border-style: ridge; background-color: white;border-color:
#FFA6FF;color: blue;font-weight: bold;"><%=rs.getString(7) %><br>
answer</td><td></td><td></td><td></td>
<td align="center" style="border-style: ridge;background-color:white;"><%=rs.getString(4)
%><br> views</td></tr>
<%} %>
</table>
</div>
<div id="navqus">
<table>
<%
Statement st1=conn.createStatement();
ResultSet r1=st1.executeQuery("SELECT * FROM quesandans.metatablekey m");
while(r1.next()){ %>
<tr><td style="border-bottom-style: ridge; width: 800px;"><h3><a
href="viewcount.jsp?qusid=<%=r1.getString(1)%>"><%=r1.getString(2) %></a></h3></td><td
style="border-bottom-style:ridge; color: blue;">Posted by <%=r1.getString(6) %></tr>
<%} %>
</table>
</div>
</div>
</body>
</html>
Login.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="css/structure.css" rel="stylesheet" type="text/css" />
<link href="css/login.css" rel="stylesheet" type="text/css" />
<title>Qus&&Ans</title>
</head>
<div id="top">
<div id="topc">
<a href="Login.jsp" style="color: white;">Sign in</a>
<a href="Register.jsp" style="color: white;">Sign up</a>
</div>
</div>
<body>
<div id="nav">
<div id="navcontent">
<button id="bg">Question</button>
<button id="bg">User</button>
<button id="bg">Question</button>
<button id="bg">Question</button>
<button id="bg">Question</button>
</div>
<div id="logins">
</div>
</div>
<div id="loginb">
<div id="loginicon">
<br>
<a href="www.google.com">
<img alt="" src="Images/g+.JPG"></a>
Or
<a href="www.facebook.com"><img alt="" src="Images/facebook.JPG"></a>
</div>
<form action="Login" method="post">
<div id="logininput">
<label>Email</label><br>
<input type="text" name="email" placeholder="ram@gmail.com">
<br><br>
<label>Password</label><br>
<input type="password" name="pass" placeholder="*********">
<br><br>
<input type="submit" value="Log in">
</div>
</form>
</body>
<body>
</body>
</html>
Login.java
package com.controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.BeanClass.UserBean;
import com.impl.Implementaion;
import com.interfaces.UserInter;
/**
* Servlet implementation class Login
*/
@WebServlet("/Login")
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Login() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
System.out.println("This is login page servlet");
String email=request.getParameter("email");
String pass=request.getParameter("pass");
UserBean ubean=new UserBean();
ubean.setEmail(email);
ubean.setPass(pass);
UserInter in=new Implementaion();
ArrayList< String > al=new ArrayList<>();
al=in.login(ubean);
if(al.size()>0){
String uname=al.get(0);
String uid=al.get(2);
response.sendRedirect("Userhome.jsp?uname="+uname+"&&uid="+uid);
}
}
}
NewTable.java
package com.Servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.BeanClass.ImageDetails;
import com.Implementation.Implementaion;
import com.Interface.ISearchInterface;
/**
* Servlet implementation class NewTable
*/
@WebServlet("/NewTable")
public class NewTable extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public NewTable() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
String tablename=request.getParameter("tname");
ImageDetails ibean=new ImageDetails();
ibean.setFilename(tablename);
ISearchInterface in=new Implementaion();
int i=in.newtable(ibean);
if(i==1){response.sendRedirect("home.jsp");}else{response.sendRedirect("error.jsp");}
}
}
UploadFile.java
package com.Servlet;
import java.beans.beancontext.BeanContext;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.BeanClass.ImageDetails;
import com.Implementation.Implementaion;
import com.Interface.ISearchInterface;
import com.oreilly.servlet.multipart.FilePart;
import com.oreilly.servlet.multipart.MultipartParser;
import com.oreilly.servlet.multipart.ParamPart;
import com.oreilly.servlet.multipart.Part;
@WebServlet("/UploadFile")
public class UploadFile extends HttpServlet {
private static final long serialVersionUID = 1L;
public UploadFile() {
super();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String fileToupload = null;
int imagesiz = 0, rank = 0;
double insert = 0;
String fileName = null;
MultipartParser mp = new MultipartParser(request, 999999999);
Part part = null;
FilePart filePart = null;
ParamPart paramPart = null;
// Bean Class
ImageDetails ibean = new ImageDetails();
// Interface process
ISearchInterface inter = new Implementaion();
while ((part = mp.readNextPart()) != null) {
fileToupload = getServletContext().getRealPath("/");
System.out.println(fileToupload);
// bean.setPath(fileToupload);
System.out.println(fileToupload);
fileToupload = fileToupload.substring(0, fileToupload.indexOf("."))
+ "I-iSearch\\WebContent\\Imagestorage\\";
if (part.isFile()) {
filePart = (FilePart) part;
fileName = filePart.getFileName();
fileToupload = fileToupload + fileName;
System.out.println(fileToupload + "&**(()))");
File file = new File(fileToupload);
String absolutepath = file.getAbsolutePath();
System.out.println(absolutepath + "absolutepath");
// fileToupload = fileToupload + "\\" +fileName ;
File uploadedFile = new File(absolutepath);
double fileSize = filePart.writeTo(uploadedFile);
/*
* long round=Math.round(fileSize); long imagesize=round/1024;
* int imagesiz=(int) imagesize;
*/
imagesiz = (int) fileSize;
// bean.setFileSize1(fileSize);
System.out.println(" fileSize = " + fileSize);
} else if (part.isParam()) {
paramPart = (ParamPart) part;
String tagName = paramPart.getName();
System.out.println("tagName = " + tagName);
String tagValue = paramPart.getStringValue();
rank=Integer.parseInt(tagValue);
System.out.println("tagValue = " + rank);
ibean.setImagerank(rank);
ArrayList<String> paramValues = new ArrayList<String>();
paramValues.add(tagValue);
System.out.println(paramValues.size() + "arrayvalue");
ibean.setImagesdetail(paramValues);
}
}
// calling interface
ibean.setImagerank(rank);
ibean.setFilename(fileName);
ibean.setImagesize(imagesiz);
ibean.setPath(fileToupload);
insert = inter.imagedetail(ibean);
if (insert > 0) {
RequestDispatcher rd = request
.getRequestDispatcher("Store.jsp");
rd.forward(request, response);
} else {
RequestDispatcher rd = request.getRequestDispatcher("error.jsp");
rd.forward(request, response);
}
}
}
Implementation.java
package com.Implementation;
import java.beans.beancontext.BeanContext;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import com.BeanClass.ImageDetails;
import com.DBConnection.DBConnection;
import com.Interface.ISearchInterface;
publicclass Implementaion implements ISearchInterface
{
static DBConnection connection=new DBConnection();
Connection con=null;
PreparedStatement ps=null,ps1=null,ps2=null;
String iname=null;
publicint imagedetail(ImageDetails ibean)
{
int i=0,size,size1;
size=ibean.getImagesize();
size1=size/1024;
ArrayList< String>arr=new ArrayList<>();
String id=ibean.getFilename();
System.out.println("output"+id);
try {
System.out.println("ImageDteial");
con =connection.con();
if(id.charAt(0)=='a'){
ps=con.prepareStatement("INSERT INTO
isearch.apple(imagename,imagesize,initialrank,dynamiccount) VALUES(?,?,?,?)");
}
elseif(id.charAt(0)=='b'){ps=con.prepareStatement("INSERT INTO
isearch.bird(imagename,imagesize,initialrank,dynamiccount) VALUES(?,?,?,?)");}
elseif(id.charAt(0)=='o'){ps=con.prepareStatement("INSERT INTO
isearch.orange(imagename,imagesize,initialrank,dynamiccount) VALUES(?,?,?,?)");}
elseif(id.charAt(0)=='m'){ps=con.prepareStatement("INSERT INTO
isearch.mango(imagename,imagesize,initialrank,dynamiccount) VALUES(?,?,?,?)");}
elseif(id.charAt(0)=='k'){ps=con.prepareStatement("INSERT INTO isearch.abdul
kalam(imagename,imagesize,initialrank,dynamiccount) VALUES(?,?,?,?)");}
elseif(id.charAt(0)=='s'){ps=con.prepareStatement("INSERT INTO isearch.steve
jobs(imagename,imagesize,initialrank,dynamiccount) VALUES(?,?,?,?)");}
ps.setString(1, ibean.getFilename());
ps.setInt(2,size1);
ps.setInt(3,ibean.getImagerank());
ps.setInt(4, 0);
i=ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return i;
}
@Override
publicint newtable(ImageDetails ibean) {
// TODO Auto-generated method stub
Statement stmt;
int i=0;
try {
con=connection.con();
PreparedStatement st;
stmt = con.createStatement();
st=con.prepareStatement("INSERT INTO isearch.imagecollection VALUES(?)");
st.setString(1, ibean.getFilename());
String sql = "CREATE TABLE " +ibean.getFilename()+
"(imagename VARCHAR(45) not NULL, " +
" imagesize INTEGER(45), " +
" initialrank INTEGER(45), " +
" dynamiccount INTEGER(45), " +
" PRIMARY KEY (imagename ))";
i=st.executeUpdate();
stmt.executeUpdate(sql);
System.out.println("%^^%^^%"+i);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return i;
}
@Override
publicint refresh(String refreshdate) {
// TODO Auto-generated method stub
int i=0;
try {
con=connection.con();
ps=con.prepareStatement("UPDATE isearch.operation o SET refreshdate='"+refreshdate+"'
where id=1");
i=ps.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return i;
}
@Override
publicint delete(String refreshdate) {
int j=0;
try {
iname=refreshdate;
int i=0;
ResultSet rs=null,rs1=null;
con=connection.con();
ps=con.prepareStatement("SELECT imagename, min(dynamiccount) FROM
isearch."+refreshdate+ " GROUP BY imagename");
rs=ps.executeQuery();
while(rs.next()){i=rs.getInt(2);
iname=rs.getString(1);
File file=newFile("D:\\WORKSPACE1(2015-2016)\\I-
iSearch\\WebContent\\Imagestorage\\"+iname);
file.delete();
}
ps1=con.prepareStatement("DELETE FROM isearch."+refreshdate+ " WHERE
dynamiccount="+i);
j=ps1.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return j;
}
@Override
public String getdate() {
String date=null;
ResultSet rs;
try {
con=connection.con();
ps=con.prepareStatement("SELECT refreshdate FROM isearch.operation where id=1");
rs=ps.executeQuery();
while(rs.next()){date=rs.getString(1);}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return date;
}
}
Index.html
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>
<linkhref="css/style.css"rel="stylesheet"type="text/css"/>
<linkrel="stylesheet"type="text/css"href="styles.css"/>
<scripttype="text/javascript"src="js/jquery-1.4.2.min.js"></script>
<scriptsrc="js/jquery.autocomplete.js"></script>
<script>
jQuery(function() {
$("#s").keyup(function() {
$("#disjunctive").autocomplete("list.jsp");
var value = "";
$.ajax({
url :"autocontroller.jsp?q=" + $("#s").val(),
//type: "post",
data : value,
cache :false,
success :function(data) {
//alert(data);
$('#msg_Display').html(data);
}
});
});
$("#s").change(function() {
});
});
</script>
<title>i Search</title>
</head>
<body>
<divid="page">
<formaction="dyanamicsearch.jsp">
<divid="searchForm">
<fieldset>
<br><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><imgsrc="img/i2.gif"width="200"height="150"
class="under"/><imgsrc="img/i10.png"width="220"height="200"class="over"/>
<imgsrc="img/i3.gif"width="150"height="200"class="row"/>
<inputtype="text"name="disjunctive"id="s"id="country"/>
<inputtype="submit"value="search"id="submitButton"/>
<divid="msg_Display"></div>
</fieldset>
</div>
</form>
</div>
</body>
</html>
Agenthome.jsp
<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@pageimport="java.sql.*"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WCSST 19</title>
<metahttp-equiv="Content-type"content="text/html; charset=utf-8"/>
<linkrel="shortcut icon"type="image/x-icon"
href="css/images/favicon.ico"/>
<linkrel="stylesheet"href="css/style.css"type="text/css"media="all"/>
<linkrel="stylesheet"href="css/prettyCheckboxes.css"type="text/css"
media="all"/>
<linkrel="stylesheet"href="css/customScroller.css"type="text/css"
media="all"/>
<scriptsrc="js/jquery-1.4.2.js"type="text/javascript"></script>
<scriptsrc="js/prettyCheckboxes.js"type="text/javascript"></script>
<scriptsrc="js/jquery.customScroller-1.2.js"type="text/javascript"></script>
<scriptsrc="js/js-func.js"type="text/javascript"></script>
<!--[if IE 6]>
<link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" />
<script src="js/png-fix.js" type="text/javascript"></script>
<![endif]-->
<scripttype="text/javascript"src='js/jquery.min.js'></script>
</head>
<script>function startTime() {
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('txt').innerHTML = h+":"+m+":"+s;
vart = setTimeout(function(){startTime()},500);
}
function checkTime(i) {
if (i<10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}</script>
<bodyonload="startTime()">
<!-- START PAGE SOURCE -->
<divclass="shell">
<divclass="gallery">
<divclass="gallery-t">
<divclass="gallery-head">
<divclass="category">
<ahref="#">Category</a>
<divclass="dd-holder">
<divclass="dd-t"></div>
<divclass="dd">
<divclass="dd-inner">
</div>
<divclass="cl"> </div>
</div>
<divclass="dd-b"></div>
</div>
</div>
<divclass="sort-by">
<h3>Time:</h3>
<divclass="custom-checkboxes">
<formaction="#"method="post">
<fontcolor:"red"> <divid="txt">
</div></font>
</form>
<divclass="cl"> </div>
</div>
<divclass="cl"> </div>
</div>
<divclass="cl"> </div>
</div>
<divclass="gallery-holder">
<divclass="gallery-content">
<ul>
<%
String name = request.getParameter("disjunctive").toString();
// String
url="http://www.google.co.in/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1366&bi
h=667&q="+name+"&oq=ap&gs_l=img.1.0.0l10.3415.4554.0.5850.2.2.0.0.0.0.139.235.1j1.2.0..
..0...1ac.1.64.img..0.2.234.RvDonERYvIY";
//response.sendRedirect(url);
session.setAttribute("mainkey", name);
System.out.print("######"+name);
String iname=null;
int Size=0;
ResultSet rs=null;
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/isearch", "root",
"root");
PreparedStatement st=con.prepareStatement("select imagename,imagesize,dynamiccount from
isearch."+name+ " order by dynamiccount desc");
rs=st.executeQuery();
while(rs.next())
{
%>
<li><ahref="#"><img
src="Imagestorage/<%=iname=rs.getString(1) %>"width="110"
height="110"alt=""/></a>
<divclass="image-hover">
<h6>Size:<%=Size=rs.getInt(2) %></h6>
<a>Most View:<%=Size=rs.getInt(3) %></a>
<ahref="count.jsp?lol=<%=iname=rs.getString(1) %>">click me</a>
</div></li>
<%} %>
</ul>
<divclass="gallery-b"> </div>
</div>
</div>
</div>
</div>
</div>
<divclass="footer">
<pclass="lf">
Copyright © 2010 <ahref="#">SiteName</a> - All Rights Reserved
</p>
<pclass="rf">
Design by <ahref="http://www.websitecsstemplates.com/"
target="_blank">WebsiteCSSTemplates</a>
</p>
<divstyle="clear: both;"></div>
</div>
<!-- END PAGE SOURCE -->
</body>
</html>
CHAPTER 7
VARIOUS SNAPSHOTS
7.1 General
Snapshot is nothing but every moment of the application while running. It gives the clear
elaborated of application. It will be useful for the new user to understand for the future steps.
7.2VARIOUS SNAPSHOTS
SNAPSHOT 1
Home Page:
START UP PAGE
RUN
SIGN UP
LOG IN
POSTING QUESTION
POSTING ANSWER
COMMENTS(LIKES &DISLIKES)
8.3Types of Tests
Any project can be divided into units that can be further performed for detailed processing.
Then a testing strategy for each of this unit is carried out. Unit testing helps to identity the possible
bugs in the individual component, so the component that has bugs can be identified and can be
rectified from errors.
CHAPTER 9
APPLICATION
9.1 GENERAL
9.2 APPLICATIONS
10.1 CONCLUSION
10.2 REFERENCE:
[1]P. Mell and T. Grance, “The NIST definition of cloud computing (draft),” NIST Special
Publication, vol. 800, p. 145, 2011.
[2] S. De Capitani di Vimercati, S. Foresti, and P. Samarati, “Managing and accessing data in the
cloud: Privacy risks and approaches,” in Proc. 7th Int. Conf. Risk Security Internet Syst., 2012,pp.
1–9.1272 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 27,
NO. 5, MAY 2015
[3] P. Williams, R. Sion, and B. Carbunar, “Building castles out of mud: Practical access pattern
privacy and correctness on UN trusted storage,” in Proc. 15th ACM Conf. Compute. Common.
Security, 2008, pp. 139–148.
[4] P. Paillier, “Public key cryptosystems based on composite degree residuosity classes,” in Proc.
17th Int. Conf. Theory Appl. Cryptographic Techn., 1999, pp. 223–238.
[5] B. K. Samanthula, Y. Elmehdwi, and W. Jiang, “k-nearest neighborclassification over
semantically secure encrypted relational data,”eprint arXiv:1403.5001, 2014.
[6] C. Gentry, “Fully homomorphic encryption using ideal lattices,”in Proc. 41st Annu. ACM
Sympos. Theory Comput., 2009, pp. 169–178.
[7] C. Gentry and S. Halevi, “Implementing gentry’s fully-homomorphic encryption scheme,” in
Proc. 30th Annu. Int. Conf. Theory Appl. Cryptographic Techn.: Adv. Cryptol., 2011, pp. 129–
148.
[8] A. Shamir, “How to share a secret,” Commun. ACM, vol. 22,pp. 612–613, 1979.
[9] D. Bogdanov, S. Laur, and J. Willemson, “Sharemind: A framework for fast privacy-preserving
computations,” in Proc. 13th Eur.Symp. Res. Comput. Security: Comput. Security, 2008, pp. 192–
206.
[10] R. Agrawal and R. Srikant, “Privacy-preserving data mining,”ACM Sigmod Rec., vol. 29, pp.
439–450, 2000.
[11] Y. Lindell and B. Pinkas, “Privacy preserving data mining,” inProc.20th Annu. Int. Cryptol.
Conf. Adv. Cryptol., 2000, pp. 36–54.
[12] P. Zhang, Y. Tong, S. Tang, and D. Yang, “Privacy preserving Naive Bayes classification,”
in Proc. 1st Int. Conf. Adv. Data Mining Appl., 2005, pp. 744–752.