I'm trying to use owlready2 from ipython Notebook to manage a simple ontology in OWL/XML I created with protege', following the examples in the documentation (release 0.3), but I cannot get how to use the search() function with the keywords type, subclass_of and is_a.
For example, let "Onto.Class" be the name of a class in my ontology, as from the output of list(onto.classes()), the output of the following
Moreover, I would expect the output of onto.search(type = "*") to be the list of the individuals in my ontology, but I get the individuals plus the properties (objects and data properties).
search() with keyword is_a behaves exactly the same, with (onto.search(is_a = "*")) returning individuals and properties, while I cannot get any other answer than  when I use a string different than "*".
search() with keyword subclass_of behaves more or less the same way (no answer than  when I use a somehow meaningful string, while the output of onto.search(subclass_of = "*") is a mix of subclasses and some classes (the latter, subclasses of Thing). I don't get the rationale because the output doesn't include
all the classes.
Can you please give me some examples on how to use better the search() function?
You get it right, you need to pass the Class object, not its name. I'm adding such an example in the doc.
With "*", it returns any entity that has at least one "is-a" relation, thus you get individual but also classes and properties. This is normal; in some circonstancies it is usefull to search classes and not individuals.
MCF, LIMICS, Université Paris 13
> I found out the "trick".
> I don't have to give the class name as a string but the instance.
> The answer to onto.search(type = onto.Class) is exactly the list of
> individuals of class Class.
> If you reply to this email, your message will be added to the discussion below:
> http://owlready.8326.n8.nabble.com/use-of-search-for-typed-elements-tp6p7.html > To start a new topic under Owlready, email [hidden email] > To unsubscribe from Owlready, visit