Owlready2 0.30 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 version brings two new features:

  • a SPARQL engine which translates the queries into SQL. This engine is much faster than RDFlib (around 60x), it has no dependencies and a shorter loading time. It currently supports a subset of SPARQL: SELECT, INSERT and DELETE queries, sub-queries, UNION, OPTIONAL, FILTER, BIND, FILTER EXISTS, FILTER NOT EXISTS, all functions of SPARQL, blank node notation with square brackets, e.g. ‘[a XXX]’, and property path expressions except those with parentheses.

    This new SPARQL engine can be used as follows (see documentation):

    list(default_world.sparql("""<query>"""))
  • Dublin Core support via integrated OWL translation. It is possible to load Dublin Core directly as follows:

    dc = get_ontology("http://purl.org/dc/elements/1.1").load()

Here are the changes:

  • New native SPARQL engine that translates SPARQL queries to SQL

  • Direct support for Dublin Core via the integration of an OWL translation

  • Bugfixes: - Fix RecursionError when saving very deep ontologies to RDF/XML - Fix IRI of the form 'urn:uuid:...' - Fix loading ontologies that modify an imported property

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

Owlready2 0.29 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:

  • Bugfixes: - Fix installation as a requirement of another Python module

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

Owlready2 0.28 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 version fix an installation problem under Windows, and also improve the execution of reasoners under Windows (no more DOS windows).

Here are the changes:

  • Fix installation under Windows (contributed by CVK)

  • Under Windows, run the reasoners without opening a DOS windows

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

Owlready2 0.27 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:

  • When Pellet is called with debug >= 2 on an inconsistent ontology, Pellet explain output is displayed (contributed by Carsten Knoll)

  • Update doc theme (contributed by Carsten Knoll)

  • Adapt setup.py to allow 'python setup.py develop' and 'pip install -e .' (contributed by Carsten Knoll)

  • Add 'url' argument to Ontology.load() method

  • Add 'read_only' argument to World.set_backend() method

  • Bugfixes: - Fix XML/RDF file parsing/writing for entity having ':' in their name - Fix destroy_entity(), was leaking some RDF triples when class contructs or equivalent_to were involved - Fix 'Class1(entityname); Class2(entityname)' (was changing the individual namespace) - Fix annotation request on RDF annotation properties, e.g. label.label

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

English book "Ontologies with Python"

Ontologies with Python, Jean-Baptiste Lamy, Apress Éditions, 350 pages

My book "Ontologies with Python" has just been published by Apress editions.

This 350-pages book describes how to use OWL 2.0 ontologies in Python 3.x, with the Owlready2 Python module for ontology-oriented programming.

Use ontologies in Python, with the Owlready2 module developed for ontology-oriented programming. You will start with an introduction and refresher on Python and OWL ontologies. Then, you will dive straight into how to access, create, and modify ontologies in Python. Next, you will move on to an overview of semantic constructs and class properties followed by how to perform automatic reasoning. You will also learn about annotations, multilingual texts, and how to add Python methods to OWL classes and ontologies. Using medical terminologies as well as direct access to RDF triples is also covered.

Python is one of the most used programming languages, especially in the biomedical field, and formal ontologies are also widely used. However, there are limited resources for the use of ontologies in Python. Owlready2, downloaded more than 60,000 times, is a response to this problem, and this book is the first one on the topic of using ontologies with Python.

What You Will Learn:

  • Use Owlready2 to access and modify OWL ontologies in Python

  • Publish ontologies on dynamic websites

  • Perform automatic reasoning in Python

  • Use well-known ontologies, including DBpedia and Gene Ontology, and terminological resources, such as UMLS (Unified Medical Language System)

  • Integrate Python methods in OWL ontologies

Who Is This Book For: Beginner to experienced readers from biomedical sciences and artificial intelligence fields would find the book useful.

The book is an updated translation of the French book "Python et les ontologies" published at ENI éditions last year.

More informations on the editor website:

https://www.apress.com/fr/book/9781484265512

Owlready2 0.26 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 release includes a new module for displaying entities in Description Logics (DL), and bugfixes.

Here are the changes:

  • Module owlready2.dl_render allows rendering entities to Description Logics (contributed by Simon Bin)

  • Bugfixes: - Adjustment in the comparison of strings from SameAs and DiferrentFrom, allowing equal comparison regardless of the case-sensitive (contributed by Thiago Feijó) - Fix transitive equivalent_to relations between classes and OWL constructs - Fix AnnotationProperty[entity] where entity is a predefined OWL entity (e.g. comment or Thing) - Fix entity.AnnotationProperty where entity is a predefined OWL entity (e.g. comment or Thing) - Fix HermiT when reasoning on several ontologies with imports statement - Ignore "A type A", with a warning

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

Owlready2 0.25 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 release includes a few new features, and bugfixes.

Here are the changes:

  • Allow the declaration of custom datatypes with declare_datatype()

  • Support the annotation of annotations (e.g. a comment on a comment)

  • search() now support the "subproperty_of" argument

  • search() now support the "bm25" argument (for full-text searches)

  • Bugfixes: - Fix Concept.descendant_concepts() in PymedTermino2 - Update already loaded properties when new ontologies are loaded - Now accept %xx quoted characters in file:// URL - Improve error message on punned entities - Property.get_relations() now considers inverse properties - Fix "AttributeError: 'mappingproxy' object has no attribute 'pop'" error - Fix Thing.instances()

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

Owlready2 0.24 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 release includes several small changes and bugfixes. It now uses the Git versionning system, instead of Mercurial.

Here are the changes:

  • Support intersection of searches (e.g. World.search(...) & World.search(...))

  • Add owlready2.reasoning.JAVA_MEMORY

  • Move development repository to Git

  • Bugfixes: - Fix parsing of NTriples files that do not end with a new line - Fix KeyError with Prop.python_name when several properties share the same name - Fix get_ontology() calls in Python module imported by ontologies in a World that is not default_world - Fix use of PyMedTermino2 in a World that is not default_world - Fix World.as_rdflib_graph().get_context(onto) for ontology added after the creation of the RDFLIB graph - Fix destroying SWRL rules - Fix disjoint with non-atomic classes

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

Owlready2 0.23 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 release includes several small changes and bugfixes.

Here are the changes:

  • Add get_parents_of(), get_instances_of(), get_children_of() methods to ontology, for querying the hierarchical relations defined in a given ontology

  • Use Thing as default value for restrictions with number, instead of None

  • Add 'filter' parameter to save(), for filtering the entities saved (contributed by Javier de la Rosa)

  • Bugfixes: - Fix value restriction with the false value - Fix blank node loading from different ontologies - Fix constructs reused by several classes - Fix 'Class.is_a = []' was not turning the list into an Owlready list - Fix destroy_entity() - was not destroying the IRI of the entity - Improve setup.py: ignore Cython if Cython installation fails

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

Owlready2 0.22 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:

  • Add support for disjoint unions (Class.disjoint_unions)

  • Add deepcopy support on class constructs, and automatically deep-copy constructs when needed (i.e. no more OwlReadySharedBlankNodeError)

  • Support the creation of blank nodes with RDFlib

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

Owlready2 0.21 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 realease fixes several bugs and now includes Pellet 2.3.1 (same version as in Protégé) instead of version 2.4 (which seems to have problems with some SWRL builtins).

Here are the changes:

  • Use Pellet 2.3.1 (same version as Protégé) instead of 2.4 (which has a bug in SWRL for many builtin predicates including equals and matches)

  • Much faster mangement of annotations on relations

  • Bugfixes: - Fix bug on blank node in RDFlib/SPARQL support - Fix bug on blank node deletion in RDFlib/SPARQL support - Fix data loss in Restriction modification - Fix 'no query solution' error in search() - Fix literal support in RDF lists, causing "TypeError: '<' not supported between instances of 'NoneType' and 'int'" when saving ontologies - Fix DifferentFrom SWRL builtin - Fix string parsing in SWRL rules - Fix string and boolean literal representation (str/repr) in SWRL rules - Fix the inverse of subproperties having a symmetric superproperty

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

French book "Python et les ontologies"

Python et les ontologies, Jean-Baptiste Lamy, ENI Éditions, 310 pages

My French book "Python et les ontologies" has been published by ENI editions.

This 310-pages book describes how to use OWL 2.0 ontologies in Python 3.x, with the Owlready2 Python module for ontology-oriented programming.

More informations (in French) on the editor website:

https://www.editions-eni.fr/livre/python-et-les-ontologies-9782409020223

I plan to translate the book in English in the coming year.

Owlready2 0.20 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 fix an important bug in UMLS support.

It also stops considering as functional properties associated with exactly-1 or max-1 restrictions. This was intended to be a feature, but was actually often more annoying that desirable. If needed, you can restore the previous behaviour as follows:

import owlready2.prop
owlready2.prop.RESTRICTIONS_AS_FUNCTIONAL_PROPERTIES = True

Here are the changes:

  • Add support for undoable destroy_entity()

  • Small database optimizations

  • No longer treat properties associated with exactly-1 or max-1 restriction as functional properties, returning single values instead of a list

  • Bugfixes: - Fix performance bug on UMLS mapping in PyMedTermino

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

Owlready2 0.19 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 has a better SPARQL support, faster searches, and it adds the "individual.INVERSE_property" syntax. It also supports the new UMLS zipped file format.

Here are the changes:

  • Consider symmetric properties as their own inverse properties

  • Update Python objects after basic SPARQL update/delete queries (works on user-defined properties, hierarchical properties (type/subclassof) and equivalence properties)

  • Add individual.INVERSE_property

  • Add Class.INDIRECT_is_a

  • INDIRECT_is_a / INDIRECT_is_instance_of now include class contructs. ancestors() has a 'include_constructs' parameter, which defaults to False.

  • Add more aliases for XMLSchema datatypes

  • Add is_a property to class constructs

  • Add bottomObjectProperty and bottomDataProperty

  • Support ReflexiveProperties in individual.INDIRECT_property

  • Optimize Thing.subclasses()

  • Optimize search() with multiple criteria, including those done by PyMedTermino

  • Add support for destroy_entity(SWRL_rule)

  • Add support for UMLS "metathesaurus" format in addition to "full" format

  • Bugfixes: - After reasoning, keep all equivalent classes as parents of individuals (as they may have methods) - Fix IndividualPropertyAtom when creating SWRL rule - Fix SWRL parser - Fix RDF serialization for nested RDF lists - Fix removing inverse property (i.e. Prop.inverse = None) - Fix datetime parsing for date with time zone or milliseconds

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