Python client RelationshipType is_entity_type


#1

I think the Concept.is_(relationship|entity|attribute)_type methods aren’t working properly:

# graql console -k test_type --uri grakn:48555

Grakn  Copyright (C) 2018  Grakn Labs Limited
This is free software, and you are welcome to redistribute it
under certain conditions; type 'license' for details.
>>> define ENCODES sub relationship relates encoder, relates encoded;
{}
>>> commit
>>> match $x sub relationship; get;
{$x label relationship;}
{$x label ENCODES sub relationship;}
CTRL-C

# pipenv run python

Python 3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import grakn
>>> client = grakn.Grakn(uri='grakn:48555')
>>> with client.session(keyspace="test_type") as session:
...     with session.transaction(grakn.TxType.READ) as tx:
...             concept = tx.get_schema_concept('ENCODES')
...             print(type(concept))
...             if concept.is_relationship_type:
...                     print("I AM DEFINITELY A RELATIONSHIP")
...             if concept.is_entity_type:
...                     print("I AM CONFUSED ABOUT MY IDENTITY")
...
<class 'grakn.service.Session.Concept.Concept.RelationshipType'>
I AM DEFINITELY A RELATIONSHIP
I AM CONFUSED ABOUT MY IDENTITY

#2

At first glance I’m noticing that you’re using concept.is_relationship_type as a variable member not as a function, before I look into that further would you mind quickly attempting to use concept.is_relationship_type() and reporting the results?

Cheers


#3

That is indeed a ‘school boy error’, for some reason I had assumed this was a boolean attribute, not a function. Apologies for the distraction.