Owlready2 0.3 has been released!

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

Owlready2 0.3 has been released!

Jiba
Administrator
Hi all,

Owlready is a Python module for ontology-oriented programming.
It can load OWL 2.0 ontologies and manipulate them transparently in Python.

The 2 - 0.3 version of Owlready is mostly a bugfix release. It also add the ability to destroy entities from
ontologies.

The new version can be downloaded from PyPI (Python Package Index):
https://pypi.python.org/pypi/Owlready2

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Owlready2 0.3 has been released!

Mareike
Hi Jiba,

first, thanks for this tool, I am glad to finally find something that can deal with RDF/XML and this looks promising.
However, I am having trouble querying the ontology in terms of object properties.
 I can easily get a list of all possible object properties in the ontology, but cannot find out which one applies for a particular individual.
Say I have an individual indivA and I know there is a relation objPropX to an unknown individual indivB.
I can just get indivB by calling indivA.objPropX.
But what if I only have indivA and want to know all the object properties it has (and, subsequently, get the respective individuals it is connected with via this relation)?
How can I achieve this?
I found some function triplets(s,p,o) (and similar) which I can call on the ontology itself and my intuition says this might be what I am looking for,
but it returns empty lists regardless of what I plug in as arguments (which seems to be the default behavior, according to the code?).
Am I missing something, or is this simply work in progress and will be available at some point?
I'd appreciate some help on this.

Cheers,
Mareike
Reply | Threaded
Open this post in threaded view
|

Re: Owlready2 0.3 has been released!

Jiba
Administrator
Hi,

Thank you for your feedback. You are true, there is currently no way to obtain the list of properties that are present for a given individual. This was not intended, it is a missing feature.

I've added three new methods for introspecting individuals and properties:

   individual.get_properties() returns a generator that yields the existing properties on a given individual (without dupplicates)

   individual.get_inverse_properties() returns a generator that yields (subject, property) tuples for inverse properties involving the individual

   property.get_relations() returns a generator that yields (subject,object) tuples related by the given property.

These methods have been added in the development version of Owlready2 on Bitbucket.

Kind regards,
Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Owlready2 0.3 has been released!

Mareike
Wow, that was quick, thanks! I'll try it out right away :)

Cheers,
Mareike