Fetching contributors…
Cannot retrieve contributors at this time
184 lines (127 sloc) 5.83 KB
---+ Thea2 : Prolog Modules for OWL2
A collection of modules for parsing and manipulating OWL2 ontologies
in Prolog. It is developed with SWI-Prolog in mind, but the goal is to
maximize portability with other prologs, such as Yap and XSB.
This documentation is intended to be read via pldoc
---++ Installation
You can bypass installation and use the 'thea' script directly. See
---++ Overview
The module provides a means of loading and saving OWL2
axioms in a prolog model using predicates such as load_axioms/3 and
save_axioms/3. For example =|load_axioms('pizza.owl').|=
The model is documented in, and is based on Structural
Specification and Functional-Style Syntax for OWL2
( Predicate names such as
subClassOf2/, equivalent_to/2 and class/1 can be used to query an
in-memory prolog database.
For example:
:- use_module(library(thea2/owl2_io)).
:- use_module(library(thea2/owl2_model)).
show_superclasses(OntFile,Class) :-
The database can be manipulated via assert_axiom/2 and
retract_axiom/2. For more advanced OWL pattern matching and
replacement, see
The Semantic Web Rule Language (SWRL) is also supported via
A number of different reasoners can be used - the module provides predicates such as reasoner_ask/2, which can
be used to query over an entailed knowledge base. A variety of
reasoners can be plugged in, both native prolog and non-prolog (the
latter accessed seamlessly via either or
---++ Command Line Usage
The script "thea" in the bin directory should work from anywhere, with
no installation of thea modules required.
thea --help
for full instructions. Many complex operations can be chained on the
command line.
See also the other wrapper scripts in the bin directory
See Command_Line_Usage.txt for more details
---++ Further Reading
* Cookbook.txt - a collection of recipes for various tasks
* Reasoning_using_Thea.txt - how to use reasoners
See also the apps/ directory for example applications.
---++ Module Manifest
* -- reading/writing OWL from different sources, including:
* -- requires library(semweb)
* -- requires library(semweb)
* -- support for OWL-XML
* -- incomplete support for Manchester syntax
* -- infix prolog syntax for OWL
* -- definition of prolog predicates used to embed OWL
* -- allows SWRL to be parsed by
* -- pluggable reasoner framework
* (requires JPL)
* -- misc utilities
* -- prolog ontology processing language
* -- information about OWL axiom types
---++ Reasoning support
The DLP subset of OWL2-DL can be translated to logic programs using a
transormation defined by Grosof. See
The resulting programs can be used with Prologs such as Yap and
XSB. There are also hooks for answer set programming and disjunctive
datalog systems such as DLV.
There is also a very partial TBox reasoner in, and an
ad-hoc reasoner in that can be used with a
non-tabled prolog such as SWI; however, this gives incomplete results.
The DIG interface from Thea1 has yet to be converted. However, as we
now have OWLLink support, and DIG is being retired in favor of OWLLink.
You can also use java reasoners via the OWLAPI bridge. See
For more information see Reasoning_using_Thea.txt
---++ Relationship to SWI-Prolog SemWeb Library
Currently we use to translate from OWL RDF-XML to OWL
axioms. This 'consumes' the triples in the RDF database. Eventually we
would like a dynamic view over an RDF database, although this will be
difficult due to the non-monotonic nature of the mapping between RDF
and OWL.
---+++ On namespaces
Currently all IRIs are treated as Prolog atoms. This makes for
slightly verbose axioms, especially if long URLs are used.
One possible future option is to use the semweb library and
rdf_register_ns/2 to allow for convenient specification of namespaces
using a QName-like mechanism. This is not currently
implemented. Comments welcome.
One possibility is to simply rewrite the ontology using more compact
atoms. Even though the OWL spec dictates that well-formed IRIs should
be used, Thea allows you to use any unique atom to identify an
entity. See remove_namespaces/0 in for details. Of course,
care must be taken when doing this.
---++ Prolog Compatibility
The goal is to keep the core ISO compliant and usable across prolog
systems but this is difficult due to the different implementations of
modules in different Prolog engines. We develop for SWI-Prolog and are
aiming for full support for Yap in the near future.
See the iso/ directory for a dynamically generated version of some
Thea modules, stripped of module declarations. This is usable in
no-module systems like GNU Prolog and systems with incompatible module
syntax such as XSB. Only a subset of Thea functionality will be
available here, as SWI/Yap specific libraries are used for RDF, XML
and Java interaction.
---++ Sample Applications
See the apps/ director
---+++ Web interface
There is the beginnings of a primitive web front end:
* apps/webthea/
---+++ Obol - label parsing and generation
* apps/labelgen/
---+++ MIREOT - selective migration of referenced classes into an ontology
* apps/mireot/
---++ Authors
This module is a continuation of Thea1, developed by VV.
Some of the code was developed by CJM
Contributions from:
* Martin Güther