if (resource instanceof org.openrdf.model.URI) {
org.openrdf.model.URI uri = (org.openrdf.model.URI)resource;
return new URI(uri.getURI());
} else if (resource instanceof org.openrdf.model.BNode) {
org.openrdf.model.BNode bNode = (org.openrdf.model.BNode)resource;
return new BNode(bNode.getID());
} else {
return null;
}
}