/** * Executes a query against the current vertex. The returning type is a OrientVertexQuery. */ @Override public OrientVertexQuery query() { setCurrentGraphInThreadLocal(); return new OrientVertexQuery(this); }
/** * Returns all the Property names as Set of String. out, in and label are not returned as properties even if are part of the * underlying document because are considered internal properties. */ @Override public Set<String> getPropertyKeys() { final OrientBaseGraph graph = setCurrentGraphInThreadLocal(); final ODocument doc = getRecord(); final Set<String> result = new HashSet<String>(); for (String field : doc.fieldNames()) if (graph != null && settings.isUseVertexFieldsForEdgeLabels()) { if (!field.startsWith(CONNECTION_OUT_PREFIX) && !field.startsWith(CONNECTION_IN_PREFIX)) result.add(field); } else if (!field.equals(OrientBaseGraph.CONNECTION_OUT) && !field.equals(OrientBaseGraph.CONNECTION_IN)) result.add(field); return result; }
@Override public Map<String, Object> getProperties() { if (this.rawElement == null) return null; final ODocument raw = this.rawElement.getRecord(); if (raw == null) return null; final OrientBaseGraph graph = setCurrentGraphInThreadLocal(); final Map<String, Object> result = new HashMap<String, Object>(); for (String field : raw.fieldNames()) if (graph != null && settings.isUseVertexFieldsForEdgeLabels()) { if (!field.startsWith(CONNECTION_OUT_PREFIX) && !field.startsWith(CONNECTION_IN_PREFIX)) result.put(field, raw.field(field)); } else if (!field.equals(OrientBaseGraph.CONNECTION_OUT) && !field.equals(OrientBaseGraph.CONNECTION_IN)) result.put(field, raw.field(field)); return result; }
/** * Returns a OTraverse object to start traversing from the current vertex. */ public OTraverse traverse() { setCurrentGraphInThreadLocal(); return new OTraverse().target(getRecord()); }
/** * Returns a string representation of the vertex. */ public String toString() { setCurrentGraphInThreadLocal(); final ODocument record = getRecord(); if (record == null) return "<invalid record " + rawElement.getIdentity() + ">"; final String clsName = record.getClassName(); if (OrientVertexType.CLASS_NAME.equals(clsName)) return StringFactory.vertexString(this); return StringFactory.V + "(" + clsName + ")" + StringFactory.L_BRACKET + getId() + StringFactory.R_BRACKET; }
/** * (Blueprints Extension) Returns the Vertex's label. By default OrientDB binds the Blueprints Label concept to Vertex Class. To * disable this feature execute this at database level <code>alter database custom useClassForVertexLabel=false </code> */ @Override public String getLabel() { setCurrentGraphInThreadLocal(); if (settings.isUseClassForVertexLabel()) { final String clsName = getRecord().getClassName(); if (!OrientVertexType.CLASS_NAME.equals(clsName)) // RETURN THE CLASS NAME return clsName; } return getRecord().field(OrientElement.LABEL_FIELD_NAME); }