I am using Janus graph DB, and we have return custom vertex program to retrieve data from Janus graph , and we are using spark germling libs, I have created one vertex and define properties and for one property defined meta property, during code execution am seeing vertex and it's properties being retrieved and, but I am not able to see meta property, any idea, sample java code, how we can retrieve meta properties?
@KelvinLawrence from gremlin console, I added meta properties like below. first i created node like below
g.addV('Student').property('JoinedDate','2016-12-04').property('NodeType','Student').property('NodeSubType','MGMT_QUOTA').property('Id','1018407494687220').property('Names','LMUXm3VVEXcZWOPn1SN9tB/i89vGwRezRnZhwcgbnGg=').property('AddressId','223433849632287061').property('AccountType','41').property('NodeScore','0.7').as('c1')
then i added meta property like below
g.V('4152').properties('NodeType').hasValue('Student').property('acl','private')
, i even verified from gremlin console that their is meta property added successfully
g.V('4152').properties('NodeType').hasValue('Student').properties()
output as ==>p[acl->private]
, but when I am running vertex program which we created to traverse and retrieve the nodes, is not retrieving the meta properties, so can anyone help me on this please. If you see the run time values, meta properties are not being returned.
after rigorous debug , i found that in the class JanusGraphVertexDeserializer, we have
if (!((InternalRelationType)type).isInvisibleType()) {
if (type.isPropertyKey()) {
Object value = relation.getValue();
Preconditions.checkNotNull(value);
Cardinality card = this.getPropertyKeyCardinality(type.name());
tv.property(card, type.name(), value, new Object[]{T.id, relation.relationId});
here the below line leads to adding meta properties to the property of a vertex
tv.property(card, type.name(), value, new Object[]{T.id, relation.relationId});
when i debug more , i saw it is trying to add in the class ElementHelper in the below method
public static void attachProperties(final Element element, final Object... propertyKeyValues) {
if (null == element) {
throw org.apache.tinkerpop.gremlin.structure.Graph.Exceptions.argumentCanNotBeNull("element");
} else {
for(int i = 0; i < propertyKeyValues.length; i += 2) {
if (!propertyKeyValues[i].equals(T.id) && !propertyKeyValues[i].equals(T.label)) {
element.property((String)propertyKeyValues[i], propertyKeyValues[i + 1]);
}
}
}
}
if you see the if condition
if (!propertyKeyValues[i].equals(T.id) && !propertyKeyValues[i].equals(T.label))
meta property key must not be "id" "label" , here the problem if the developer who written this code not allowing "id" and "label" , then why in the above class the developer trying to pass "id" as key