Proper way to define metaproperties in schema


David Brown <dave...@...>
 

Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


Jason Plurad <plu...@...>
 

I opened up an issue to add docs on meta-properties and multi-properties.

This worked in the Gremlin Console:

gremlin> graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').set('schema.default', 'none').open()
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin
> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@7a360554
gremlin
> name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.SINGLE).make()
==>name
gremlin
> foo = mgmt.makePropertyKey('foo').dataType(String.class).cardinality(Cardinality.SINGLE).make()
==>foo
gremlin
> mgmt.commit()
==>null
gremlin
> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
gremlin
> v = g.addV('name', 'dave').next()
==>v[4232]
gremlin
> g.V(v).properties('name').property('foo', 'bar').iterate()
gremlin
> g.V(v).valueMap(true)
==>[label:vertex,id:4232,name:[dave]]
gremlin
> g.V(v).properties('name').valueMap(true)
==>[value:dave,id:sx-39k-sl,foo:bar,key:name]
gremlin
> g.V(v).properties('name').property('bla', 'dat').iterate()
Property Key with given name does not exist: bla

Were you trying something different?


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


David Brown <dave...@...>
 

Thanks for the quick replies. Thanks to the examples, I've determined this is a bug in Goblin.


On Monday, August 28, 2017 at 2:07:38 PM UTC-4, Jason Plurad wrote:
I opened up an issue to add docs on meta-properties and multi-properties.

This worked in the Gremlin Console:

gremlin> graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').set('schema.default', 'none').open()
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin
> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@7a360554
gremlin
> name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.SINGLE).make()
==>name
gremlin
> foo = mgmt.makePropertyKey('foo').dataType(String.class).cardinality(Cardinality.SINGLE).make()
==>foo
gremlin
> mgmt.commit()
==>null
gremlin
> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
gremlin
> v = g.addV('name', 'dave').next()
==>v[4232]
gremlin
> g.V(v).properties('name').property('foo', 'bar').iterate()
gremlin
> g.V(v).valueMap(true)
==>[label:vertex,id:4232,name:[dave]]
gremlin
> g.V(v).properties('name').valueMap(true)
==>[value:dave,id:sx-39k-sl,foo:bar,key:name]
gremlin
> g.V(v).properties('name').property('bla', 'dat').iterate()
Property Key with given name does not exist: bla

Were you trying something different?


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


David Brown <dave...@...>
 



On Monday, August 28, 2017 at 4:01:40 PM UTC-4, David Brown wrote:
Thanks for the quick replies. Thanks to the examples, I've determined this is a bug in Goblin.

On Monday, August 28, 2017 at 2:07:38 PM UTC-4, Jason Plurad wrote:
I opened up an issue to add docs on meta-properties and multi-properties.

This worked in the Gremlin Console:

gremlin> graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').set('schema.default', 'none').open()
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin
> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@7a360554
gremlin
> name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.SINGLE).make()
==>name
gremlin
> foo = mgmt.makePropertyKey('foo').dataType(String.class).cardinality(Cardinality.SINGLE).make()
==>foo
gremlin
> mgmt.commit()
==>null
gremlin
> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
gremlin
> v = g.addV('name', 'dave').next()
==>v[4232]
gremlin
> g.V(v).properties('name').property('foo', 'bar').iterate()
gremlin
> g.V(v).valueMap(true)
==>[label:vertex,id:4232,name:[dave]]
gremlin
> g.V(v).properties('name').valueMap(true)
==>[value:dave,id:sx-39k-sl,foo:bar,key:name]
gremlin
> g.V(v).properties('name').property('bla', 'dat').iterate()
Property Key with given name does not exist: bla

Were you trying something different?


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


David Brown <dave...@...>
 

A bit of a follow up on this. I have determined that the source of my problem relates to selecting an individual vertex property from a list cardinality property. I use this traversal: g.V(v).properties('key').hasValue(val).next(). If `val` is anything other than a string, this query returns nothing. It works fine with string type properties. For the record, I am using gremlin-python based code to remote the db, and I think the current Janus only tests against TP 3.2.3 (which is pre gremlin-python). My code runs as expected against TP 3.2.4 + with TinkerGraph.


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


Jason Plurad <plu...@...>
 

Would you be able to test your scenario against JanusGraph master branch? It's running TP 3.2.6.


On Tuesday, August 29, 2017 at 10:30:00 AM UTC-4, David Brown wrote:
A bit of a follow up on this. I have determined that the source of my problem relates to selecting an individual vertex property from a list cardinality property. I use this traversal: g.V(v).properties('key').hasValue(val).next(). If `val` is anything other than a string, this query returns nothing. It works fine with string type properties. For the record, I am using gremlin-python based code to remote the db, and I think the current Janus only tests against TP 3.2.3 (which is pre gremlin-python). My code runs as expected against TP 3.2.4 + with TinkerGraph.

On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


David Brown <dave...@...>
 

Ok, I built from source. It appears that this is happening specifically with properties defined as Floats. The following script in gremlin_python (3.2.6) illustrates this problem:
from gremlin_python.driver.client import Client
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.structure.graph import Graph
from gremlin_python.process.traversal import Cardinality


client = Client('ws://localhost:8182/gremlin', 'g')
rc = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
g = Graph().traversal().withRemote(rc)

schema_msg = """mgmt = graph.openManagement()
                string_prop = mgmt.makePropertyKey('string_prop').dataType(String.class).cardinality(Cardinality.LIST).make()
                float_prop = mgmt.makePropertyKey('float_prop').dataType(Float.class).cardinality(Cardinality.LIST).make()
                integer_prop = mgmt.makePropertyKey('integer_prop').dataType(Integer.class).cardinality(Cardinality.LIST).make()
                mgmt.commit()"""

client.submit(schema_msg)


v = g.addV('person').property(Cardinality.list_, 'string_prop', 'dave')\
                    .property(Cardinality.list_,'float_prop', 1.1)\
                    .property(Cardinality.list_,'integer_prop', 1).next()
props = g.V(v.id).propertyMap().toList()
print("properties: {}".format(props))
string_prop = g.V(v.id).properties('string_prop').hasValue('dave').toList()
print("string prop: {}".format(string_prop))
float_prop = g.V(v.id).properties('float_prop').hasValue(1.1).toList()
print("float_prop: {}".format(float_prop))
integer_prop = g.V(v.id).properties('integer_prop').hasValue(1).toList()
print("integer_prop: {}".format(integer_prop))

The output of this script is:

properties: [{'integer_prop': [vp[integer_prop->1]], 'float_prop': [vp[float_prop->1.1]], 'string_prop': [vp[string_prop->dave]]}]
string prop: [vp[string_prop->dave]]
float_prop: []
integer_prop: [vp[integer_prop->1]]

Am I missing something here? Or is there a problem with floats and the hasValue step? Or maybe this is gremlin_python specific...

On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


David Brown <dave...@...>
 

For the record, the output of the same script when run against TinkerGraph 3.2.6 is as expected:

properties: [{'string_prop': [vp[string_prop->dave]], 'integer_prop': [vp[integer_prop->1]], 'float_prop': [vp[float_prop->1.1]]}]
string prop: [vp[string_prop->dave]]
float_prop: [vp[float_prop->1.1]]
integer_prop: [vp[integer_prop->1]]


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


Jason Plurad <plu...@...>
 

Thanks for the reproduce scenario.
I opened up an issue to track this https://github.com/JanusGraph/janusgraph/issues/487


On Tuesday, August 29, 2017 at 12:50:54 PM UTC-4, David Brown wrote:
For the record, the output of the same script when run against TinkerGraph 3.2.6 is as expected:

properties: [{'string_prop': [vp[string_prop->dave]], 'integer_prop': [vp[integer_prop->1]], 'float_prop': [vp[float_prop->1.1]]}]
string prop: [vp[string_prop->dave]]
float_prop: [vp[float_prop->1.1]]
integer_prop: [vp[integer_prop->1]]


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave


David Brown <dave...@...>
 

Thank you for looking into this for me. In general, Janus seems pretty spiffy. Nice work done here so far.


On Tuesday, August 29, 2017 at 4:57:44 PM UTC-4, Jason Plurad wrote:
Thanks for the reproduce scenario.
I opened up an issue to track this https://github.com/JanusGraph/janusgraph/issues/487

On Tuesday, August 29, 2017 at 12:50:54 PM UTC-4, David Brown wrote:
For the record, the output of the same script when run against TinkerGraph 3.2.6 is as expected:

properties: [{'string_prop': [vp[string_prop->dave]], 'integer_prop': [vp[integer_prop->1]], 'float_prop': [vp[float_prop->1.1]]}]
string prop: [vp[string_prop->dave]]
float_prop: [vp[float_prop->1.1]]
integer_prop: [vp[integer_prop->1]]


On Monday, August 28, 2017 at 1:44:18 PM UTC-4, David Brown wrote:
Hello JanusGraph users,

I have been experimenting with Janus, and using the automatic schema generation, metaproperties work as expected. However, when I set `schema.default=none` in the conf and define my own schema, metaproperties seem to quit working--metaproperty data is no longer returned in the Gremlin Server response. How should metaproperties be defined in the schema? I can't seem to find this information in the documentation. I can provide example schema definitions if necessary.

Thanks,

Dave