Ejemplo n.º 1
0
  /**
   * Checks if the resource has the provided datatype property set on it with the specified value.
   *
   * @param aProperty
   * @param aValue
   * @return
   */
  public boolean hasDatatypePropertyWithValue(DatatypeProperty aProperty, Literal aValue) {

    List<Literal> literals = getDatatypePropertyValues(aProperty);
    for (Literal l : literals) {
      if (l.getValue().equals(aValue.getValue())) {
        if (l.getDataType() != null && aValue.getDataType() != null) {
          if (!aValue
              .getDataType()
              .getXmlSchemaURIString()
              .equals(l.getDataType().getXmlSchemaURIString())) continue;
        }

        if (l.getLanguage() != null && aValue.getLanguage() != null) {
          if (!aValue.getLanguage().toString().equals(l.getLanguage().toString())) continue;
        }
        return true;
      }
    }
    return false;
  }