Namespace prefixes

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

Namespace prefixes

raul_aranovich
Hello. After I load a saved ontology, do I always need to prefix the entity names with the namespace? Is there a way to import the namespace so that I can just type the name of the entity?

Example:

onto = get_otology("file:///some_onto.owl").load()

print(onto.some_class)
some_onto.some_class

print(some_class)
name_error...

Any way to avoid the `onto.` prefix every time?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Namespace prefixes

Jiba
Administrator
Hi,

Yes, you need to prefix entities with the name of the ontology.

You can avoid using the prefix for a given entity as follows:

entity = onto.entity

You can also do it for all entities using a loop and the globals() or locals() Python functions, but it requires to load all entities from the quadstore so it is not a good idea.

Jiba