| 116 | public String toJSONString3(SClass[] classes) { |
| 117 | String json_str ="{"; |
| 118 | |
| 119 | if( propertyURI != null ) { |
| 120 | json_str+="\"propertyURI\":"+"\""+propertyURI+"\","; |
| 121 | } |
| 122 | else{ |
| 123 | json_str+="\"propertyURI\":"+"\"propertyURI\","; |
| 124 | } |
| 125 | if( linkedClassURI != null ){ |
| 126 | json_str+="\"linkedClassURI\":"+"\""+linkedClassURI+"\","; |
| 127 | } |
| 128 | else{ |
| 129 | json_str+="\"linkedClassURI\":"+"\"linkedClassURI\","; |
| 130 | } |
| 131 | if( linkedLiteralDatatypeURI != null ){ |
| 132 | json_str+="\"linkedLiteralDatatypeURI\":"+"\""+linkedLiteralDatatypeURI+"\","; |
| 133 | } |
| 134 | else{ |
| 135 | json_str+="\"linkedLiteralDatatypeURI\":"+"\"linkedLiteralDatatypeURI\","; |
| 136 | } |
| 137 | if( direction != null ){ |
| 138 | json_str+="\"direction\":"+"\""+direction.toString()+"\","; |
| 139 | } |
| 140 | else{ |
| 141 | json_str+="\"direction\":"+"\"direction\","; |
| 142 | } |
| 143 | //if ( linkedClassURI != null ){ |
| 144 | String label = getLinkedClassLabel(classes); |
| 145 | json_str+="\"nodelabel\":"+"\""+label+"\""; |
| 146 | //} |
| 147 | // json_str+="\"numOfLinks\":"+"\""+numOfLinks+"\","; |
| 148 | // json_str+="\"numOfLinkedInstances\":"+"\""+numOfLinkedInstances+"\","; |
| 149 | // json_str+="\"numOfOriginInstances\":"+"\""+numOfOriginInstances+"\","; |
| 150 | // json_str+="\"numOfOriginClassInstances\":"+"\""+numOfOriginClassInstances+"\","; |
| 151 | // json_str+="\"numOfLinkedClassInstances\":"+"\""+numOfLinkedClassInstances+"\""; |
| 152 | |
| 153 | json_str+="}"; |
| 154 | |
| 155 | return json_str; |
| 156 | } |
257 | | |
| 298 | private String getLinkedClassLabel(SClass[] classes){ |
| 299 | if ( linkedClassURI == null ){ |
| 300 | return ""; |
| 301 | } |
| 302 | for ( int i = 0 ; i < classes.length; i++ ){ |
| 303 | if ( linkedClassURI.equals(classes[i].getClassURI()) ){ |
| 304 | Label[] labels = classes[i].getLabels(); |
| 305 | for ( int j = 0 ; j < labels.length; j++ ){ |
| 306 | if ( labels[j].getLanguage() == null ){ |
| 307 | return labels[j].getLabel(); |
| 308 | }else if ( labels[j].getLanguage().equals("en") ){ |
| 309 | return labels[j].getLabel(); |
| 310 | } |
| 311 | } |
| 312 | break; |
| 313 | } |
| 314 | } |
| 315 | String[] url = linkedClassURI.split("/"); |
| 316 | String tmplabel = url[url.length-1]; |
| 317 | String[] tmplabel2 = tmplabel.split("#"); |
| 318 | String label = tmplabel2[tmplabel2.length-1]; |
| 319 | return label; |
| 320 | } |