コード例 #1
0
  /**
   * 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));
  }
コード例 #2
0
  /**
   * Visualize WD item using VIS library
   *
   * @param itemId
   * @param lang
   * @param depth
   * @param useInstance
   * @return
   */
  public Result getVisTree(String itemId, String lang, int depth, boolean useInstance) {

    String repsonse = Visualizer.generateCodeForVis(itemId, depth, lang, null, useInstance);

    if (repsonse == null) {
      return ok("No data about: " + itemId);
    }

    return ok(
        treeVis.render(
            repsonse.replace("\"", ""),
            searchedEntity,
            arg1SemanticTypes,
            arg2SemanticTypes,
            propMatchingFrames));
  }
コード例 #3
0
  /**
   * 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));
  }
コード例 #4
0
  /**
   * Visualize WD property using VIS library
   *
   * @param itemId
   * @param lang
   * @param depth
   * @param properties
   * @param useInstance
   * @return
   */
  public Result getVisTreeProp(
      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.generateCodeForVis(itemId, depth, lang, targetProperties, useInstance);

    if (repsonse == null) {
      return ok("No data about: " + itemId);
    }

    return ok(
        treeVis.render(
            repsonse.replace("\"", ""),
            searchedEntity,
            arg1SemanticTypes,
            arg2SemanticTypes,
            propMatchingFrames));
  }