if (document.getSchemaClass().isSubClassOf(OGraphDatabase.VERTEX_CLASS_NAME))
// VERTEX TYPE
graphElement = new OrientVertex(graph, document);
else if (document.getSchemaClass().isSubClassOf(OGraphDatabase.EDGE_CLASS_NAME))
// EDGE TYPE
graphElement = new OrientEdge(graph, document);
else
// UNKNOWN CLASS: IGNORE IT
return null;
engine.getBindings(ScriptContext.ENGINE_SCOPE).put("current", graphElement);