/** * Visualize WD item using d3 style * * @param itemId * @param lang * @param depth * @param useInstance * @return */ public Result getd3TreeNoProp(String itemId, String lang, int depth, boolean useInstance) { String repsonse = Visualizer.generateTreeForEntity(itemId, depth, lang, null, useInstance); if (repsonse == null) { return ok("No data about: " + itemId); } try { FileUtils.writeStringToFile(new File("public/javascripts/flare.json"), repsonse, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } return ok(tree.render(repsonse)); }
/** * Visualized WD proeprty according to d3 style * * @param itemId * @param lang * @param depth * @param properties * @param useInstance * @return */ public Result getd3TreeProp( String itemId, String lang, int depth, String properties, boolean useInstance) { Set<String> targetProperties = new HashSet<String>(); String[] propArr = properties.split(","); for (String prop : propArr) { targetProperties.add(prop); } String repsonse = Visualizer.generateTreeForEntity(itemId, depth, lang, targetProperties, useInstance); if (repsonse == null) { return ok("No data about: " + itemId); } try { FileUtils.writeStringToFile(new File("public/javascripts/flare.json"), repsonse, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } return ok(tree.render(repsonse)); }