| 168 | | |
| | 168 | |
| | 169 | public String toJSONString4(QueryPathGenerator qpg) { |
| | 170 | String json_str ="{"; |
| | 171 | |
| | 172 | if( propertyURI != null ) { |
| | 173 | //json_str+="\"propertyURI\":"+"\""+propertyURI+"\","; |
| | 174 | json_str+="\"predicate\":"+"\""+propertyURI+"\","; |
| | 175 | } |
| | 176 | else{ |
| | 177 | json_str+="\"predicate\":"+"\"propertyURI\","; |
| | 178 | } |
| | 179 | if( linkedClassURI != null ){ |
| | 180 | //json_str+="\"linkedClassURI\":"+"\""+linkedClassURI+"\","; |
| | 181 | json_str+="\"linkedClass\":"+"\""+linkedClassURI+"\","; |
| | 182 | } |
| | 183 | else{ |
| | 184 | //json_str+="\"linkedClassURI\":"+"\"linkedClassURI\","; |
| | 185 | json_str+="\"linkedClass\":"+"\""+linkedClassURI+"\","; |
| | 186 | } |
| | 187 | if( linkedLiteralDatatypeURI != null ){ |
| | 188 | json_str+="\"linkedLiteralDatatypeURI\":"+"\""+linkedLiteralDatatypeURI+"\","; |
| | 189 | } |
| | 190 | else{ |
| | 191 | json_str+="\"linkedLiteralDatatypeURI\":"+"\"linkedLiteralDatatypeURI\","; |
| | 192 | } |
| | 193 | if( direction != null ){ |
| | 194 | json_str+="\"direction\":"+"\""+direction.toString()+"\","; |
| | 195 | } |
| | 196 | else{ |
| | 197 | json_str+="\"direction\":"+"\"direction\","; |
| | 198 | } |
| | 199 | if ( linkedClassURI != null ){ |
| | 200 | String label = qpg.getClassLabel(linkedClassURI); |
| | 201 | json_str+="\"label\":"+"\""+label+"\""; |
| | 202 | }else if ( linkedLiteralDatatypeURI != null ){ |
| | 203 | String url[] = linkedLiteralDatatypeURI.split("/"); |
| | 204 | String tmplabel = url[url.length-1]; |
| | 205 | String[] tmplabel2 = tmplabel.split("#"); |
| | 206 | String label = tmplabel2[tmplabel2.length-1]; |
| | 207 | json_str+="\"label\":"+"\""+label+"\""; |
| | 208 | }else{ |
| | 209 | json_str+="\"label\":"+"\""+"\"No Label\""+"\""; |
| | 210 | } |
| | 211 | json_str+="}"; |
| | 212 | |
| | 213 | return json_str; |
| | 214 | } |
| | 215 | |
| | 216 | |