public void validateDatatypeRestriction(DatatypeRestriction datatypeRestriction) throws UnsupportedFacetException {
String datatypeURI=datatypeRestriction.getDatatypeURI();
assert s_subsetsByDatatype.containsKey(datatypeURI);
for (int index=datatypeRestriction.getNumberOfFacetRestrictions()-1;index>=0;--index) {
String facetURI=datatypeRestriction.getFacetURI(index);
Constant facetValue=datatypeRestriction.getFacetValue(index);
Object facetDataValue=facetValue.getDataValue();
if ((XSD_NS+"minLength").equals(facetURI) || (XSD_NS+"maxLength").equals(facetURI) || (XSD_NS+"length").equals(facetURI)) {
if (facetDataValue instanceof Integer) {
int value=(Integer)facetDataValue;
if (value<0 || value==Integer.MAX_VALUE)
throw new UnsupportedFacetException("Facet with URI '"+facetURI+"' does not support integer "+value+" as value.");
}
else
throw new UnsupportedFacetException("Facet with URI '"+facetURI+"' does not support value of type "+facetValue.getClass()+" as value.");
}
else if ((XSD_NS+"pattern").equals(facetURI)) {
if (facetDataValue instanceof String) {
String pattern=(String)facetDataValue;
if (!RDFPlainLiteralPatternValueSpaceSubset.isValidPattern(pattern))
throw new UnsupportedFacetException("String '"+pattern+"' is not a valid regular expression.");
}
else
throw new UnsupportedFacetException("Facet with URI '"+facetURI+"' does not support value of type "+facetValue.getClass()+" as value.");
}
else if ((RDF_NS+"langRange").equals(facetURI)) {
if (!(facetDataValue instanceof String))
throw new UnsupportedFacetException("Facet with URI '"+facetURI+"' does not support '"+facetValue.toString()+"' as value.");
}
else
throw new UnsupportedFacetException("Facet with URI '"+facetURI+"' is not supported on rdf:PlainLiteral.");
}
}