Skip to main content

What is Mastro?

Mastro is an Ontology-Based Data Access (OBDA) management system. Ontologies in Mastro are specified through languages belonging to the DL-Lite family of lightweight Description Logics. The ontology is connected to external relational data management or data federation systems through a mapping establishing a semantic relation between SQL queries issued over the underlying databases and elements of the ontology. To access data, users can specify SPARQL queries over the ontology and make use of the query answering services provided by Mastro. Mastro is developed in JAVA.

Main functionalities

The core of the Mastro system is the ontology reasoner, which provides the following main functionalities: ontology classification; consistency checking of the OBDA specification; intentional reasoning services such as subsumption and disjunction between concepts, between roles, and between attributes, and concept, role, or attribute satisfiability; query answering. Below we provide details for each functionality.

Ontology Classification

Ontology classification is the reasoning service that computes all subsumption relationships inferred in an ontology between concept, role, and attribute names in the ontology signature. Ontology classification in Mastro is implemented through an original algorithm tailored to OWL 2 QL and DL-Lite, which is based on the idea of encoding the intentional level of ontology (the TBox) into a directed graph, and reducing core reasoning to computation of the transitive closure of the graph.

OBDA Specification Consistency Check

An OBDA specification is constituted by an ontology, a source relational database schema, and a mapping between the ontology and the source schema. Consistency check amounts to verifying if the specification is satisfiable, i.e., given a database instance D for the source schema, establishing whether there exists at least a first-order interpretation I that satisfies both all the axioms in the ontology (i.e., I is a model for the ontology), and the mapping. To satisfy the mapping, I has to satisfy all ABox assertions (i.e., instances of the ontology) that can be constructed from the source database D according to the mapping. To this aim, Mastro produces a set of consistency checking queries, each associated to an ontology assertion whose contradiction leads to the unsatisfiability of the OBDA specification. Consistency check is then realised by answering each such query over the OBDA specification (given a database instance for the source schema). The ontology assertions considered in this step are: disjunction, functionality, denial, and identification assertions, plus EQL constraints.

Intentional Reasoning Services

Mastro provides a set of intensional reasoning services, essentially through extensions of the algorithm for ontology classification. In fact this algorithm allows also to classify positive OWL 2 QL and DL-Lite expressions, thus providing a more powerful service than traditional classification (which is limited to the elements in the ontology signature). A variant of this technique allows us to obtain the list of all disjointnesses between concepts, roles, or attributes inferred by the ontology, and, consequently, the list of unsatisfiable concepts, roles, or attributes (if any), i.e., those entities that have an empty interpretation in every model of the ontology. Such computations are done against every change of the ontology in the OBDA specification, and results thus obtained remain available for specific requests (and are also exploited by the query answering algorithm of Mastro).

Query Answering

Mastro is able to answer unions of conjunctive queries (i.e., UNION-SELECT-PROJECT-JOIN queries) over ontologies specified in SPARQL. Such queries are interpreted under the classic first-order semantics for conjunctive queries in the presence of incomplete information. The query answering process is performed into two steps: first, the user query is reformulated according to the inclusion assertions expressed in the ontology TBox. In this step Mastro makes use of the optimized algorithm Presto. The expanded query is then unfolded according to the mapping, and evaluated by means of the SQL engine of DBMS managing the data sources.
Besides unions of conjunctive queries, Mastro is also able to answer EQL Queries, i.e., first-order queries interpreted under a semantics based on Epistemic Logic. Thus, though under a suitable approximation semantics, Mastro allows for first-order queries to be evaluated over a DL-Lite or OWL 2 QL ontology.

Architecture of the System

Mastro relies on several standard languages: OWL 2 QL for ontology specification, SPARQL for query specification, R2RML for mapping specification. Mastro is also able to manage ontologies specified in DL-LiteA enriched with identification assertionsdenial assertions, and EQL constraints, a particular form of first-order constraints interpreted under a semantics based on Epistemic Logic. Therefore, Mastro supports the most expressive languages belonging to the DL-Lite family of Description Logics, and can go beyond the expressiveness of OWL 2 QL.

The Data Source Manager enables interactions with the most popular commercial and non-commercial DBMSs. Among the other, supported is provided for Oracle, DB2, SQLServer, MySQL, and Postgres. Mastro can also operate as a reasoner for stand-alone OWL 2 QL and DL-Lite ontologies, providing both intensional reasoning services and extensional services, such as ontology consistency check and query answering. In this modality, the extensional level of the ontology is stored in a relational DBMS. DL-Lite or OWL 2 QL ontologies given as input to Mastro are parsed through the standard OWLAPI

Download and licensing

Download Mastro

Contact us at


Contact us at