Exemple #1
0
  /** Converts an ordinal property to an integer. */
  public static int getOrd(Resource r) throws ModelException {

    if (r == null) return -1;

    String uri = r.toString();
    if (!isRDF(uri)) return -1;

    int pos = getNamespaceEnd(uri);
    if (pos > 0 && pos + 1 < uri.length()) {
      try {
        int n = Integer.parseInt(uri.substring(pos + 1));
        if (n >= 1) return n;
      } catch (Exception any) {
      }
    }
    return -1;
  }