4

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.

enter image description here

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

Bravo
  • 8,589
  • 14
  • 48
  • 85
  • 1
    It would be helpful if you could paste some sample code that shows how you are adding the properties and how you are trying to retrieve them. – Kelvin Lawrence Feb 16 '20 at 14:49
  • @KelvinLawrence, I edited my question above to add the details you asked, can you please check. – Bravo Feb 19 '20 at 06:48
  • @KelvinLawrence , any idea on this – Bravo Feb 25 '20 at 08:17
  • I'm sorry to say that I'm not completely sure what the problem is. I tested both `TinkerGraphComputer` and `SparkGraphComputer` within TinkerPop and did not have problems with the metaproperties. It makes me wonder if the issue is specific to JanusGraph? Perhaps you should post your `VertexProgram` code. Maybe there is something in the way you are trying to access the properties that is causing the issue? – stephen mallette Feb 27 '20 at 12:54
  • @stephenmallette , when using janus graph is their something issue with class JanusGraphVertexDeserializer ? this is deserializing data , i could not find code to handle meta data in this class so is this class missing code to handle meta data , is it bug ? janusgraph-hadoop-core-0.4.0 is my version of jar containing that class – Bravo Mar 02 '20 at 02:35
  • i don't know about `JanusGraphVertexDeserializer` unfortunately, however I can confirm that there is no reason you shouldn't be able to work with metaproperties so it is either intentionally unsupported in JanusGraph or unintentionally omitted and is just a bug. – stephen mallette Mar 02 '20 at 11:35
  • @stephenmallette , i update my findings , can you please check , why the developer made this peculiar code – Bravo Mar 02 '20 at 12:35
  • i don't think the problem is necessarily with passing `id`from `JanusGraphVertexDeserializer` but definitely looks like metaproperties aren't being provided there in that class. on the other hand i'm not familiar with that code so can't comment on "why" it is the way it is, but given how you've presented it though it looks like a bug. – stephen mallette Mar 02 '20 at 13:21

0 Answers0