Owlready2

Owlready2 is a module for ontology-oriented programming in Python 3.

documentation download stats

Owlready2 can:

  • Import OWL 2.0 ontologies in NTriples, RDF/XML or OWL/XML format.
  • Export OWL 2.0 ontologies to NTriples or RDF/XML.
  • Manipulates ontology classes, instances and properties transparently, as if they were normal Python objects.
  • Add Python methods to ontology classes.
  • Perform automatic classification of classes and instances, using the HermiT reasoner.
  • Tested up to 100 millions of RDF triples (but can potentially support more).
  • In addition, the quadstore is compatible with the RDFlib Pyton module, which can be used to perform SPARQL queries.

Owlready2 has been created by Jean-Baptiste Lamy (my email is on the left) at the LIMICS reseach lab, University Paris 13, Sorbonne Paris Cité, INSERM UMRS 1142, Paris 6 University. It is available under the GNU LGPL licence v3.

If you use Owlready2, please cite the following article:

Lamy JB. Owlready: Ontology-oriented programming in Python with automatic classification and high level constructs for biomedical ontologies. Artificial Intelligence In Medicine 2017;80:11-28

Comments

Owlready2 0.12 has been released!

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

This new major version uses a new quadstore, with better performances, and has been tested up to 200 millions of RDF triplets (can load DBpedia!). PostgresQL support has been dropped because its interest was very limited (performances were poor compared to Sqlite3).

Here are the changes in version 0.12:

  • New quadstore
  • Numerical search (NumS, e.g. all patients with age > 65)
  • Nested searches
  • Synchronization for multithreading support
  • Add Class.inverse_restrictions() and Class.direct_instances()
  • Drop PostgresQL support (little interest: more complex and slower than Sqlite3)
  • Bugfixes: - Fix call to _get_by_storid2 - Fix rdfs_subclassof in doc - Fix FTS triggers - Fix boolean in RDFlib / SPARQL - Fix bug when destroying an AnnotationProperty

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

Owlready2 0.11 has been released!

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

This new version brings two major new features: the support for Pellet reasoner and the optimized full-text search.

Here are the changes in version 0.11:

  • Optimized Full-Text Search
  • Support Pellet reasoner in addition to HermiT
  • Support loading of huge OWL files (incremental load)
  • Use Class.property.indirect() for indirect Class property (instead of Class.property)
  • Add reload and reload_if_newer parameters to Ontology.load()
  • search() is now much faster on properties that have inverse
  • Add shortcut for SOME ConstrainedDatatype: e.g. age >= 65
  • Bugfixes: - Fix creation of an individual that already exists in the quadstore - Fix missing import of EntityClass in class_construct.py - Fix World.save() with RDF/XML format - Fix Thing.subclasses() and Thing.descendants() - Fix ontology’s update time for ontologies created de novo in Python with Owlready - Fix reasoning when asserting new parents with equivalent classes

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

Owlready2 0.10 has been released!

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

This new version fixes many bugs and adds the support of ontology metadata. It also introduces the use of Cython, for improving performances when reading RDF/XML and OWL/XML files. Owlready2 is now able to read these files as fast as Java !

Here are the changes in version 0.10:

  • Add Ontology.metadata for adding/querying ontology metadata
  • Allows multiple individual creations with the same name/IRI, now returning the same individuals
  • Add OwlReadyInconsistentOntologyError and Word.inconsistent_classes()
  • Implement RDF/XML and OWL/XML parsing in Cython (25% speed boost for parsing)
  • Small optimization
  • Extend individual.prop.indirect() to include relations asserted at the class level
  • Add .query_owlready() method to RDF graph
  • Bugfixes: - Fix reasoning when obtaining classes equivalent to nothing - Fix World creation with backend parameters - Fix error when adding property at the class definition level - Fix loading of ontology files with no extension from onto_path - Fix properties defined with type ‘RDF Property’ and subproperty of ‘OWL Data/Object/Annotation Property’ - Support old SQLite3 versions that do not accept WITHOUT ROWID - Fix reference to undeclared entities (they were replaced by None, now by their IRI) - Fix loading and saving ontologies whose base IRI ends with / - Fix RDF query using string

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

Owlready2 0.9 has been released!

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

This new version allows the use of PostgresQL instead of SQLite3 (however, performances are usually lower). It also facilitate the access to SOME restrictions on classes, using the dotted notation “class.property”.

Here are the changes in version 0.9:

  • PostgresQL backend (in addition to SQLite3)
  • Add ‘exclusive = False’ option for SQLite3 backend (slower, but allows multiple uses)
  • Use unique index in sqlite3 quadstore on resources table
  • Optimize sqlite3 quadstore by caching IRI dict (5% faster)
  • Add == support for class construct
  • Add get_namespace() support on World
  • Add ‘existential restrictions as class properties’ feature
  • Bugfixes: - Fix imported ontologies - Fix saving ontologies in onto_path - Fix clear() on CallbackList - Fix bug in Class IRI in ontologies whose base IRI ends with a / - Fix imported ontologies in ontologies whose base IRI ends with a /

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

The great table of ontologies

This big table summarize 5 notations used with formal ontologies in OWL: description logics, the syntax of the Protégé editor, the syntax of Owlready2 in Python, and the semantics in first-order logic and in set formula. Keep on hand when working on formal ontologies!

You can download the great table of ontologies.

Owlready2 0.8 has been released!

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

Here are the changes in versions 0.6, 0.7 and 0.8 (the first two have lasted only a few hours):

  • Add set_datatype_iri() global function for associating a Python datatype to an IRI
  • Add nquads ontology format (useful for debugging)
  • Add support for dir() on individuals
  • Add support for ontology using https: protocol (thanks Samourkasidis Argyrios)
  • Add observe module (for registering callback when the ontology is modified)
  • Improve docs
  • Bugfixes: - Align Python floats with xsd:decimal rather than xsd:double, finally, because decimal accepts int too - Fix Class.instances() so as it returns instances of subclasses (as indicated in the doc) - Fix direct assignation to Ontology.imported_ontologies - Fix a bug in reasoning, when adding deduced facts between one loaded and one non-loaded entity - Fix search(prop = “value”) when value is a string and the ontology uses localized string

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

Owlready2 0.5 has been released!

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

This new version is mostly a bugfix release.

It be downloaded from PyPI (Python Package Index): https://pypi.python.org/pypi/Owlready2

Owlready2 0.4 has been released!

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

The main new features of version 2 - 0.4 are:

  • the defined relations can be queried for a given individual (using the .get_properties(), .get_inverse_properties() and .get_relations() methods)
  • improvement of the .search() method, which now takes into account inheritance and inverse relations
  • optimisation of recursive request in SQL
  • several bug fixes

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

Owlready2 0.3 has been released!

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

Owlready2 0.2 has been released!

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.2 version of Owlready now includes a RDF/XML written in Python. This parser can load big files rapidly.

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