else
return RDFPlainLiteralPatternValueSpaceSubset.toAutomaton((RDFPlainLiteralLengthValueSpaceSubset)valueSpaceSubset);
}
protected Automaton getAutomatonFor(DatatypeRestriction datatypeRestriction) {
String datatypeURI=datatypeRestriction.getDatatypeURI();
Automaton automaton=RDFPlainLiteralPatternValueSpaceSubset.getDatatypeAutomaton(datatypeURI);
int minLength=0;
int maxLength=Integer.MAX_VALUE;
for (int index=datatypeRestriction.getNumberOfFacetRestrictions()-1;index>=0;--index) {
String facetURI=datatypeRestriction.getFacetURI(index);
Object facetDataValue=datatypeRestriction.getFacetValue(index).getDataValue();
if ((XSD_NS+"minLength").equals(facetURI))
minLength=Math.max(minLength,(Integer)facetDataValue);
else if ((XSD_NS+"maxLength").equals(facetURI))
maxLength=Math.min(maxLength,(Integer)facetDataValue);
else if ((XSD_NS+"length").equals(facetURI)) {
minLength=Math.max(minLength,(Integer)facetDataValue);
maxLength=Math.min(maxLength,(Integer)facetDataValue);
}
else if ((XSD_NS+"pattern").equals(facetURI)) {
String pattern=(String)facetDataValue;
Automaton facetAutomaton=RDFPlainLiteralPatternValueSpaceSubset.getPatternAutomaton(pattern);
automaton=automaton.intersection(facetAutomaton);
}
else if ((RDF_NS+"langRange").equals(facetURI)) {
String languageRange=(String)facetDataValue;
Automaton languageRangeAutomaton=RDFPlainLiteralPatternValueSpaceSubset.getLanguageRangeAutomaton(languageRange);
automaton=automaton.intersection(languageRangeAutomaton);
}
else
throw new UnsupportedFacetException("Facet with URI '"+facetURI+"' not supported on '"+datatypeURI+"'.");
}