BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 19 forks source link

ElasticSearch result resources don't have the attribute 'id' #230

Closed eugeniashurko closed 2 years ago

eugeniashurko commented 2 years ago

When doing forge.elastic(<query>) I get the resources of the following kind:

{
    "@id": <id>,
    "@type": <type>
    ...
}

However when trying to access the attributes id and type, I get the following error:

>> print(r.id)
AttributeError: 'Resource' object has no attribute 'id'
>> print(r.type)
AttributeError: 'Resource' object has no attribute 'type'

I am still able to access them by doing forge.as_json(r)["@id"] or forge.as_json(r)["@type"], but I am not sure it's a desirable behavior.