Re: Titan to Janus - Change in behavior for properties with the same name but different datatypes.


Bharat Dighe <bdi...@...>
 

Thanks Abhay and Marc.

It came as a bit surprise due to existing behavior in Titan. 
This is a bit restrictive given the nature of my app where other than few fixed properties which are defined by the system, rest of the properties are stamped by external sources.
I will need to redesign the app given this finding.

Bharat


On Sunday, October 6, 2019 at 9:00:57 AM UTC-7, Abhay Pandit wrote:
Hi Bharat,

Janusgraph being more consistent it stores only one PropertyKey with a defined any defined name with only one data type throughout the graph.
Like in your case "Status" can't be of 2 data type in a graph.

Thanks,
Abhay


On Sun, 6 Oct 2019 at 01:03, <ma...@...> wrote:
Hi Bharat,

I understand your annoyance while porting your application, but to me the JanusGraph behaviour seems to be more consistent (by the way, I did not check the difference in behaviour you report, I just took your observation for granted). If you want the old Titan behaviour you can simply typecast your variable-type properties to their common denominator (like String, Long, Double, Object, whatever does the job) before you pass them to JanusGraph.

HTH,    Marc


Op zaterdag 5 oktober 2019 07:31:56 UTC+2 schreef Bharat Dighe:
There is a significant difference in the way Titan and Janus handles properties with the same name which have values with different datatypes.
Titan allows it but Janus does not. 
I am in a process to port my app which is using Titan to Janus and this is causing a major issue. In my app the properites are added dynamically. Other than few fixed properties and there is no predictibility of which properties and their datatypes.

Is there a way Janus can be made to behave same as Titan?

here is an example of the difference of behavior between Titan and Janus

Titan
=====
gremlin> v1=graph.addVertex();
==>v[4144]
gremlin> v2=graph.addVertex();
==>v[4096]
gremlin> v1.property("status", 1);
==>vp[status->1]
gremlin> v2.property("status","connected");
==>vp[status->connected]
gremlin> v1.property("size", 2000000)
==>vp[size->2000000]
gremlin> v2.property("size", 3000000000);
==>vp[size->3000000000]
gremlin> v1.property("status").value().getClass();
==>class java.lang.Integer
gremlin> v2.property("status").value().getClass();
==>class java.lang.String
gremlin> v1.property("size").value().getClass();
==>class java.lang.Integer
gremlin> v2.property("size").value().getClass();
==>class java.lang.Long

Janus
=====
gremlin> v1=graph.addVertex();
==>v[4104]
gremlin> v2=graph.addVertex();
==>v[4176]
gremlin> v1.property("status", 1);
==>vp[status->1]
gremlin> graph.tx().commit();
==>null
gremlin> v2.property("status","connected");
Value [connected] is not an instance of the expected data type for property key [status] and cannot be converted. Expected: class java.lang.Integer, found: class java.lang.String
Type ':help' or ':h' for help.
Display stack trace? [yN]n
gremlin> v1.property("size", 2000000)
==>vp[size->2000000]
gremlin> v2.property("size", 3000000000);
Value [3000000000] is not an instance of the expected data type for property key [size] and cannot be converted. Expected: class java.lang.Integer, found: class java.lang.Long
Type ':help' or ':h' for help.
Display stack trace? [yN]n

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/1b36efa5-a572-4085-81ac-05016a64d7ba%40googlegroups.com.

Join {janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.