Example #1
0
 public Model getModel() {
   Model model = ModelFactory.createDefaultModel();
   Resource itemNode = model.createResource(uri);
   for (Prop prop : values) {
     if (prop.isLiteral()) {
       itemNode.addLiteral(prop.getType(), model.createLiteral(prop.getValue()));
     } else {
       itemNode.addProperty(prop.getType(), model.createResource(prop.getValue()));
     }
   }
   return model;
 }
Example #2
0
  @Override
  public String toString() {
    String content = "Item description:" + this.getUri();

    Iterator i = values.iterator();

    while (i.hasNext()) {
      Prop me = (Prop) i.next();
      String isL = "Uri";
      if (me.isLiteral()) isL = "Lit";
      String isS = " ";
      if (me.isIsSearchable()) isS = "*";
      content += "\n\t" + isS + " " + isL + " " + me.getType() + " : ";
      if (me.getValue().length() > 100) {
        content += me.getValue().substring(0, 100) + "...";
      } else {
        content += me.getValue();
      }
    }
    return content;
  }