Re: Proper way to define metaproperties in schema


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

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