* but is not specific to DAML+OIL.
*/
public void testUserDefined() throws IOException {
String uri = "http://www.daml.org/2001/03/daml+oil-ex-dt";
String filename = "testing/xsd/daml+oil-ex-dt.xsd";
TypeMapper tm = TypeMapper.getInstance();
List<String> typenames = XSDDatatype.loadUserDefined(uri, new FileReader(filename), null, tm);
assertIteratorValues(typenames.iterator(), new Object[] {
uri + "#XSDEnumerationHeight",
uri + "#over12",
uri + "#over17",
uri + "#over59",
uri + "#clothingsize" });
// Check the string restriction
RDFDatatype heightType = tm.getSafeTypeByName(uri + "#XSDEnumerationHeight");
checkLegalLiteral("short", heightType, String.class, "short");
checkLegalLiteral("tall", heightType, String.class, "tall");
checkIllegalLiteral("shortish", heightType);
// Check the numeric restriction
RDFDatatype over12Type = tm.getSafeTypeByName(uri + "#over12");
checkLegalLiteral("15", over12Type, Integer.class, new Integer(15));
checkIllegalLiteral("12", over12Type);
// Check the union type
RDFDatatype clothingsize = tm.getSafeTypeByName(uri + "#clothingsize");
checkLegalLiteral("42", clothingsize, Integer.class, new Integer(42));
checkLegalLiteral("short", clothingsize, String.class, "short");
// Check use of isValidLiteral for base versus derived combinations
LiteralLabel iOver12 = m.createTypedLiteral("13", over12Type).asNode().getLiteral();