use of org.sbpax.schemas.util.NameSpace in project vcell by virtualcell.
the class Model2JDOM method createElement.
protected Element createElement(Graph model, Resource resource) {
Element element = null;
Iterator<Statement> stmtIter = model.match(resource, RDF.TYPE, null);
while (stmtIter.hasNext()) {
Value object = stmtIter.next().getObject();
if (object instanceof URI) {
URI type = (URI) object;
String nameSpaceURI = type.getNamespace();
String localName = type.getLocalName();
if (localName != null && localName.length() > 0 && nameSpaceURI != null && nameSpaceURI.length() > 0) {
NameSpace ns = nsMap.provideNamesSpace(nameSpaceURI);
element = new Element(localName, Namespace.getNamespace(ns.prefix, ns.uri));
break;
}
}
}
if (element == null) {
element = new Element(TYPELESS_NODE_NAME, nsRDF);
}
if (resource instanceof URI) {
element.setAttribute("about", resource.stringValue(), nsRDF);
} else {
element.setAttribute("nodeID", blankNodeID(resource), nsRDF);
}
return element;
}