Index: BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLQueryBuilderImpl.java
===================================================================
--- BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLQueryBuilderImpl.java (revision 20)
+++ BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLQueryBuilderImpl.java (revision 22)
@@ -6,5 +6,4 @@
 import java.util.HashSet;
 import java.util.Set;
-
 
 import com.hp.hpl.jena.query.Query;
@@ -19,4 +18,5 @@
 /**
  * 繧ｯ繧ｨ繝ｪ繧堤函謌舌☆繧九◆繧√�讖溯�繧呈署萓帙☆繧区ｸ繧ｯ繝ｩ繧ｹ
+ * 
  * @author Norio KOBAYASHI
  * @since 28.01.2014
@@ -28,9 +28,9 @@
 	private String endpointURI = null;
 
-	
 	/**
 	 * 繧｢繧ｯ繧ｻ繧ｹ縺吶ｋSPARQL endpoint縺ｮURI繧呈欠螳壹☆繧区ｧ区�蟄�
 	 * 
-	 * @param endpointURI縲繧｢繧ｯ繧ｻ繧ｹ縺吶ｋSPARQL endpoint縺ｮURI
+	 * @param endpointURI
+	 *            縲繧｢繧ｯ繧ｻ繧ｹ縺吶ｋSPARQL endpoint縺ｮURI
 	 * @throws Exception
 	 * @since 28.01.2014
@@ -45,69 +45,61 @@
 	 * 繧ｯ繧ｨ繝ｪ繝薙Ν繝繝ｼ縺ｮ譛ｬ逡ｪ繝励Ο繧ｰ繝ｩ繝縺ｧ縺ｯ縺薙�繝｡繧ｽ繝�ラ縺ｯ菴ｿ逕ｨ縺励↑縺�
 	 * </p>
-	 * @param args 菴ｿ逕ｨ縺励↑縺�
+	 * 
+	 * @param args
+	 *            菴ｿ逕ｨ縺励↑縺�
 	 * @throws Exception
 	 * @since 28.01.2014
 	 */
 	public static void main(String[] args) throws Exception {
-		String sparqlEndpoint = "http://dbpedia.org/sparql";
-		String keyword = "artiste";
+		// String sparqlEndpoint = "http://dbpedia.org/sparql";
+		String sparqlEndpoint = "http://lsd.dbcls.jp/sparql";
+		// String keyword = "artiste";
+		String keyword = "Agent";
 		String[] graphURIs = new String[0];
 
 		OWLQueryBuilder builder = new OWLQueryBuilderImpl(sparqlEndpoint);
 		SClass[] clz = builder.getOWLClasses(graphURIs, keyword);
-		for(SClass cls: clz){
+		for (SClass cls : clz) {
 			System.out.println(cls);
 		}
 
-		System.out.println("CLS");
-		ClassLink[] cls = builder.getNextClass(null, clz[0].getClassURI(), 0, false);
-		if( cls != null ){
-			for( ClassLink cl: cls){
-				System.out.println(cl.toString());
-			}
-		}
-
-		System.out.println("CLS-INS");
-		cls = builder.getNextClassViaInstanceLink(null, clz[0].getClassURI(), 100);
-		if( cls != null ){
-			for( ClassLink cl: cls){
-				System.out.println(cl.toString());
-			}
-		}
-
-		System.out.println("Instances");
-		Instance[] ins = builder.getInstances(null, "\"A.C. Reed\"@en");
-		if( ins != null ){
-			for( Instance in: ins){
-				System.out.println(in.toString());
-			}
-		}
-
-		
-		System.out.println("INS-INS");
-		ins = builder.getInstances(null, "\"A.C. Reed\"@en");
-		InstanceLink[] iLinks = builder.getNextInstancesViaInstanceLink(null, ins[0].getInstanceURI(), 100);
-		
-
-		
-		if( iLinks != null ){
-			for( InstanceLink in: iLinks){
-				System.out.println(in.toString());
-			}
-		}
-		
-		
-	}
-
-	
+		/*
+		 * System.out.println("CLS"); ClassLink[] cls =
+		 * builder.getNextClass(null, clz[0].getClassURI(), 0, false); if( cls
+		 * != null ){ for( ClassLink cl: cls){
+		 * System.out.println(cl.toString()); } }
+		 * 
+		 * System.out.println("CLS-INS"); cls =
+		 * builder.getNextClassViaInstanceLink(null, clz[0].getClassURI(), 100);
+		 * if( cls != null ){ for( ClassLink cl: cls){
+		 * System.out.println(cl.toString()); } }
+		 * 
+		 * System.out.println("Instances"); Instance[] ins =
+		 * builder.getInstances(null, "\"A.C. Reed\"@en"); if( ins != null ){
+		 * for( Instance in: ins){ System.out.println(in.toString()); } }
+		 * 
+		 * 
+		 * System.out.println("INS-INS"); ins = builder.getInstances(null,
+		 * "\"A.C. Reed\"@en"); InstanceLink[] iLinks =
+		 * builder.getNextInstancesViaInstanceLink(null,
+		 * ins[0].getInstanceURI(), 100);
+		 * 
+		 * 
+		 * 
+		 * if( iLinks != null ){ for( InstanceLink in: iLinks){
+		 * System.out.println(in.toString()); } }
+		 */
+	}
+
 	/**
 	 * 譏守､ｺ逧�↓RDF縺ｧ譖ｸ縺九ｌ縺ｦ縺�ｋ繧ｯ繝ｩ繧ｹ繧貞叙蠕励☆繧�
 	 * <p>
-	 * 謖�ｮ壹＆繧後◆graphURIs縺ｮ荳ｭ縺九ｉ縲√く繝ｼ繝ｯ繝ｼ繝峨↓繝偵ャ繝医☆繧九Λ繝吶Ν繧呈戟縺､繧ｯ繝ｩ繧ｹ��dfs:Class�峨ｒ縺吶∋縺ｦ霑斐☆
-	 * <br>
+	 * 謖�ｮ壹＆繧後◆graphURIs縺ｮ荳ｭ縺九ｉ縲√く繝ｼ繝ｯ繝ｼ繝峨↓繝偵ャ繝医☆繧九Λ繝吶Ν繧呈戟縺､繧ｯ繝ｩ繧ｹ��dfs:Class�峨ｒ縺吶∋縺ｦ霑斐☆ <br>
 	 * </p>
 	 * 
-	 * @param graphURIs縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� (null繧�聞縺�縺ｮ驟榊�繧ょ庄)
-	 * @param keyword ��ull繧�ｩｺ譁�ｭ励�荳榊庄��
+	 * @param graphURIs
+	 *            縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� (null繧�聞縺�縺ｮ驟榊�繧ょ庄)
+	 * @param keyword
+	 *            ��ull繧�ｩｺ譁�ｭ励�荳榊庄��
 	 * @return 繧ｯ繝ｩ繧ｹURI縺ｮ驟榊�
 	 * @throws Exception
@@ -129,5 +121,5 @@
 		}
 		queryStr.append("WHERE{\n");
-		
+
 		queryStr.append(" {?c rdf:type rdfs:Class} UNION {?c rdf:type owl:Class}\n");
 
@@ -136,17 +128,17 @@
 		queryStr.append("      ?i rdf:type ?c.\n");
 
-//		queryStr.append("      ?c rdfs:label ");
-//		queryStr.append(keyword);
-//		queryStr.append(".");
-
-		queryStr.append("  FILTER (\n"); 
+		// queryStr.append("      ?c rdfs:label ");
+		// queryStr.append(keyword);
+		// queryStr.append(".");
+
+		queryStr.append("  FILTER (\n");
 		queryStr.append("    REGEX( ?label , \"");
 		queryStr.append(keyword);
 		queryStr.append("\" , \"i\" )\n");
-		queryStr.append("  )"); 
+		queryStr.append("  )");
 		queryStr.append("\n}  GROUP BY ?c ?pLabel");
 
-// System.out.println(queryStr.toString());
-		
+		System.out.println(queryStr.toString());
+
 		Query query = QueryFactory.create(queryStr.toString());
 		QueryExecution qexec = QueryExecutionFactory.sparqlService(endpointURI,
@@ -154,25 +146,26 @@
 
 		ResultSet results = qexec.execSelect();
-		HashMap<String,SClass> classMap = new HashMap<String,SClass>();
+		HashMap<String, SClass> classMap = new HashMap<String, SClass>();
 		for (; results.hasNext();) {
 			QuerySolution sol = results.next();
 			Resource res = sol.getResource("c");
-			String uri = res.getURI();
-			int numOfInstances = sol.getLiteral("numOfInstances").getInt();
-//System.out.println(numOfInstances);
-			Literal labelLiteral = sol.getLiteral("pLabel");
-			SClass sClass = null;
-			if( classMap.containsKey(uri)){
-				sClass = classMap.get(uri);
-			}
-			else{
+			if (res != null) {
+				String uri = res.getURI();
+				int numOfInstances = sol.getLiteral("numOfInstances").getInt();
+				// System.out.println(numOfInstances);
+				Literal labelLiteral = sol.getLiteral("pLabel");
+				SClass sClass = null;
+				if (classMap.containsKey(uri)) {
+					sClass = classMap.get(uri);
+				} else {
 					sClass = new SClass(uri, null, numOfInstances);
 					classMap.put(uri, sClass);
-			}
-				if( labelLiteral != null ){
+				}
+				if (labelLiteral != null) {
 					String label = labelLiteral.getString();
 					String lang = labelLiteral.getLanguage();
 					sClass.addLabel(new Label(label, lang));
 				}
+			}
 		}
 		qexec.close();
@@ -180,16 +173,15 @@
 	}
 
-
 	/**
-	 *縲繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ繧貞叙蠕励☆繧�
+	 * 縲繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ繧貞叙蠕励☆繧�
 	 * <p>
-	 * 謖�ｮ壹＆繧後◆graphURIs縺ｮ荳ｭ縺九ｉ縲√く繝ｼ繝ｯ繝ｼ繝峨↓繝偵ャ繝医☆繧九Λ繝吶Ν繧呈戟縺､繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ繧偵☆縺ｹ縺ｦ霑斐☆
-	 * <br>
-	 * 縺薙％縺ｧ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ縺ｯ縲〉df:type縺ｮ荳ｻ隱槭→縺励※險倩ｿｰ縺輔ｌ縺ｦ縺�ｋ繧ゅ�繧偵＞縺�
-	 * <br>
+	 * 謖�ｮ壹＆繧後◆graphURIs縺ｮ荳ｭ縺九ｉ縲√く繝ｼ繝ｯ繝ｼ繝峨↓繝偵ャ繝医☆繧九Λ繝吶Ν繧呈戟縺､繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ繧偵☆縺ｹ縺ｦ霑斐☆ <br>
+	 * 縺薙％縺ｧ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ縺ｯ縲〉df:type縺ｮ荳ｻ隱槭→縺励※險倩ｿｰ縺輔ｌ縺ｦ縺�ｋ繧ゅ�繧偵＞縺�<br>
 	 * </p>
 	 * 
-	 * @param graphURIs縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� (null繧�聞縺�縺ｮ驟榊�繧ょ庄)
-	 * @param keyword ��ull繧�ｩｺ譁�ｭ励�荳榊庄��
+	 * @param graphURIs
+	 *            縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� (null繧�聞縺�縺ｮ驟榊�繧ょ庄)
+	 * @param keyword
+	 *            ��ull繧�ｩｺ譁�ｭ励�荳榊庄��
 	 * @return 繧ｯ繝ｩ繧ｹURI縺ｮ驟榊�
 	 * @throws Exception
@@ -211,7 +203,6 @@
 		}
 		queryStr.append("WHERE{\n");
-//		queryStr.append(" {?c rdf:type rdfs:Class} UNION {?c rdf:type owl:Class}\n");
-
-		
+		// queryStr.append(" {?c rdf:type rdfs:Class} UNION {?c rdf:type owl:Class}\n");
+
 		queryStr.append("      ?ins rdf:type ?c.\n");
 		queryStr.append("      ?ins rdfs:label ");
@@ -220,7 +211,7 @@
 		queryStr.append(" FILTER (?c != rdf:Property)");
 		queryStr.append("}");
-				
-// System.out.println(queryStr.toString());
-		
+
+		// System.out.println(queryStr.toString());
+
 		Query query = QueryFactory.create(queryStr.toString());
 		QueryExecution qexec = QueryExecutionFactory.sparqlService(endpointURI,
@@ -235,8 +226,8 @@
 			String clsURI = cls.getURI();
 			String insURI = ins.getURI();
-			if( instanceMap.containsKey(insURI)){
+			if (instanceMap.containsKey(insURI)) {
 				HashSet<String> classes = instanceMap.get(insURI);
 				classes.add(clsURI);
-			}else{
+			} else {
 				HashSet<String> classes = new HashSet<String>();
 				instanceMap.put(insURI, classes);
@@ -247,6 +238,7 @@
 		Set<String> keySet = instanceMap.keySet();
 		ArrayList<Instance> instanceList = new ArrayList<Instance>();
-		for(String key: keySet){
-			Instance ins = new Instance(key, instanceMap.get(key).toArray(new String[0]));
+		for (String key : keySet) {
+			Instance ins = new Instance(key, instanceMap.get(key).toArray(
+					new String[0]));
 			instanceList.add(ins);
 		}
@@ -254,17 +246,18 @@
 	}
 
-	
 	/**
-	 *縲謖�ｮ壹＆繧後◆繧ｯ繝ｩ繧ｹ繧定ｵｷ轤ｹ縺ｨ縺励∵�遉ｺ逧�↓險倩ｿｰ縺輔ｌ縺ｦ縺�ｋOWL縺ｮproperty蛻ｶ邏�ｒ隱ｿ縺ｹ縲√◎縺ｮproperty蛻ｶ邏�〒
+	 * 縲謖�ｮ壹＆繧後◆繧ｯ繝ｩ繧ｹ繧定ｵｷ轤ｹ縺ｨ縺励∵�遉ｺ逧�↓險倩ｿｰ縺輔ｌ縺ｦ縺�ｋOWL縺ｮproperty蛻ｶ邏�ｒ隱ｿ縺ｹ縲√◎縺ｮproperty蛻ｶ邏�〒
 	 * 髢｢騾｣縺･縺代ｉ繧後※縺�ｋ繧ｯ繝ｩ繧ｹ繧堤ｶｲ鄒�噪縺ｫ蜿門ｾ励☆繧�
 	 * <p>
-	 * 蜃ｦ逅�ｯｾ雎｡繝��繧ｿ繧暖raphURIs縺ｧ謖�ｮ壹☆繧九％縺ｨ縺後〒縺阪ｋ
-	 * <br>
+	 * 蜃ｦ逅�ｯｾ雎｡繝��繧ｿ繧暖raphURIs縺ｧ謖�ｮ壹☆繧九％縺ｨ縺後〒縺阪ｋ <br>
 	 * <br>
 	 * </p>
 	 * 
-	 * @param graphURIs縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� 縲(null繧�聞縺�縺ｮ驟榊�繧ょ庄)
-	 * @param originClass 襍ｷ轤ｹ縺ｨ縺ｪ繧九け繝ｩ繧ｹ縺ｮURI縲��ull荳榊庄��
-	 * @param limit 隗｣縺ｨ縺励※霑斐＆繧後ｋClassLink驟榊�縺ｮ髟ｷ縺輔�荳企剞蛟､繧呈欠螳壹☆繧九�荳企剞蛟､繧定ｨｭ螳壹＠縺ｪ縺�ｴ蜷医�0莉･荳九�蛟､繧呈欠螳壹☆繧�
+	 * @param graphURIs
+	 *            縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� 縲(null繧�聞縺�縺ｮ驟榊�繧ょ庄)
+	 * @param originClass
+	 *            襍ｷ轤ｹ縺ｨ縺ｪ繧九け繝ｩ繧ｹ縺ｮURI縲��ull荳榊庄��
+	 * @param limit
+	 *            隗｣縺ｨ縺励※霑斐＆繧後ｋClassLink驟榊�縺ｮ髟ｷ縺輔�荳企剞蛟､繧呈欠螳壹☆繧九�荳企剞蛟､繧定ｨｭ螳壹＠縺ｪ縺�ｴ蜷医�0莉･荳九�蛟､繧呈欠螳壹☆繧�
 	 * @return ClassLink縺ｮ驟榊�縲ゅ％縺薙↓縺ｯ縲∝叙蠕励＆繧後◆繧ｯ繝ｩ繧ｹ縺ｨ髢｢菫ゅ▼縺代ｉ繧後※縺�ｋ繝励Ο繝代ユ繧｣縲�未菫ゅ�蜷代″縺悟性縺ｾ繧後ｋ縲�
 	 * @throws Exception
@@ -279,11 +272,10 @@
 
 		// SELECT
-		if( countLinks ){
-				queryStr.append("SELECT DISTINCT ?p ?pDirection ?c (COUNT(?s) AS ?numOfLinks) \n");
-		}
-		else{
+		if (countLinks) {
+			queryStr.append("SELECT DISTINCT ?p ?pDirection ?c (COUNT(?s) AS ?numOfLinks) \n");
+		} else {
 			queryStr.append("SELECT DISTINCT ?p ?pDirection ?c \n");
 		}
-		
+
 		if (graphURIs != null) {
 			for (String graphURI : graphURIs) {
@@ -299,8 +291,8 @@
 		queryStr.append(">.\n    ?p rdfs:range ?c.\n");
 
-		if( countLinks ){
-				queryStr.append("    ?o ?p ?s.");
-		}
-		
+		if (countLinks) {
+			queryStr.append("    ?o ?p ?s.");
+		}
+
 		queryStr.append("}\n  UNION\n");
 		queryStr.append("  { ?p rdfs:range <");
@@ -309,22 +301,20 @@
 		queryStr.append("    ?p rdfs:domain ?c.\n");
 
-		if( countLinks ){
-				queryStr.append("    ?s ?p ?o.");
-		}
-		
+		if (countLinks) {
+			queryStr.append("    ?s ?p ?o.");
+		}
+
 		queryStr.append("}\n");
 
 		queryStr.append("    ?p ?pDirection ?c.\n");
 
-		
 		queryStr.append("  ?s rdf:type ?c.\n");
 
-		if( countLinks){
+		if (countLinks) {
 			queryStr.append("  ?o rdf:type <");
 			queryStr.append(originClass);
 			queryStr.append(">.\n");
 			queryStr.append("}\nGROUP BY ?p ?pDirection ?c\n");
-		}
-		else{
+		} else {
 			queryStr.append("}\n");
 		}
@@ -334,7 +324,7 @@
 			queryStr.append("\n");
 		}
-		
-		System.out.println(queryStr.toString());	
-	
+
+		System.out.println(queryStr.toString());
+
 		Query query = QueryFactory.create(queryStr.toString());
 		QueryExecution qexec = QueryExecutionFactory.sparqlService(endpointURI,
@@ -346,52 +336,59 @@
 			QuerySolution sol = results.next();
 			Resource pro = sol.getResource("p");
-			Resource cls = sol.getResource("c");
-			Resource dir = sol.getResource("pDirection");
-			String proURI = pro.getURI();
-			String clsURI = cls.getURI();
-			String dirURI = dir.getURI();
-
-// 			System.out.println(pro.getURI() + " " + cls.getURI() + " " + dir.getURI());
-			
-			
-			Direction direction = null;
-			if( dirURI.equals("http://www.w3.org/2000/01/rdf-schema#domain") || dirURI.equals("rdfs:domain")){
-				direction = Direction.reverse;
-			}
-			if( dirURI.equals("http://www.w3.org/2000/01/rdf-schema#range") || dirURI.equals("rdfs:range")){
-				if( direction != null ){
-					direction = Direction.both;
-				}else{
-				direction = Direction.forward;
+			if (pro != null) {
+				Resource cls = sol.getResource("c");
+				Resource dir = sol.getResource("pDirection");
+				String proURI = pro.getURI();
+				String clsURI = cls.getURI();
+				String dirURI = dir.getURI();
+
+				// System.out.println(pro.getURI() + " " + cls.getURI() + " " +
+				// dir.getURI());
+
+				Direction direction = null;
+				if (dirURI
+						.equals("http://www.w3.org/2000/01/rdf-schema#domain")
+						|| dirURI.equals("rdfs:domain")) {
+					direction = Direction.reverse;
 				}
-			}
-//			System.out.println(direction);
-			int numOfLinks = sol.getLiteral("numOfLinks").getInt();
-			ClassLink cl = new ClassLink(proURI, clsURI, direction, numOfLinks);
-			solCLs.add(cl);
+				if (dirURI.equals("http://www.w3.org/2000/01/rdf-schema#range")
+						|| dirURI.equals("rdfs:range")) {
+					if (direction != null) {
+						direction = Direction.both;
+					} else {
+						direction = Direction.forward;
+					}
+				}
+				// System.out.println(direction);
+				int numOfLinks = sol.getLiteral("numOfLinks").getInt();
+				ClassLink cl = new ClassLink(proURI, clsURI, direction,
+						numOfLinks);
+				solCLs.add(cl);
+			}
 		}
 		qexec.close();
 		return solCLs.toArray(new ClassLink[0]);
 	}
-	
-	
+
 	/**
-	 *縲謖�ｮ壹＆繧後◆繧ｯ繝ｩ繧ｹ繧定ｵｷ轤ｹ縺ｨ縺励√◎縺ｮ繧ｯ繝ｩ繧ｹ縺ｫ螻槭＠縺ｦ縺�ｋ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ繝ｪ繝ｳ繧ｯ縺悟ｼｵ繧峨ｌ縺ｦ縺�ｋ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ髮�粋繧貞叙蠕励＠縲∝叙蠕励＠縺溘う繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ繧ｯ繝ｩ繧ｹ繧堤ｶｲ鄒�噪縺ｫ蜿門ｾ励☆繧�
+	 * 縲謖�ｮ壹＆繧後◆繧ｯ繝ｩ繧ｹ繧定ｵｷ轤ｹ縺ｨ縺励√◎縺ｮ繧ｯ繝ｩ繧ｹ縺ｫ螻槭＠縺ｦ縺�ｋ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ繝ｪ繝ｳ繧ｯ縺悟ｼｵ繧峨ｌ縺ｦ縺�ｋ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ髮�粋繧貞叙蠕励＠縲�
+	 * 蜿門ｾ励＠縺溘う繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ繧ｯ繝ｩ繧ｹ繧堤ｶｲ鄒�噪縺ｫ蜿門ｾ励☆繧�
 	 * <p>
-	 * 縺薙％縺ｧ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ縺ｯ縲〉df:type縺ｮ荳ｻ隱槭→縺励※險倩ｿｰ縺輔ｌ縺ｦ縺�ｋ繧ゅ�繧偵＞縺�
-	 * <br>
-	 * 蜃ｦ逅�ｯｾ雎｡繝��繧ｿ繧暖raphURIs縺ｧ謖�ｮ壹☆繧九％縺ｨ縺後〒縺阪ｋ
-	 * <br>
+	 * 縺薙％縺ｧ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ縺ｯ縲〉df:type縺ｮ荳ｻ隱槭→縺励※險倩ｿｰ縺輔ｌ縺ｦ縺�ｋ繧ゅ�繧偵＞縺�<br>
+	 * 蜃ｦ逅�ｯｾ雎｡繝��繧ｿ繧暖raphURIs縺ｧ謖�ｮ壹☆繧九％縺ｨ縺後〒縺阪ｋ <br>
 	 * </p>
 	 * 
-	 * @param graphURIs縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� 縲(null繧�聞縺�縺ｮ驟榊�繧ょ庄)
-	 * @param originClass 襍ｷ轤ｹ縺ｨ縺ｪ繧九け繝ｩ繧ｹ縺ｮURI縲��ull荳榊庄��
-	 * @param limit 隗｣縺ｨ縺励※霑斐＆繧後ｋClassLink驟榊�縺ｮ髟ｷ縺輔�荳企剞蛟､繧呈欠螳壹☆繧九�荳企剞蛟､繧定ｨｭ螳壹＠縺ｪ縺�ｴ蜷医�0莉･荳九�蛟､繧呈欠螳壹☆繧�
+	 * @param graphURIs
+	 *            縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� 縲(null繧�聞縺�縺ｮ驟榊�繧ょ庄)
+	 * @param originClass
+	 *            襍ｷ轤ｹ縺ｨ縺ｪ繧九け繝ｩ繧ｹ縺ｮURI縲��ull荳榊庄��
+	 * @param limit
+	 *            隗｣縺ｨ縺励※霑斐＆繧後ｋClassLink驟榊�縺ｮ髟ｷ縺輔�荳企剞蛟､繧呈欠螳壹☆繧九�荳企剞蛟､繧定ｨｭ螳壹＠縺ｪ縺�ｴ蜷医�0莉･荳九�蛟､繧呈欠螳壹☆繧�
 	 * @return ClassLink縺ｮ驟榊�縲ゅ％縺薙↓縺ｯ縲∝叙蠕励＆繧後◆繧ｯ繝ｩ繧ｹ縺ｨ髢｢菫ゅ▼縺代ｉ繧後※縺�ｋ繝励Ο繝代ユ繧｣縲�未菫ゅ�蜷代″縺悟性縺ｾ繧後ｋ縲�
 	 * @throws Exception
 	 * @since 28.01.2014
 	 */
-	public ClassLink[] getNextClassViaInstanceLink(String[] graphURIs, String originClass,
-			int limit) throws Exception {
+	public ClassLink[] getNextClassViaInstanceLink(String[] graphURIs,
+			String originClass, int limit) throws Exception {
 		StringBuffer queryStr = new StringBuffer();
 		queryStr.append("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n");
@@ -418,7 +415,7 @@
 			queryStr.append("\n");
 		}
-		
-//		System.out.println(queryStr.toString());	
-	
+
+		// System.out.println(queryStr.toString());
+
 		Query query = QueryFactory.create(queryStr.toString());
 		QueryExecution qexec = QueryExecutionFactory.sparqlService(endpointURI,
@@ -434,18 +431,18 @@
 			Direction direction = null;
 			String propURI = null;
-			if( proForward != null ){
-				if( proReverse != null ){
+			if (proForward != null) {
+				if (proReverse != null) {
 					direction = Direction.both;
-				}else{
+				} else {
 					direction = Direction.forward;
 				}
 				propURI = proForward.getURI();
-			}else{
+			} else {
 				direction = Direction.reverse;
 				propURI = proReverse.getURI();
 			}
 			String clsURI = cls.getURI();
-//			System.out.println(propURI + " " + clsURI + " " + direction);
-			
+			// System.out.println(propURI + " " + clsURI + " " + direction);
+
 			ClassLink cl = new ClassLink(propURI, clsURI, direction, 0);
 			solCLs.add(cl);
@@ -455,6 +452,4 @@
 	}
 
-	
-	
 	public Path[] getPaths(String startClass, String endClass) throws Exception {
 		OWLClassGraph graph = new OWLClassGraph(startClass, endClass);
@@ -466,46 +461,40 @@
 	}
 
-
-	
-	
-/*
-	private String executeSelect(String sparqlQuery) throws Exception {
-		HttpClient client = HttpClientBuilder.create().build();
-		HttpPost httppost = new HttpPost(endpointURI);
-		httppost.setHeader("Content-Type", "application/x-www-form-urlencoded");
-		httppost.setHeader("Accept", "application/sparql-results+xml");
-		List<NameValuePair> nvpList = new ArrayList<NameValuePair>();
-		nvpList.add(new BasicNameValuePair("query", sparqlQuery));
-		// nvpList.add(new BasicNameValuePair("format",
-		// outputFormat.getMime()));
-		httppost.setEntity(new UrlEncodedFormEntity(nvpList, Charset
-				.forName("UTF-8")));
-		HttpResponse response = client.execute(httppost);
-		// System.out.println("[StatusLine] " + response.getStatusLine());
-		HttpEntity entity = response.getEntity();
-		String entityString = EntityUtils.toString(entity, "UTF-8");
-		return entityString;
-	}
-*/
-	
+	/*
+	 * private String executeSelect(String sparqlQuery) throws Exception {
+	 * HttpClient client = HttpClientBuilder.create().build(); HttpPost httppost
+	 * = new HttpPost(endpointURI); httppost.setHeader("Content-Type",
+	 * "application/x-www-form-urlencoded"); httppost.setHeader("Accept",
+	 * "application/sparql-results+xml"); List<NameValuePair> nvpList = new
+	 * ArrayList<NameValuePair>(); nvpList.add(new BasicNameValuePair("query",
+	 * sparqlQuery)); // nvpList.add(new BasicNameValuePair("format", //
+	 * outputFormat.getMime())); httppost.setEntity(new
+	 * UrlEncodedFormEntity(nvpList, Charset .forName("UTF-8"))); HttpResponse
+	 * response = client.execute(httppost); //
+	 * System.out.println("[StatusLine] " + response.getStatusLine());
+	 * HttpEntity entity = response.getEntity(); String entityString =
+	 * EntityUtils.toString(entity, "UTF-8"); return entityString; }
+	 */
+
 	/**
-	 *縲謖�ｮ壹＆繧後◆繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ繧定ｵｷ轤ｹ縺ｨ縺励√◎縺ｮ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｫ繝ｪ繝ｳ繧ｯ縺悟ｼｵ繧峨ｌ縺ｦ縺�ｋ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ髮�粋繧貞叙蠕励☆繧九�
-	 *縲蜿門ｾ励＆繧後◆蜷�う繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ繧ｯ繝ｩ繧ｹ繧らｶｲ鄒�噪縺ｫ蜿門ｾ励☆繧�
+	 * 縲謖�ｮ壹＆繧後◆繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ繧定ｵｷ轤ｹ縺ｨ縺励√◎縺ｮ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｫ繝ｪ繝ｳ繧ｯ縺悟ｼｵ繧峨ｌ縺ｦ縺�ｋ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ髮�粋繧貞叙蠕励☆繧九�
+	 * 縲蜿門ｾ励＆繧後◆蜷�う繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮ繧ｯ繝ｩ繧ｹ繧らｶｲ鄒�噪縺ｫ蜿門ｾ励☆繧�
 	 * <p>
-	 * 縺薙％縺ｧ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ縺ｯ縲〉df:type縺ｮ荳ｻ隱槭→縺励※險倩ｿｰ縺輔ｌ縺ｦ縺�ｋ繧ゅ�繧偵＞縺�
-	 * <br>
-	 * 蜃ｦ逅�ｯｾ雎｡繝��繧ｿ繧暖raphURIs縺ｧ謖�ｮ壹☆繧九％縺ｨ縺後〒縺阪ｋ
-	 * <br>
+	 * 縺薙％縺ｧ繧､繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｨ縺ｯ縲〉df:type縺ｮ荳ｻ隱槭→縺励※險倩ｿｰ縺輔ｌ縺ｦ縺�ｋ繧ゅ�繧偵＞縺�<br>
+	 * 蜃ｦ逅�ｯｾ雎｡繝��繧ｿ繧暖raphURIs縺ｧ謖�ｮ壹☆繧九％縺ｨ縺後〒縺阪ｋ <br>
 	 * </p>
 	 * 
-	 * @param graphURIs縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� 縲(null繧�聞縺�縺ｮ驟榊�繧ょ庄)
-	 * @param originInstance 襍ｷ轤ｹ縺ｨ縺ｪ繧九う繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮURI縲��ull荳榊庄��
-	 * @param limit 隗｣縺ｨ縺励※霑斐＆繧後ｋInstanceLink驟榊�縺ｮ髟ｷ縺輔�荳企剞蛟､繧呈欠螳壹☆繧九�荳企剞蛟､繧定ｨｭ螳壹＠縺ｪ縺�ｴ蜷医�0莉･荳九�蛟､繧呈欠螳壹☆繧�
+	 * @param graphURIs
+	 *            縲讀懃ｴ｢蟇ｾ雎｡縺ｮgraph縺ｮURI驟榊� 縲(null繧�聞縺�縺ｮ驟榊�繧ょ庄)
+	 * @param originInstance
+	 *            襍ｷ轤ｹ縺ｨ縺ｪ繧九う繝ｳ繧ｹ繧ｿ繝ｳ繧ｹ縺ｮURI縲��ull荳榊庄��
+	 * @param limit
+	 *            隗｣縺ｨ縺励※霑斐＆繧後ｋInstanceLink驟榊�縺ｮ髟ｷ縺輔�荳企剞蛟､繧呈欠螳壹☆繧九�荳企剞蛟､繧定ｨｭ螳壹＠縺ｪ縺�ｴ蜷医�0莉･荳九�蛟､繧呈欠螳壹☆繧�
 	 * @return InstanceLink縺ｮ驟榊�縲ゅ％縺薙↓縺ｯ縲∝叙蠕励＆繧後◆繧ｯ繝ｩ繧ｹ縺ｨ髢｢菫ゅ▼縺代ｉ繧後※縺�ｋ繝励Ο繝代ユ繧｣縲�未菫ゅ�蜷代″縺悟性縺ｾ繧後ｋ縲�
 	 * @throws Exception
 	 * @since 28.01.2014
 	 */
-	public InstanceLink[] getNextInstancesViaInstanceLink(String[] graphURIs, String originInstance,
-			int limit) throws Exception {
+	public InstanceLink[] getNextInstancesViaInstanceLink(String[] graphURIs,
+			String originInstance, int limit) throws Exception {
 		StringBuffer queryStr = new StringBuffer();
 		queryStr.append("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n");
@@ -521,5 +510,5 @@
 		}
 		queryStr.append("WHERE{\n");
-//		queryStr.append("  { ?c rdf:type rdfs:Class. }\n  UNION\n  { ?c rdf:type owl:Class. }\n");
+		// queryStr.append("  { ?c rdf:type rdfs:Class. }\n  UNION\n  { ?c rdf:type owl:Class. }\n");
 		queryStr.append("  ?ins rdf:type ?c.\n");
 		queryStr.append("  { ?ins ?pr <");
@@ -537,7 +526,7 @@
 			queryStr.append("\n");
 		}
-		
-//		System.out.println(queryStr.toString());	
-	
+
+		// System.out.println(queryStr.toString());
+
 		Query query = QueryFactory.create(queryStr.toString());
 		QueryExecution qexec = QueryExecutionFactory.sparqlService(endpointURI,
@@ -554,12 +543,12 @@
 			Direction direction = null;
 			String propURI = null;
-			if( proForward != null ){
-				if( proReverse != null ){
+			if (proForward != null) {
+				if (proReverse != null) {
 					direction = Direction.both;
-				}else{
+				} else {
 					direction = Direction.forward;
 				}
 				propURI = proForward.getURI();
-			}else{
+			} else {
 				direction = Direction.reverse;
 				propURI = proReverse.getURI();
@@ -568,9 +557,10 @@
 			String insURI = ins.getURI();
 			String key = propURI + "\t" + insURI + "\t" + direction;
-			if( insLinkMap.containsKey(key)){
+			if (insLinkMap.containsKey(key)) {
 				InstanceLink insLink = insLinkMap.get(key);
 				insLink.addLinkedClassURI(clsURI);
-			}else{
-				InstanceLink insLink = new InstanceLink(propURI, insURI, new String[]{clsURI}, direction);
+			} else {
+				InstanceLink insLink = new InstanceLink(propURI, insURI,
+						new String[] { clsURI }, direction);
 				insLinkMap.put(key, insLink);
 			}
@@ -581,7 +571,7 @@
 	}
 
-	
-	public LabelMap[] getLabels(String[] graphURIs, String[] resourceURIs, String language) throws Exception{
-		if( resourceURIs == null || resourceURIs.length == 0 ){
+	public LabelMap[] getLabels(String[] graphURIs, String[] resourceURIs,
+			String language) throws Exception {
+		if (resourceURIs == null || resourceURIs.length == 0) {
 			return new LabelMap[0];
 		}
@@ -602,6 +592,6 @@
 		queryStr.append("  FILTER(?res IN (");
 		boolean f = false;
-		for( String resourceURI: resourceURIs ){
-			if(f){
+		for (String resourceURI : resourceURIs) {
+			if (f) {
 				queryStr.append(", ");
 			}
@@ -613,7 +603,7 @@
 		queryStr.append("))\n");
 		queryStr.append("}");
-		
-		System.out.println(queryStr.toString());	
-	
+
+		System.out.println(queryStr.toString());
+
 		Query query = QueryFactory.create(queryStr.toString());
 		QueryExecution qexec = QueryExecutionFactory.sparqlService(endpointURI,
@@ -626,14 +616,14 @@
 			String uri = sol.getResource("res").getURI();
 			Literal literal = sol.getLiteral("label");
-			if( literal != null ){
+			if (literal != null) {
 				String label = literal.getString();
 				String lang = literal.getLanguage();
-				if( language != null && language.equals(lang)){
+				if (language != null && language.equals(lang)) {
 					Label lbl = new Label(label, lang);
-					if( lMap.containsKey(uri)){
+					if (lMap.containsKey(uri)) {
 						LabelMap lm = lMap.get(uri);
 						lm.addLabel(lbl);
-					}else{
-						LabelMap lm = new LabelMap(uri, new Label[]{lbl});
+					} else {
+						LabelMap lm = new LabelMap(uri, new Label[] { lbl });
 						lMap.put(uri, lm);
 					}
@@ -643,4 +633,4 @@
 		return lMap.values().toArray(new LabelMap[0]);
 	}
-	
+
 }
