Ontology mutation testing

Similar documents
OWL 2 Profiles. An Introduction to Lightweight Ontology Languages. Markus Krötzsch University of Oxford. Reasoning Web 2012

Presented By Aditya R Joshi Neha Purohit

OWL DL / Full Compatability

What is Mutation Testing? Mutation Testing. Test Case Adequacy. Mutation Testing. Mutant Programs. Example Mutation

Orchestrating Music Queries via the Semantic Web

The OWL API: An Introduction

Introduction to Protégé. Federico Chesani, 18 Febbraio 2010

Contents. G52IWS: The Semantic Web. The Semantic Web. Semantic web elements. Semantic Web technologies. Semantic Web Services

CHAPTER 1 INTRODUCTION

Ontological Modeling: Part 7

Languages and tools for building and using ontologies. Simon Jupp, James Malone

FIBO Metadata in Ontology Mapping

Falcon-AO: Aligning Ontologies with Falcon

CSc 8711 Report: OWL API

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

Simplified Approach for Representing Part-Whole Relations in OWL-DL Ontologies

H1 Spring B. Programmers need to learn the SOAP schema so as to offer and use Web services.

Programming THE SEMANTIC WEB. Build an application upon Semantic Web models. Brief overview of Apache Jena and OWL-API.

STS Infrastructural considerations. Christian Chiarcos

Ontology Design Patterns

Semantic Annotations for BPMN models: Extending SeMFIS for supporting ontology reasoning and query functionalities. Dimitraki Katerina

jcel: A Modular Rule-based Reasoner

Today: RDF syntax. + conjunctive queries for OWL. KR4SW Winter 2010 Pascal Hitzler 3

RESTful Encapsulation of OWL API

Semantics. Matthew J. Graham CACR. Methods of Computational Science Caltech, 2011 May 10. matthew graham

Main topics: Presenter: Introduction to OWL Protégé, an ontology editor OWL 2 Semantic reasoner Summary TDT OWL

protege-tutorial Documentation

A Heuristic Approach to Explain the Inconsistency in OWL Ontologies Hai Wang, Matthew Horridge, Alan Rector, Nick Drummond, Julian Seidenberg

Helmi Ben Hmida Hannover University, Germany

A keyword-driven approach for generating OWL DL conformance test data

A Tool for Storing OWL Using Database Technology

Web Ontology Language (OWL)

Adding formal semantics to the Web

Linked data and its role in the semantic web. Dave Reynolds, Epimorphics

An Architecture for Semantic Enterprise Application Integration Standards

Semantic Web and Natural Language Processing

GraphOnto: OWL-Based Ontology Management and Multimedia Annotation in the DS-MIRF Framework

Ontological Modeling: Part 11

WHY WE NEED AN XML STANDARD FOR REPRESENTING BUSINESS RULES. Introduction. Production rules. Christian de Sainte Marie ILOG

DAML+OIL: an Ontology Language for the Semantic Web

INF3580/4580 Semantic Technologies Spring 2017

Semantic Query Answering with Time-Series Graphs

COMP718: Ontologies and Knowledge Bases

Review. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals

Semantic Integration with Apache Jena and Apache Stanbol

Testing! Prof. Leon Osterweil! CS 520/620! Spring 2013!

OWL 2 Syntax and Semantics Sebastian Rudolph

INF3580 Semantic Technologies Spring 2012

Chapter 8: Enhanced ER Model

OWL 2 Update. Christine Golbreich

Table of Contents. iii

Extracting knowledge from Ontology using Jena for Semantic Web

Semantic Web Test

ONTOLOGY LIBRARIES: A STUDY FROM ONTOFIER AND ONTOLOGIST PERSPECTIVES

5 RDF and Inferencing

Ontology Driven Software Development with Mercury

Logics for Data and Knowledge Representation: midterm Exam 2013

Knowledge Representation for the Semantic Web

Semantic Web Tools. Federico Chesani 18 Febbraio 2010

QuickTime and a Tools API Breakout. TIFF (LZW) decompressor are needed to see this picture.

a paradigm for the Introduction to Semantic Web Semantic Web Angelica Lo Duca IIT-CNR Linked Open Data:

Semantic Web Update W3C RDF, OWL Standards, Development and Applications. Dave Beckett

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

Linked Open Data: a short introduction

MSc Advanced Computer Science School of Computer Science The University of Manchester

Semantic Web and Python Concepts to Application development

l A family of logic based KR formalisms l Distinguished by: l Decidable fragments of FOL l Closely related to Propositional Modal & Dynamic Logics

OWL 2 Profiles. An Introduction to Lightweight Ontology Languages. Маркус Крёч (Markus Krötzsch) University of Oxford. KESW Summer School 2012

OWL a glimpse. OWL a glimpse (2) requirements for ontology languages. requirements for ontology languages

Part I: Preliminaries 24

H1 Spring C. A service-oriented architecture is frequently deployed in practice without a service registry

Model Driven Engineering with Ontology Technologies

Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Semantic Web. Tahani Aljehani

MTAT : Software Testing

Week 4. COMP62342 Sean Bechhofer, Uli Sattler

Ontology Links in the Distributed Ontology Language (DOL)

OWL 2 The Next Generation. Ian Horrocks Information Systems Group Oxford University Computing Laboratory

Deep Integration of Scripting Languages and Semantic Web Technologies

CHAPTER 2. Overview of Tools and Technologies in Ontology Development

Semantic Web Fundamentals

JENA: A Java API for Ontology Management

White Box Testing III

(Refer Slide Time: 1:27)

Semantic Web Programming

Guided Tour: Intelligent Conceptual Modelling in EER and UML-like class diagrams with icom compared to ORM2

Ontology Building. Ontology Building - Yuhana

Chronos: A Tool for Handling Temporal Ontologies

Ontologies and OWL. Riccardo Rosati. Knowledge Representation and Semantic Technologies

DEVELOPMENT OF ONTOLOGY-BASED INTELLIGENT SYSTEM FOR SOFTWARE TESTING

Knowledge Representations. How else can we represent knowledge in addition to formal logic?

Interoperability of Protégé using RDF(S) as Interchange Language

Bryan Smith May 2010

Problem Solving with C++

AXIOMS OF AN IMPERATIVE LANGUAGE PARTIAL CORRECTNESS WEAK AND STRONG CONDITIONS. THE AXIOM FOR nop

OWL and tractability. Based on slides from Ian Horrocks and Franz Baader. Combining the strengths of UMIST and The Victoria University of Manchester

Whole Platform Foundation. The Long Way Toward Language Oriented Programming

Automation of Semantic Web based Digital Library using Unified Modeling Language Minal Bhise 1 1

Implementation and Experiments with an IFC-to-Linked Data Converter

Department of Computing Science and Mathematics University of Stirling. An Overview of Ontology Application for Policy-Based Management using POPPET

Transcription:

Ontology mutation testing February 3, 2016 Cesare Bartolini Interdisciplinary Centre for Security, Reliability and Trust (SnT), University of Luxembourg

Outline 1 Mutation testing 2 Mutant generation 3 OWL ontologies 4 OWL mutation testing 5 Validation Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 1 / 39

Outline 1 Mutation testing 2 Mutant generation 3 OWL ontologies 4 OWL mutation testing 5 Validation Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 2 / 39

What is testing Verifying the conformance of the System Under Test (SUT) to its requirements Many properties to verify Correctness Performance Security... Many different ways of testing Requires a Test Suite (TS) Manual, automated, test factory... Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 3 / 39

Testing 101 Figure: How to run a test Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 4 / 39

Testing 102 Figure: How standard testing works Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 5 / 39

Mutation testing Figure: Mutation testing process Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 6 / 39

Mutation essentials Figure: Mutation testing process Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 7 / 39

Step 1: normal test suite run Use the unmodified SUT ("golden") Run the test suite TS Right or wrong doesn t matter! Store the output R 0 in some format Text, XML, binary... Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 8 / 39

Step 1: normal test suite run Use the unmodified SUT ("golden") Run the test suite TS Right or wrong doesn t matter! Store the output R 0 in some format Text, XML, binary... Important! Tests should not fail (i.e., break execution) against the "golden" SUT. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 8 / 39

Step 1: normal test suite run Use the unmodified SUT ("golden") Run the test suite TS Right or wrong doesn t matter! Store the output R 0 in some format Text, XML, binary... Important! Tests should not fail (i.e., break execution) against the "golden" SUT. Consequently It s important to fix the TS first. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 8 / 39

Step 2: generate the mutants Start from ground string ("golden" SUT) Mutation operators Remove equivalent mutants (optional) Reduce number of mutants (optional) Store the mutated SUTs Have n mutants at the end Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 9 / 39

Step 3: mutant runs Batch runner Fetches a mutant Runs TS against the mutant Stores the results R 1,..., R n Rinse & repeat Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 10 / 39

Step 3: mutant runs Batch runner Fetches a mutant Runs TS against the mutant Stores the results R 1,..., R n Rinse & repeat Complexity Mutation testing can be very hard. Think of a TS with 100 tests run over a code which generates 10K mutants. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 10 / 39

Step 4: check the outputs Oracle compares results R1,..., R n against R 0 Comparison may be difficult Results differ: mutant is killed Results do not differ: mutant is alive Best result: 100% killed mutants Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 11 / 39

Step 4: check the outputs Oracle compares results R1,..., R n against R 0 Comparison may be difficult Results differ: mutant is killed Results do not differ: mutant is alive Best result: 100% killed mutants Important! Tests may fail (i.e., execution breaks) against the mutant. The result is different from the "golden" anyway. E.g., if the mutant introduces an infinite loop Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 11 / 39

Step 5: and now? Mutation testing tells me how good my test suite is Find patterns of live mutants But it can also give me insights on the SUT Example: mutants alive because path not covered Reason 1: missing a test in the TS (must add tests) Reason 2: unreachable code (must modify the SUT) Analysis can be complex Generally used for unit testing Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 12 / 39

Outline 1 Mutation testing 2 Mutant generation 3 OWL ontologies 4 OWL mutation testing 5 Validation Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 13 / 39

How mutant generation works Based on error testing or fault testing Hypothesis: the original SUT is correct Inject an error in the code A single error E.g., remove a semicolon Each error injection is a separate mutant Alive mutant TS cannot detect the error Specific tests should be added Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 14 / 39

Semantic mutant generation Traditional mutant generation is syntactic Can operate on the semantics E.g., + changed to - The system is still formally correct But now it should behave differently from the "golden" If it doesn t, then TS doesn t even go there, or TS goes there but code is irrelevant This can be an error in the code or in the test suite! Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 15 / 39

Typical mutation operations Remove statement Change variable type Change unary operators Change arithmetical operators Change comparison operators Change logical operators Reverse conditions Reverse then and else branches Change 1 into 0... Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 16 / 39

Typical mutation operations Remove statement Change variable type Change unary operators Change arithmetical operators Change comparison operators Change logical operators Reverse conditions Reverse then and else branches Change 1 into 0... Important! Never use random changes. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 16 / 39

Equivalent mutants Mutants are supposed to be different Two different mutants might behave identically Example for (int i = 1; i < n; i++) // "golden" for (int i = 0; i < n; i++) // Mutant 1 for (int i = 1; i <= n; i++) // Mutant 2 Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 17 / 39

Equivalent mutants Mutants are supposed to be different Two different mutants might behave identically Example for (int i = 1; i < n; i++) // "golden" for (int i = 0; i < n; i++) // Mutant 1 for (int i = 1; i <= n; i++) // Mutant 2 Techniques allow equivalent detection. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 17 / 39

Too many mutants? If TS is changed, mutation testing should be redone Possibly too much computation It may be necessary to further reduce the number of mutants Heuristics or algorithms such as Category Partition Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 18 / 39

Outline 1 Mutation testing 2 Mutant generation 3 OWL ontologies 4 OWL mutation testing 5 Validation Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 19 / 39

What is the Web Ontology Language (OWL)? Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 20 / 39

OWL essentials Knowledge representation Ontologies are descriptions of a knowledge domain RDF is too low-level OWL derives from DAML+OIL Representation of real-world objects Ontologies do not define anything Objects are defined in the domain itself Ontologies describe relations By means of axioms Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 21 / 39

OWL classification Syntax Abstract modelling with no mandatory syntax. Possibilities: RDF/XML (standard, XML-based, W3C) OWL/XML (uses own tagset, XML-based, W3C) Manchester (highly descriptive, almost textual) Turtle (descriptive, similar to SPARQL syntax)... Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 22 / 39

OWL classification Syntax Abstract modelling with no mandatory syntax. Possibilities: RDF/XML (standard, XML-based, W3C) OWL/XML (uses own tagset, XML-based, W3C) Manchester (highly descriptive, almost textual) Turtle (descriptive, similar to SPARQL syntax)... Semantics (OWL 2) OWL Full OWL-DL Several profiles Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 22 / 39

OWL classification Syntax Abstract modelling with no mandatory syntax. Possibilities: RDF/XML (standard, XML-based, W3C) OWL/XML (uses own tagset, XML-based, W3C) Manchester (highly descriptive, almost textual) Turtle (descriptive, similar to SPARQL syntax)... Semantics (OWL 2) OWL Full OWL-DL Several profiles Syntax and semantics are irrelevant for the present work. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 22 / 39

OWL structure Entities (named or anonymous) Classes Individuals Object properties Data properties Datatypes Annotations... Axioms Subclass Domain Range Class assertion... Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 23 / 39

Outline 1 Mutation testing 2 Mutant generation 3 OWL ontologies 4 OWL mutation testing 5 Validation Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 24 / 39

OWL mutation Figure: Perspectives Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 25 / 39

OWL mutation testing basics The SUT is the ontology TS built for the ontology E.g., SPARQL queries The tester must be able to run tests for the specific SUT E.g., SPARQL engine Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 26 / 39

A more practical perspective The SUT is the software TS built for the software E.g., input values for the program The tester only needs to run the software E.g., batch execution Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 27 / 39

Differences Testing the ontology Deeper analysis of the ontology Harder to develop tests (no specific functionality) Harder to say when the output is wrong Harder to compare results (ask later) The testing setup is more complex because OWL does not execute Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 28 / 39

Differences Testing the ontology Deeper analysis of the ontology Harder to develop tests (no specific functionality) Harder to say when the output is wrong Harder to compare results (ask later) The testing setup is more complex because OWL does not execute Testing the software Focus only on the software requirements Plenty of test generation methodologies Outputs are clearer Easy to compare outputs (the software has an output format) The testing setup must only invoke the program Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 28 / 39

Mutation operators: categories Five categories of operators Entities in general (E) Classes (C) Object properties (O) Data properties (D) Named individuals (I) Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 29 / 39

Mutation operators ERE Remove the entity and all its axioms Any entity ERL Remove entity labels ECL Change label language CRS Remove a single subclass axiom Class CSC Swap the class with its superclass CRD Remove disjoint class CRE Remove equivalent class OND Remove a property domain ONR Remove a property range ODR Change property domain to range Object property ORD Change property range to domain ODP Assign domain to superclass ODC Assign domain to subclass ORP Assign range to superclass ORC Assign range to subclass ORI Remove inverse property DAP Assign property to superclass Data property DAC Assign property to subclass DRT Remove data type IAP Assign to superclasses Individual IAC Assign to subclasses IRT Remove data type Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 30 / 39

Some examples ERE operator Completely removes an entity Also removes all axioms associated with it If it s a class, its subclasses become subclasses of Thing Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 31 / 39

Some examples ERE operator Completely removes an entity Also removes all axioms associated with it If it s a class, its subclasses become subclasses of Thing OND operator Removes a domain from an object property The object property actually expands its domain Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 31 / 39

Outline 1 Mutation testing 2 Mutant generation 3 OWL ontologies 4 OWL mutation testing 5 Validation Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 32 / 39

Experimental setup Programming language: Java 7+ Just because I haven t learnt lambda expressions yet Mutant generator: based on OWL API 4 SUT is the OWL ontology in RDF/XML format TS is set of SPARQL queries Query engine: based on Apache Jena/ARQ https://github.com/guerret/lu.uni.owl.mutatingowls Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 33 / 39

Experimental setup Programming language: Java 7+ Just because I haven t learnt lambda expressions yet Mutant generator: based on OWL API 4 SUT is the OWL ontology in RDF/XML format TS is set of SPARQL queries Query engine: based on Apache Jena/ARQ https://github.com/guerret/lu.uni.owl.mutatingowls Why two libraries? I had already developed a tool for operating on ontologies using OWL API, but OWL API does not manage SPARQL. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 33 / 39

How the testing works 1. Generate the mutants 1.1 Why this step first? 2. Run all queries on "golden" ontology 3. Store the results (not as text) 4. For each mutant: 4.1 Run all queries on the mutant 4.2 Compare against the "golden" results 4.3 Reset the ground results 4.4 Store if the mutant is killed or alive 5. Output a detailed report Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 34 / 39

Result comparison Mutation testing normally compares text SPARQL results may have a different order of the output Text is not an option Better to compare the mutants one by one Too much space needed to store all results Jena/ARQ has the order-neutral method ResultSetCompare.equalsByTerm But I must reset the "golden" results after each comparison By default, parsing "consumes" the data Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 35 / 39

Result comparison Mutation testing normally compares text SPARQL results may have a different order of the output Text is not an option Better to compare the mutants one by one Too much space needed to store all results Jena/ARQ has the order-neutral method ResultSetCompare.equalsByTerm But I must reset the "golden" results after each comparison By default, parsing "consumes" the data Why this? Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 35 / 39

Example Tried to reuse existing stuff, avoid bias Reference SUT: the pizza ontology http://protege.stanford.edu/ontologies/pizza/pizza.owl Set of SPARQL queries: not immediately available Found https://code.google.com/p/twouse/wiki/sparqlasexamples Had to convert back to SPARQL Very minimal, had to introduce two additional tests Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 36 / 39

Results Operator Mutants killed Total mutants Percentage ERE 108 112 96.43 ERL 95 95 100.00 ECL 95 95 100.00 CRS 255 255 100.00 CSC 83 83 100.00 CRD 471 753 62.55 CRE 41 41 100.00 OND 0 6 0.00 ONR 0 7 0.00 ODR 0 6 0.00 ORD 0 7 0.00 ODP 0 6 0.00 ODC 1 250 0.40 ORP 0 7 0.00 ORC 1 253 0.40 IRT 0 10 0.00 Other operators 0 0 0.00 Total 1150 1986 57.62 Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 37 / 39

Some preliminary analyses Considerations on the TS The TS mainly covers the class hierarchy More tests needed for properties and individuals Tests cover only a branch of the class hierarchy Tests needed for the rest Considerations on the SUT Some object properties are not used anywhere This might mean they are irrelevant Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 38 / 39

Future developments Full-fledged test suite Using both the ontology and the software relying on it as SUT Extend the set of mutation operators, e.g.: Change the OWL cardinality constraints Operate on annotations other than labels Algorithms to reduce the complexity (e.g., detect equivalents) Add a new, "structural" level of mutation (unique to ontologies), e.g.: Change a subclass axiom into an object property Create named classes from unnamed ones Split intersections into separate entities... Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 39 / 39

Future developments Full-fledged test suite Using both the ontology and the software relying on it as SUT Extend the set of mutation operators, e.g.: Change the OWL cardinality constraints Operate on annotations other than labels Algorithms to reduce the complexity (e.g., detect equivalents) Add a new, "structural" level of mutation (unique to ontologies), e.g.: Change a subclass axiom into an object property Create named classes from unnamed ones Split intersections into separate entities... This work will be presented at the AMARETTO workshop, co-located with the MODELSWARD conference, on February 19. Cesare Bartolini (SnT) Ontology mutation testing February 3, 2016 39 / 39