changeset 25:97b249d9fad1

fix infinite loop on getConsensus Action
author one
date Wed, 03 Oct 2012 03:40:51 +0900
parents 81d1d7c7bcde
children ad7cfb1f9d03
files app/controllers/Claim.java app/controllers/User.java app/models/ClaimModel.java app/models/TPGraph.java app/models/UserModel.java conf/routes logs/application.log target/scala-2.9.1/cache/compile/compile target/streams/compile/compile/$global/out test/RequestTest.java
diffstat 10 files changed, 133 insertions(+), 216 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/Claim.java	Wed Oct 03 01:46:43 2012 +0900
+++ b/app/controllers/Claim.java	Wed Oct 03 03:40:51 2012 +0900
@@ -40,10 +40,56 @@
 		tpGraph.setLabelToUsers(newClaim, users, NodeModel.L_REQUEST);
 		tpGraph.setLabelToRootClaim(newClaim);
 		
-		
 		return created();
 	}
 	
+	@BodyParser.Of(BodyParser.Json.class)
+	public static Result createMention(String mentionType, String id) {
+
+		if ( !(mentionType.equals(NodeModel.L_QUESTION) 
+			||mentionType.equals(NodeModel.L_REFUTATION)
+			||mentionType.equals(NodeModel.L_QUESTION))) {
+			return badRequest("Wrong mention type.");
+		}
+			
+		JsonNode json = request().body().asJson();
+		String author = json.findPath(NodeModel.L_AUTHOR).getTextValue(); // Author
+
+		TPGraph tpGraph = TPGraph.getInstance();
+		Graph graph = tpGraph.getGraph();
+		if ( graph.getVertex(author) == null) 
+			return badRequest("Author "+ author + "is not exist.");
+		
+		JsonNode toulmin = json.findPath(NodeModel.TOULMIN);
+		if (toulmin.findPath(NodeModel.TITLE) == null) 
+			return badRequest("Please set title");
+
+		JsonNode usersJson = json.get(NodeModel.USERS); // Users (class JsonNode) 
+		String type = json.findPath(NodeModel.TYPE).getTextValue(); // Type (majority|unanimously)		
+		
+		ClaimModel newClaim = new ClaimModel(graph.addVertex(null));
+		tpGraph.setLabelToAuthor(newClaim, author);
+		newClaim.setClaimProperties(toulmin, type);
+
+		String[] users = toStringArray(usersJson);
+		tpGraph.setLabelToUsers(newClaim, users, NodeModel.L_REQUEST);
+		tpGraph.setLabelToRootClaim(newClaim);
+
+		ClaimModel mentionV = new ClaimModel(graph.getVertex(id));
+		tpGraph.setLabelMention(mentionV, newClaim, mentionType);
+
+		return created();
+	}
+	
+	private static Result checkClaimData() {
+		
+		
+		return ok();
+	}
+	
+	
+	
+	
 	private static String[] toStringArray(JsonNode jsonNode) {
 		int length = jsonNode.size();
 		if (length == 0) return null;
--- a/app/controllers/User.java	Wed Oct 03 01:46:43 2012 +0900
+++ b/app/controllers/User.java	Wed Oct 03 03:40:51 2012 +0900
@@ -40,7 +40,7 @@
 			return notFound();
 		} else {
 			UserModel user = new UserModel(v);
-			HashMap<Object, Object[]> hash = user.getUserInfo(tpGraph);
+			HashMap<Object, Object[]> hash = user.getUserInfo();
 			return created(Json.toJson(hash));
 		}
 	}
--- a/app/models/ClaimModel.java	Wed Oct 03 01:46:43 2012 +0900
+++ b/app/models/ClaimModel.java	Wed Oct 03 03:40:51 2012 +0900
@@ -39,6 +39,10 @@
 		setProperty(MENTIONS, null);
 		setProperty(STATUS, FAIL); // Default Status is fail.
 		setProperty(TOULMIN, t);
+	}
+	
+	public void setClaimMention(String label) {
+		
 		
 	}
 
--- a/app/models/TPGraph.java	Wed Oct 03 01:46:43 2012 +0900
+++ b/app/models/TPGraph.java	Wed Oct 03 03:40:51 2012 +0900
@@ -3,6 +3,7 @@
 import java.util.HashSet;
 import java.util.Iterator;
 
+import com.tinkerpop.blueprints.Edge;
 import com.tinkerpop.blueprints.Graph;
 import com.tinkerpop.blueprints.Vertex;
 import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
@@ -73,29 +74,29 @@
 		return graph.getVertex(userRootId);
 	}
 
-	private void setLabel(Vertex fromV, Vertex toV, String label) {
-		graph.addEdge(null, fromV, toV, label);		
+	private Edge setLabel(Vertex fromV, Vertex toV, String label) {
+		return graph.addEdge(null, fromV, toV, label);		
 	}
 	
-	public void setLabelToRootUser(UserModel user) {
+	public Edge setLabelToRootUser(UserModel user) {
 		Vertex rootUser = getUserRootVertex(); 
 
 		//  rootUser ---child---> newUser
-		setLabel(rootUser, user.getVertex(), CHILD);
+		return setLabel(rootUser, user.getVertex(), CHILD);
 	}
 
-	public void setLabelToRootClaim(ClaimModel claim) {
+	public Edge setLabelToRootClaim(ClaimModel claim) {
 		Vertex rootClaim = getClaimRootVertex(); 
 
 		//  rootUser ---child---> newUser
-		setLabel(rootClaim, claim.getVertex(), CHILD);
+		return setLabel(rootClaim, claim.getVertex(), CHILD);
 	}
 	
-	public void setLabelToAuthor(ClaimModel claim, String author) {
+	public Edge setLabelToAuthor(ClaimModel claim, String author) {
 		Vertex authorVertex = graph.getVertex(author);
 
 		//  claim ---author---> authorVertex(userVertex)
-		setLabel(claim.getVertex(), authorVertex, NodeModel.L_AUTHOR);
+		return setLabel(claim.getVertex(), authorVertex, NodeModel.L_AUTHOR);
 	}
 	
 	public Boolean setLabelToUsers(ClaimModel claim, String[] users, String label) {
@@ -107,15 +108,21 @@
 		return true;
 	}
 	
+	public Edge setLabelMention(ClaimModel fromClaim, ClaimModel toClaim, String label) {
+		return setLabel(fromClaim.getVertex(), toClaim.getVertex(), label);		
+	}
+	
 	public Object[] checkConsensus(HashSet<Object> set) {
 		Iterator<Object> iter = set.iterator();
 		while(iter.hasNext()) {
 			Object childId = iter.next();
+			System.out.println("childId = "+childId);
 			Object parentId;
 			while ( (parentId = checkUpperVertex(childId)) != null){
 				if (set.contains(parentId)) {
 					set.remove(childId);
 					iter = set.iterator();
+					childId = parentId;
 					continue;
 				}
 				childId = parentId;
--- a/app/models/UserModel.java	Wed Oct 03 01:46:43 2012 +0900
+++ b/app/models/UserModel.java	Wed Oct 03 03:40:51 2012 +0900
@@ -55,7 +55,8 @@
 	}
 	 */
 	
-	public HashMap<Object,Object[]> getUserInfo(TPGraph tpGraph) {
+	public HashMap<Object,Object[]> getUserInfo() {
+		TPGraph tpGraph = TPGraph.getInstance();
 		Object[] requests = getUserRequests();
 		Object[] claims = getUserClaims();
 		HashMap<Object,Object[]> hash = new HashMap<Object, Object[]>();
--- a/conf/routes	Wed Oct 03 01:46:43 2012 +0900
+++ b/conf/routes	Wed Oct 03 03:40:51 2012 +0900
@@ -11,7 +11,7 @@
 GET		/users/claims/:name		controllers.User.getUserClaims(name: String)
 
 POST	/claims/create			controllers.Claim.crateClaim()
-
+POST	/claims/:mentionType/:id/create			controllers.Claim.createMention(mentionType: String ,id: String)
 
 # test action
 POST	   /hello				controllers.Application.hello()
--- a/logs/application.log	Wed Oct 03 01:46:43 2012 +0900
+++ b/logs/application.log	Wed Oct 03 03:40:51 2012 +0900
@@ -1,128 +1,12 @@
-2012-10-02 22:48:04,594 - [INFO] - from play in main 
+2012-10-03 03:39:11,946 - [INFO] - from play in main 
 Listening for HTTP on port 9000...
 
-2012-10-02 22:48:09,777 - [INFO] - from play in play-akka.actor.default-dispatcher-1 
-Application started (Dev)
-
-2012-10-02 22:49:44,225 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 22:49:44,238 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
-2012-10-02 23:10:27,284 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:10:27,300 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
-2012-10-02 23:22:42,479 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:22:42,494 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
+2012-10-03 03:39:18,488 - [INFO] - from play in play-akka.actor.default-dispatcher-1 
 Application started (Dev)
 
-2012-10-02 23:22:42,883 - [ERROR] - from application in play-akka.actor.actions-dispatcher-8 
-
-
-! @6bpch86jn - Internal server error, for request [GET /users/consensus/yosiaki] ->
-
-play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NullPointerException: null]]
-	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.3]
-	at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
-	at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.3]
-	at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
-	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
-	at akka.dispatch.Mailbox.run(Mailbox.scala:179) [akka-actor.jar:2.0.2]
-	at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [akka-actor.jar:2.0.2]
-Caused by: java.lang.NullPointerException: null
-	at models.UserModel.getUserConsensus(UserModel.java:41) ~[classes/:na]
-	at controllers.User.getUserConsensus(User.java:70) ~[classes/:na]
-	at Routes$$anonfun$routes$1$$anonfun$apply$9$$anonfun$apply$10.apply(routes_routing.scala:96) ~[classes/:na]
-	at Routes$$anonfun$routes$1$$anonfun$apply$9$$anonfun$apply$10.apply(routes_routing.scala:96) ~[classes/:na]
-	at play.core.Router$HandlerInvoker$$anon$4$$anon$1.invocation(Router.scala:1086) ~[play_2.9.1.jar:2.0.3]
-	at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:33) ~[play_2.9.1.jar:2.0.3]
-	at play.GlobalSettings$1.call(GlobalSettings.java:57) ~[play_2.9.1.jar:2.0.3]
-	at play.core.j.JavaAction$class.apply(JavaAction.scala:74) ~[play_2.9.1.jar:2.0.3]
-	at play.core.Router$HandlerInvoker$$anon$4$$anon$1.apply(Router.scala:1085) ~[play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play_2.9.1.jar:2.0.3]
-	at play.utils.Threads$.withContextClassLoader(Threads.scala:17) ~[play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:125) [play_2.9.1.jar:2.0.3]
-	... 11 common frames omitted
-
-2012-10-02 23:23:50,595 - [ERROR] - from application in play-akka.actor.actions-dispatcher-8 
-
-
-! @6bpch86jo - Internal server error, for request [GET /users/consensus/takaaki] ->
-
-play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NullPointerException: null]]
-	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.3]
-	at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
-	at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.3]
-	at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
-	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
-	at akka.dispatch.Mailbox.run(Mailbox.scala:179) [akka-actor.jar:2.0.2]
-	at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) [akka-actor.jar:2.0.2]
-	at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [akka-actor.jar:2.0.2]
-Caused by: java.lang.NullPointerException: null
-	at models.UserModel.getUserConsensus(UserModel.java:41) ~[classes/:na]
-	at controllers.User.getUserConsensus(User.java:70) ~[classes/:na]
-	at Routes$$anonfun$routes$1$$anonfun$apply$9$$anonfun$apply$10.apply(routes_routing.scala:96) ~[classes/:na]
-	at Routes$$anonfun$routes$1$$anonfun$apply$9$$anonfun$apply$10.apply(routes_routing.scala:96) ~[classes/:na]
-	at play.core.Router$HandlerInvoker$$anon$4$$anon$1.invocation(Router.scala:1086) ~[play_2.9.1.jar:2.0.3]
-	at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:33) ~[play_2.9.1.jar:2.0.3]
-	at play.GlobalSettings$1.call(GlobalSettings.java:57) ~[play_2.9.1.jar:2.0.3]
-	at play.core.j.JavaAction$class.apply(JavaAction.scala:74) ~[play_2.9.1.jar:2.0.3]
-	at play.core.Router$HandlerInvoker$$anon$4$$anon$1.apply(Router.scala:1085) ~[play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play_2.9.1.jar:2.0.3]
-	at play.utils.Threads$.withContextClassLoader(Threads.scala:17) ~[play_2.9.1.jar:2.0.3]
-	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:125) [play_2.9.1.jar:2.0.3]
-	... 11 common frames omitted
-
-2012-10-02 23:25:18,100 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
+2012-10-03 03:40:19,534 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
 Application shutdown...
 
-2012-10-02 23:25:18,113 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
-2012-10-02 23:26:56,118 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:26:56,131 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
-2012-10-02 23:28:11,987 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:28:12,010 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
+2012-10-03 03:40:19,554 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
 Application started (Dev)
 
-2012-10-02 23:28:40,691 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:28:40,704 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
-2012-10-02 23:29:01,665 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:29:01,686 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
-2012-10-02 23:31:25,581 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
-Application shutdown...
-
-2012-10-02 23:31:25,594 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
-Application started (Dev)
-
Binary file target/scala-2.9.1/cache/compile/compile has changed
--- a/target/streams/compile/compile/$global/out	Wed Oct 03 01:46:43 2012 +0900
+++ b/target/streams/compile/compile/$global/out	Wed Oct 03 03:40:51 2012 +0900
@@ -1,48 +0,0 @@
-[info] Compiling 3 Java sources to /Users/aotokage/workspace/Consensus/target/scala-2.9.1/classes...
-[error] /Users/aotokage/workspace/Consensus/app/models/UserModel.java:55: cannot find symbol
-[error] symbol  : method getUserConsensus()
-[error] location: class models.UserModel
-[error] 		hash.put(NodeModel.CONSENSUS, getUserConsensus());
-[error] 		                              ^
-[error] 1 error
-javac returned nonzero exit code
-	at sbt.compiler.JavaCompiler$$anon$1.apply(JavaCompiler.scala:26)
-	at sbt.AggressiveCompile$$anonfun$5$$anonfun$compileJava$1$1.apply$mcV$sp(AggressiveCompile.scala:76)
-	at sbt.classfile.Analyze$.apply(Analyze.scala:93)
-	at sbt.AggressiveCompile$$anonfun$5.compileJava$1(AggressiveCompile.scala:75)
-	at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:79)
-	at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:57)
-	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:21)
-	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:19)
-	at sbt.inc.Incremental$.cycle(Incremental.scala:33)
-	at sbt.inc.Incremental$.compile(Incremental.scala:20)
-	at sbt.inc.IncrementalCompile$.apply(Compile.scala:17)
-	at sbt.AggressiveCompile.compile2(AggressiveCompile.scala:87)
-	at sbt.AggressiveCompile.compile1(AggressiveCompile.scala:41)
-	at sbt.AggressiveCompile.apply(AggressiveCompile.scala:28)
-	at sbt.Compiler$.apply(Compiler.scala:107)
-	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
-	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
-	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
-	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
-	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
-	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
-	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
-	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
-	at sbt.std.Transform$$anon$5.work(System.scala:67)
-	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
-	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
-	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
-	at sbt.Execute.work(Execute.scala:227)
-	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
-	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
-	at sbt.CompletionService$$anon$1$$anon$2.call(CompletionService.scala:26)
-	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
-	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
-	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
-	at java.lang.Thread.run(Thread.java:680)
-[error] {file:/Users/aotokage/workspace/Consensus/}Consensus/compile:compile: javac returned nonzero exit code
--- a/test/RequestTest.java	Wed Oct 03 01:46:43 2012 +0900
+++ b/test/RequestTest.java	Wed Oct 03 03:40:51 2012 +0900
@@ -1,3 +1,7 @@
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Iterator;
+
 import javax.ws.rs.core.MediaType;
 
 import models.NodeModel;
@@ -6,7 +10,9 @@
 import org.json.JSONObject;
 
 import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientHandlerException;
 import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.WebResource;
 
 
@@ -22,42 +28,66 @@
 		createUser(user2);
 		createUser(user3);
 
+		
+		
 		String[] users = {user2,user3};
 		createClaim(user1, users);
 		createClaim(user1, users);
-/*
-		HashSet<Object> set = new HashSet<Object>();
-		set.add("1");
-		set.add("2");
-		set.add("3");
-		Iterator<Object> iter = set.iterator();
-		while (iter.hasNext() ) {
-			Object o = iter.next();
-			System.out.println("o = "+o);
-		}
+
+		getUser(user1);
+		getUserInfo(user1,"claims/");
+
+
+		String[] users2 = {user1};
+
+		createMention(user2, users2, NodeModel.L_QUESTION, "5");
+		createMention(user3, users2, NodeModel.L_REFUTATION, "5");
 
-		Iterator<Object> iter2 = set.iterator();
-		while (iter2.hasNext() ) {
-			Object o = iter2.next();
-			System.out.println("o = "+o);
-			if (set.remove("2")) {
-				iter2 = set.iterator();
-			}
-		}*/
+		createMention(user2, users2, NodeModel.L_QUESTION, "10");
+		createMention(user3, users2, NodeModel.L_REFUTATION, "10");
+
+
+		getUserInfo(user1,"claims/");
+		getUserInfo(user1,"consensus/");
+		getUserInfo(user1,"requests/");
+
+		getUserInfo(user2,"claims/");
+		getUserInfo(user2,"consensus/");
 		
-/*
-		getUser(user1);
-		getUserInfo(user2,"claims/");
-*/
-
-		getUserInfo(user2,"requests/");
-		getUserInfo(user3,"requests/");
-//		getUserInfo(user3,"claims/");
+		getUserInfo(user3,"claims/");
 		getUserInfo(user3,"consensus/");
 
+/*		
+		getUserInfo(user3,"requests/");
+		getUserInfo(user3,"claims/");
+		getUserInfo(user2,"consensus/");
+		getUserInfo(user3,"consensus/");
+*/
+	}
+
+	public static void createMention(String author, String[] users, String type, Object id) throws JSONException {
+		JSONObject jobj = createClaimParameter(author, users);
+		final String uri = SERVER_ROOT_URI + "/claims/"+type+"/"+id+"/create";
+		WebResource resource = Client.create().resource(uri);
+		ClientResponse response = resource.header("Content-type",MediaType.APPLICATION_JSON)
+				.entity(jobj.toString())
+				.post(ClientResponse.class);
+		System.out.println(String.format("POST on [%s], status code [%d]", uri, response.getStatus()));
+		System.out.println(response.getEntity(String.class));		
 	}
 	
 	public static void createClaim(String author, String[] users) throws JSONException {
+		JSONObject jobj = createClaimParameter(author, users);
+		final String uri = SERVER_ROOT_URI + "/claims/create";
+		WebResource resource = Client.create().resource(uri);
+		ClientResponse response = resource.header("Content-type",MediaType.APPLICATION_JSON)
+				.entity(jobj.toString())
+				.post(ClientResponse.class);
+		System.out.println(String.format("POST on [%s], status code [%d]", uri, response.getStatus()));
+		System.out.println(response.getEntity(String.class));		
+	}
+	
+	public static JSONObject createClaimParameter(String author, String[] users) throws JSONException {
 		JSONObject toulmin = new JSONObject();
 		toulmin.put(NodeModel.TITLE, "アプリでGraphDBを利用する。");
 		toulmin.put(NodeModel.CONTENTS, "最近話題のデータベースとしてGraphDBがある。我々のアプリでは、新しい技術のためにもGraphDBを利用したい。");
@@ -72,18 +102,11 @@
 		jobj.put(NodeModel.L_AUTHOR, author);
 		jobj.put(NodeModel.USERS,users);
 		jobj.put(NodeModel.TYPE, "unanimously");
-
-		final String uri = SERVER_ROOT_URI + "/claims/create";
-		WebResource resource = Client.create().resource(uri);
-		ClientResponse response = resource.header("Content-type",MediaType.APPLICATION_JSON)
-				.entity(jobj.toString())
-				.post(ClientResponse.class);
-		System.out.println(String.format("POST on [%s], status code [%d]", uri, response.getStatus()));
-		System.out.println(response.getEntity(String.class));		
+		return jobj;
 		
 	}
 	
-	public static void getUserInfo(String name, String preUri) {
+	public static void getUserInfo(String name, String preUri) throws ClientHandlerException, UniformInterfaceException, JSONException {
 		final String uri = SERVER_ROOT_URI + "/users/"+preUri+name;
 		WebResource resource = Client.create().resource(uri);
 		ClientResponse response = resource.get(ClientResponse.class);
@@ -100,7 +123,7 @@
 		
 	}
 
-	public static void getUser(String name) {
+	public static void getUser(String name) throws ClientHandlerException, UniformInterfaceException, JSONException {
 		final String uri = SERVER_ROOT_URI + "/users/browse/"+name;
 		WebResource resource = Client.create().resource(uri);
 		ClientResponse response = resource.get(ClientResponse.class);