チェンジセット 269 : SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/OWL/EndpointAnalyzer.java
- 更新日時:
- 2016/03/14 20:01:59 (9 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/OWL/EndpointAnalyzer.java
r268 r269 148 148 */ 149 149 150 public List<SClass> getOWLClassList(String [] graphURIs, String[] keywords,150 public List<SClass> getOWLClassList(String graphURI, String[] keywords, 151 151 String language, 152 152 … … 157 157 // public List<SClass> 158 158 159 public SClass[] getOWLClasses(String [] graphURIs, String[] keywords,159 public SClass[] getOWLClasses(String graphURI, String[] keywords, 160 160 String language, 161 161 … … 170 170 queryStr.append("SELECT DISTINCT ?c ?pLabel \n"); 171 171 } 172 if (graphURI s!= null) {173 for (String graphURI : graphURIs) {172 if (graphURI != null) { 173 // for (String graphURI : graphURIs) { 174 174 queryStr.append("FROM <"); 175 175 queryStr.append(graphURI); 176 176 queryStr.append(">\n"); 177 }177 // } 178 178 } 179 179 queryStr.append("WHERE{\n"); … … 271 271 } 272 272 273 public SClass[] listClasses(String [] graphURIs, boolean countInstances)273 public SClass[] listClasses(String graphURI, boolean countInstances) 274 274 throws Exception { 275 275 StringBuffer queryStr = new StringBuffer(); … … 283 283 } 284 284 285 if (graphURI s!= null) {286 for (String graphURI : graphURIs) {285 if (graphURI != null) { 286 // for (String graphURI : graphURIs) { 287 287 queryStr.append("FROM <"); 288 288 queryStr.append(graphURI); 289 289 queryStr.append(">\n"); 290 }290 // } 291 291 } 292 292 queryStr.append("WHERE{\n"); … … 374 374 * @since 28.01.2014 375 375 */ 376 public Instance[] getInstances(String [] graphURIs, String keyword)376 public Instance[] getInstances(String graphURI, String keyword) 377 377 throws Exception { 378 378 StringBuffer queryStr = new StringBuffer(); … … 381 381 queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"); 382 382 queryStr.append("SELECT DISTINCT ?ins ?c \n"); 383 if (graphURIs != null) { 384 for (String graphURI : graphURIs) { 383 if (graphURI != null) { 385 384 queryStr.append("FROM <"); 386 385 queryStr.append(graphURI); 387 386 queryStr.append(">\n"); 388 }389 387 } 390 388 queryStr.append("WHERE{\n"); … … 450 448 * @since 28.01.2014 451 449 */ 452 public ClassLink[] getNextClass(String [] graphURIs, String originClass,450 public ClassLink[] getNextClass(String graphURI, String originClass, 453 451 int limit, boolean countLinks) throws Exception { 454 ClassLink[] cLinks = getNextClassSub(graphURI s, originClass, limit,452 ClassLink[] cLinks = getNextClassSub(graphURI, originClass, limit, 455 453 false); 456 454 if (countLinks) { 457 cLinks = countLinks(graphURI s, originClass, cLinks);455 cLinks = countLinks(graphURI, originClass, cLinks); 458 456 } 459 457 return cLinks; 460 458 } 461 459 462 private ClassLink[] getNextClassSub(String [] graphURIs, String originClass,460 private ClassLink[] getNextClassSub(String graphURI, String originClass, 463 461 int limit, boolean countLinks) throws Exception { 464 462 StringBuffer queryStr = new StringBuffer(); … … 474 472 } 475 473 476 if (graphURIs != null) { 477 for (String graphURI : graphURIs) { 474 if (graphURI != null) { 478 475 queryStr.append("FROM <"); 479 476 queryStr.append(graphURI); 480 477 queryStr.append(">\n"); 481 }482 478 } 483 479 queryStr.append("WHERE{\n"); … … 615 611 * @since 28.01.2014 616 612 */ 617 public ClassLink[] getNextClassViaInstanceLink(String [] graphURIs,613 public ClassLink[] getNextClassViaInstanceLink(String graphURI, 618 614 String originClass, int limit) throws Exception { 619 615 StringBuffer queryStr = new StringBuffer(); … … 622 618 queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"); 623 619 queryStr.append("SELECT DISTINCT ?pf ?pr (COUNT(?pf) AS ?numOfForwardLinks) (COUNT(?pr) AS ?numOfReverseLinks) (COUNT(DISTINCT(?insOrg)) AS ?numOfOriginInstances) (COUNT(DISTINCT(?ins)) AS ?numOfLinkedInstances) ?c \n"); 624 if (graphURI s!= null) {625 for (String graphURI : graphURIs) {620 if (graphURI != null) { 621 // for (String graphURI : graphURIs) { 626 622 queryStr.append("FROM <"); 627 623 queryStr.append(graphURI); 628 624 queryStr.append(">\n"); 629 }625 // } 630 626 } 631 627 queryStr.append("WHERE{\n"); … … 757 753 * @since 28.01.2014 758 754 */ 759 public InstanceLink[] getNextInstancesViaInstanceLink(String [] graphURIs,755 public InstanceLink[] getNextInstancesViaInstanceLink(String graphURI, 760 756 String originInstance, int limit) throws Exception { 761 757 StringBuffer queryStr = new StringBuffer(); … … 764 760 queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"); 765 761 queryStr.append("SELECT DISTINCT ?pf ?pr ?ins ?c \n"); 766 if (graphURIs != null) { 767 for (String graphURI : graphURIs) { 762 if (graphURI != null) { 768 763 queryStr.append("FROM <"); 769 764 queryStr.append(graphURI); 770 765 queryStr.append(">\n"); 771 }772 766 } 773 767 queryStr.append("WHERE{\n"); … … 833 827 } 834 828 835 public LabelMap[] getLabels(String [] graphURIs, String[] resourceURIs,829 public LabelMap[] getLabels(String graphURI, String[] resourceURIs, 836 830 String language) throws Exception { 837 if (resourceURIs == null || resourceURIs.length == 0) {838 return new LabelMap[0];839 }831 // if (resourceURIs == null || resourceURIs.length == 0) { 832 // return new LabelMap[0]; 833 // } 840 834 StringBuffer queryStr = new StringBuffer(); 841 835 queryStr.append("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"); … … 843 837 queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"); 844 838 queryStr.append("SELECT DISTINCT ?res ?label \n"); 845 if (graphURIs != null) { 846 for (String graphURI : graphURIs) { 839 if (graphURI != null) { 847 840 queryStr.append("FROM <"); 848 841 queryStr.append(graphURI); 849 842 queryStr.append(">\n"); 850 }851 843 } 852 844 queryStr.append("WHERE{\n"); … … 896 888 } 897 889 898 public ClassLink[] countLinks(String [] graphURIs, String startClassURI,890 public ClassLink[] countLinks(String graphURI, String startClassURI, 899 891 ClassLink[] classLinks) throws Exception { 900 892 if (classLinks == null || classLinks.length == 0) { … … 908 900 909 901 queryStr.append("SELECT (COUNT(?os) AS ?numOfLinks) (COUNT(DISTINCT(?is)) AS ?numOfOriginInstances) (COUNT(DISTINCT(?os)) AS ?numOfLinkedInstances) \n"); 910 if (graphURIs != null) { 911 for (String graphURI : graphURIs) { 902 if (graphURI != null) { 912 903 queryStr.append("FROM <"); 913 904 queryStr.append(graphURI); 914 905 queryStr.append(">\n"); 915 }916 906 } 917 907 … … 1003 993 1004 994 queryStr.append("SELECT (COUNT(?ics) AS ?numOfOriginClassInstances) \n"); 1005 if (graphURIs != null) { 1006 for (String graphURI : graphURIs) { 995 if (graphURI != null) { 1007 996 queryStr.append("FROM <"); 1008 997 queryStr.append(graphURI); 1009 998 queryStr.append(">\n"); 1010 }1011 999 } 1012 1000 … … 1056 1044 1057 1045 queryStr.append("SELECT (COUNT(?ocs) AS ?numOfLinkedClassInstances) \n"); 1058 if (graphURIs != null) { 1059 for (String graphURI : graphURIs) { 1046 if (graphURI != null) { 1060 1047 queryStr.append("FROM <"); 1061 1048 queryStr.append(graphURI); 1062 1049 queryStr.append(">\n"); 1063 }1064 1050 } 1065 1051