コード例 #1
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));
  }
コード例 #2
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));
  }