if (is_nillable()
&& elem.hasAttributeNS(schema.XSI,"nil")
&& elem.getAttributeNS(schema.XSI,"nil").equals("true"))
o.addProperty(RDF.value,RDF.nil);
Seq subSeq = null;
if (ctx.isSequenced() && elem.hasChildNodes() && c.needSeq(new HashSet<String>(), ctx))
subSeq = m.getSeq(o.addProperty(RDF.type, RDF.Seq));
int index = c.toRDF(o, elem, 0, subSeq,null,true,ctx);
// mop up remaining values in sequence
produceMixed(subSeq, index, elem);
m.add(stmt);
if (seq != null) seq.add(stmt.createReifiedStatement());
return true;
}
else Gloze.logger.warn("undefined type: "+fullname);
}
// predefined schema datatype
String type = expandQName(ctx.getDefaultNS(),def.getType(),m);
if (type!=null && type.startsWith(schema.XSD_URI)) {
if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
stmt = m.createStatement(subject,prop,RDF.nil);
else {
if (type.equals(schema.XSD_URI+"#ID") && value!=null && !value.trim().equals("")) {
Resource o = m.createResource(addFragment(ctx.getBaseMap(), value.trim()).toString());
stmt = m.createStatement(subject,prop,o);
}
else stmt = schema.toRDFStatement(subject, elem, prop, value, type, ctx);
}
}
// user defined simple type
XMLBean t = def.get_type(ctx);
if (t instanceof simpleType) {
// an empty, as opposed to nil, element is null
if (value==null) value = "";
if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
stmt = m.createStatement(subject,prop,RDF.nil);
// if a simple type is nil there is no content or attributes
// initialise restriction set according to level of restriction checking required
else {
Boolean b = ((simpleType) t).toRDF(subject, prop, elem, value, seq, null, ctx);
if (!b) Gloze.logger.warn("cannot map value "+value+" into simpleType "+type);
}
}
else if (t instanceof complexType) {
// look for a global ID
String id = ((complexType) t).getID(elem,ctx);
Resource o = id==null?m.createResource():m.createResource(addFragment(ctx.getBaseMap(), id).toString());
stmt = m.createStatement(subject,prop,o);
// the new resource, o, becomes the subject
if (is_nillable() && elem.hasAttributeNS(schema.XSI,"nil") && elem.getAttributeNS(schema.XSI,"nil").equals("true"))
o.addProperty(RDF.value,RDF.nil);
Seq subSeq = null;
if (ctx.isSequenced() && elem.hasChildNodes() && ((complexType) t).needSeq(new HashSet<String>(),ctx))
subSeq = m.getSeq(o.addProperty(RDF.type, RDF.Seq));
int index = ((complexType) t).toRDF(o, elem, 0, subSeq, null,true,ctx);
// mop up remaining values in sequence