24
FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES Ontology Editing Sebastian Rudolph Dresden, July 2

Foundations of Semantic Web Technologies - Ontology Editing

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Foundations of Semantic Web Technologies - Ontology Editing

FOUNDATIONS OF SEMANTICWEB TECHNOLOGIES

Ontology Editing

Sebastian Rudolph

Dresden, July 2

Page 2: Foundations of Semantic Web Technologies - Ontology Editing

ContentOverview & XML 9 APR DS2 Hypertableau II 7 JUN DS5Introduction into RDF 9 APR DS3 Tutorial 5 11 JUN DS2RDFS – Syntax & Intuition 12 APR DS5 SPARQL Syntax & Intuition 11 JUN DS3RDFS – Semantics 16 APR DS2 SPARQL – Semantics 14 JUN DS2RDFS Rule-based Reasoning 16 APR DS3 SPARQL Algebra 14 JUN DS3Tutorial 1 19 APR DS5 SPARQL 1.1 14 JUN DS5OWL – Syntax & Intuition 26 APR DS5 Tutorial 6 18 JUN DS2Tutorial 2 3 MAY DS5 SPARQL Entailment 18 JUN DS3OWL – Syntax & Intuition ctd. 7 MAY DS2 Ontology Editing 2 JUL DS2OWL & Description Logics 7 MAY DS3 Ontology Engineering 2 JUL DS3OWL 2 10 MAY DS5 Tutorial 7 9 JUL DS2Tutorial 3 14 MAY DS2 Linked Data 9 JUL DS3Tableau I 14 MAY DS3 Applications 12 JUL DS5Tableau II 17 MAY DS5 Test Exam 16 JUL DS2Tutorial 4 7 JUN DS2 Test Exam Evaluation 16 JUL DS3Hypertableau I 7 JUN DS3 Q&A Session 19 JUL DS5

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 2 von 24

Page 3: Foundations of Semantic Web Technologies - Ontology Editing

Ontology Engineering

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 3 von 24

Page 4: Foundations of Semantic Web Technologies - Ontology Editing

Ontology Engineering

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 4 von 24

Page 5: Foundations of Semantic Web Technologies - Ontology Editing

Agenda• How can we work with an ontology in a programming environment?• How can we work with an ontology via a graphical interface?

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 5 von 24

Page 6: Foundations of Semantic Web Technologies - Ontology Editing

Agenda• How can we work with an ontology in a programming environment?• How can we work with an ontology via a graphical interface?

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 6 von 24

Page 7: Foundations of Semantic Web Technologies - Ontology Editing

Implementing OWL

What does “implementing OWL” mean?• modeling – provision of data structures representing an ontology• parsing – conversion of the textual representation of an ontology (e.g. in

RDF/XML) into corresponding data structures• serialization – conversion of the internal data structure into the textual

representation• manipulation – provision of methods for manipulating the data structures

or creating new ontological elements• inferencing – taking into account the OWL formal semantics

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 7 von 24

Page 8: Foundations of Semantic Web Technologies - Ontology Editing

Aspects of an Implementation• identify functionalities and responsibilities• representation

– syntax vs. data model– interface vs. implementation– locality of information

• parsing/serialization– abstraction from the concrete representation (e.g. as triples)

• manipulation– granularity– dependencies– intention of the user– strategies

• inferencing– distinguishing explicit and implicit consequences– external imnplementations

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 8 von 24

Page 9: Foundations of Semantic Web Technologies - Ontology Editing

What is an Ontology (from theImplementer’s Perspective)

• a certain syntactic representation?• facts that are represented via the syntactic representation?• information that is entailed by the represented facts?

• these questions are important when working with OWL• e.g.: which answers to expect when querying these data structures

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 9 von 24

Page 10: Foundations of Semantic Web Technologies - Ontology Editing

What is an Ontology (from theImplementer’s Perspective)

• a certain syntactic representation?• facts that are represented via the syntactic representation?• information that is entailed by the represented facts?

• these questions are important when working with OWL• e.g.: which answers to expect when querying these data structures

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 10 von 24

Page 11: Foundations of Semantic Web Technologies - Ontology Editing

The OWL API• the OWL API is such an implementation of OWL• meant for OWL DL• an ontology is represented by a set of axioms, which model information

about classes, roles and individuals• when is a class or role “in” an ontology?

– not precisely defined in OWL spec– somewhat depending on the implementation

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 11 von 24

Page 12: Foundations of Semantic Web Technologies - Ontology Editing

Data Structures of the OWL API• provides data structures forrepresenting ontologies• auxiliary classes for

– creating,– manipulating,– parsing,– rendering, and– inferencing over these structures

• the basic data structures represent objects of an ontology and areorganized according to the functional syntax of OWL of OWL

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 12 von 24

Page 13: Foundations of Semantic Web Technologies - Ontology Editing

The Ontology Object• an OWLOntology object represents an ontology• contains a set of axioms• “knows” what classes and roles are used in the ontology• may have an IRI as Name/ID and may be loaded from IRIs

– the ontology’s ID does not have to coincide with the IRI theontology is loaded from

– same holds for imported ontologies

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 13 von 24

Page 14: Foundations of Semantic Web Technologies - Ontology Editing

Loading an Ontology

OWLOntologyManager manager=OWLManager.createOWLOntologyManager();

OWLOntologyIRIMapper aMapper=new AutoIRIMapper(new File("/ont/"), false);

manager.addIRIMapper(aMapper);IRI rem=IRI.create("http://www.ex.org/ex.owl");IRI loc=IRI.create("file:/ont/ex.owl");OWLOntologyIRIMapper sMapper

=new SimpleIRIMapper(rem, loc);manager.addIRIMapper(sMapper);OWLOntology ont

=m.loadOntologyFromOntologyDocument(IRI.create("file:/ont/ont.owl"));

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 14 von 24

Page 15: Foundations of Semantic Web Technologies - Ontology Editing

Objects for Entities• the class OWLClass represents an (OWL) class• does not contain information about which axioms use it• axioms referring classes belong to an OWLOntology object• methods in OWLClass allow acessing information about the class in the

context of the ontology (convenience methods)• non-atomic classes use the interface OWLClassExpression

• analogous for properties: OWLObjectProperty andOWLDataProperty

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 15 von 24

Page 16: Foundations of Semantic Web Technologies - Ontology Editing

Adding Axioms

OWLDataFactory df=m.getOWLDataFactory();OWLClass student=df.getOWLClass(IRI.create("..."));OWLClass course=df.getOWLClass(IRI.create("..."));OWLObjectProperty takes

=df.getOWLObjectProperty(IRI.create("..."));OWLClassExpression sup

=df.getOWLObjectSomeValuesFrom(takes, course);OWLAxiom ax=df.getOWLSubClassOfAxiom(student, sup);manager.addAxiom(ont, axiom);

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 16 von 24

Page 17: Foundations of Semantic Web Technologies - Ontology Editing

Using a Reasoner• the class OWLReasoner is an interface, that is implemented by most of

the reasoners• contains methods, to interact with the reasoner

import org.semanticweb.owlapi.reasoner.OWLReasoner;import org.semanticweb.HermiT.Configuration;import org.semanticweb.HermiT.Reasoner.ReasonerFactory;...OWLReasonerFactory reasonerFactory

=new Reasoner.ReasonerFactory(); // HermiT factoryOWLReasoner reasoner

=reasonerFactory.createReasoner(ont);System.out.println(reasoner.isConsistent());System.out.println(reasoner.isSatisfiable(student));hermit.precomputeInferences(

InferenceType.CLASS_HIERARCHY);

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 17 von 24

Page 18: Foundations of Semantic Web Technologies - Ontology Editing

Visitor patterns in the OWL API• visitor: Encapsulate an operation that is to be performed on the elements

of an object structure as an object. The visitor pattern allows you to definea new operation without changing the classes of the targeted datastructure.[Design Patterns, Gamma et al.]

• allows for diverse operations over the data structures without overloadingthem with application-specific code

• good as long as the data structures don’t change• changes in the OWL standards (very) rare

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 18 von 24

Page 19: Foundations of Semantic Web Technologies - Ontology Editing

Example ClassExpressionVisitor• visitors implement the interface OWLClassExpressionVisitor which

needs a methof visit() per OWL class object• all implementations of the interface OWLClassExpression must

implement a method accept(OWLClassExpressionVisitorvisitor)

public interface OWLClassExpressionVisitor {void visit(OWLObjectUnionOf ce);... }

public interface OWLObjectUnionOfextends OWLClassExpression {

public void accept(OWLClassExpressionVisitor v) {visitor.visit(this); }

... }

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 19 von 24

Page 20: Foundations of Semantic Web Technologies - Ontology Editing

Applications for Visitors

allow for working with arbitrary OWL objects, for instance• conversion of classes or axioms into NNF• simplification of axioms• serialization into diverse formats

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 20 von 24

Page 21: Foundations of Semantic Web Technologies - Ontology Editing

Agenda• How can we work with an ontology in a programming environment?• How to work with an ontology via a graphical user interface?

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 21 von 24

Page 22: Foundations of Semantic Web Technologies - Ontology Editing

Ontology Editing with Protege• load mad-cow-start.owl in Protege• familiarize yourself with the ontology

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 22 von 24

Page 23: Foundations of Semantic Web Technologies - Ontology Editing

Ontology Editing mit Protege

given the following text, extend the ontology by the concepts pet+owner,dog+owner and vegetarian:

Pet owners are persons who own a pet. Dog owners are special pet owners inthat they own a dog.

Vegetarians are animals that do not eat other animals and neither do they eatparts of other animals.

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 23 von 24

Page 24: Foundations of Semantic Web Technologies - Ontology Editing

Ontology Editing with Protege• classify the ontology• you should obtain an unsatisfiable class mad+cow

TU Dresden, July 2 Foundations of Semantic Web Technologies Folie 24 von 24