World#get does not try to load entities missing form World#_entities

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

World#get does not try to load entities missing form World#_entities

fiveop
As mention in the subject, World#get does not try to load entities missing from World#_entities, which leads to confusing behavior. For example:

world.get(<some valid IRI of a class>)

fails, while

world[<some valid IRI of a class>]

and

print([c for c in world.classes()]) # fill the World#_entities cache
world.get(<some valid IRI of a class>)

succeeds (assuming all three are run on a fresh world with a freshly loaded ontology).

Reply | Threaded
Open this post in threaded view
|

Re: World#get does not try to load entities missing form World#_entities

Jiba
Administrator
Hi,

Actually this was initially intended... but I agree that it is not consistent with get() in Python dictionary.

I've fixed the get() to behave like in Python dicts, and added a new method get_if_loaded() to get only loaded entities.

Jiba