Esempio n. 1
0
  /** returns the literal value of the node reachable from subject via predicate */
  public static String getObjectLiteral(Model r, Resource subject, Resource predicate)
      throws ModelException {

    RDFNode obj = getObject(r, subject, predicate);
    if (obj instanceof Literal) return obj.toString();
    else return null;
  }
Esempio n. 2
0
  /**
   * This method is used to compute the hash code of RDF statements. All implementation of
   * org.w3c.rdf.model.Statement MUST use this method. The hash code is computed as
   *
   * <blockquote>
   *
   * <pre>
   * ((s.hashCode() * 7) + p.hashCode()) * 7 + o.hashCode()
   * </pre>
   *
   * </blockquote>
   */
  public static int statementHashCode(Resource s, Resource p, RDFNode o) {

    return ((s.hashCode() * 7) + p.hashCode()) * 7 + o.hashCode();
  }