41
Thomas Schmidt schmidt@informatik. haw-hamburg.de Semantic Web Technologies: Examples • Representing Knowledge: Modelling Thesauri and such • Web Ontology Language for Services (OWL-S) • The Semantic of Hyperlinks

Semantic Web Technologies: Examples - HAW Hamburgusers.informatik.haw-hamburg.de/~schmidt/wss/examples.pdfThomas Schmidt schmidt@informatik. haw-hamburg.de Semantic Web Technologies:

  • Upload
    hakien

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Thomas Schmidtschmidt@informatik.

haw-hamburg.de

Semantic Web Technologies:Examples

• Representing Knowledge:Modelling Thesauri and such

• Web Ontology Language for Services (OWL-S)• The Semantic of Hyperlinks

Thomas Schmidtschmidt@informatik.

haw-hamburg.deRepresenting Knowledge

• In the Semantic Web we want to discover and apply knowledge …

• More specifically: we want to built ontologies from existing knowledge and use these for inference …

• Practical approach:

- Take available taxonomies, thesauri, etc. and formulate them in OWL

- Use reasoner to apply OWL model

• Inject knowledge into applications

Thomas Schmidtschmidt@informatik.

haw-hamburg.de

Example:

ACM ComputingClassification System

Thomas Schmidtschmidt@informatik.

haw-hamburg.deSimple RDFS Approach:ACM (XML):

<node id="B." label="Hardware"><isComposedBy><node id="B.0" label="GENERAL" /><node id="B.1" label="CONTROL STRUCTURES ">

<isComposedBy><node id="B.1.1" label="Control Design Styles">

Hardware

Control Structures

Control Design Styles

rdfs:subClassOF

rdfs:subClassOF

OWL:

<owl:Class rdf:ID=“CONTROL STRUCTURES"><rdfs:subClassOf rdf:resource=“#Hardware”/>

</owl:Class>…

Thomas Schmidtschmidt@informatik.

haw-hamburg.deACM Relations

<node id="B." label="Hardware"><isComposedBy><node id="B.0" label="GENERAL" /><node id="B.1" label="CONTROL STRUCTURES ">

<isRelatedTo><node id="D.3.2" label=“Languages" /></isRelatedTo><isComposedBy><node id="B.1.1" label="Control Design Styles">

Hardware

Control Structures

Control Design Styles

rdfs:subClassOF

rdfs:subClassOF

Languages ACM:isRelatedTo

Thomas Schmidtschmidt@informatik.

haw-hamburg.deAdditional Property: “Relation”

• Not expressible in a class hierarchy• Can be characterised in OWL & applied

• transitive, symmetric …

• But: class-valued (≠ rdf:type …)⇒ OWL Full needed

⇒ Expression of simple thesauri problematic in OWL

Thomas Schmidtschmidt@informatik.

haw-hamburg.deA Simpler Example

Books onLions:

:TheAfricanLionBooka :Book ;:bookTitle "The African Lion" ;dc:subject :AfricanLion

:AfricanLiona owl:Class;rdfs:subClassOf :Lion

Typical problem:

:BookAboutAnimalsa owl:Class ;rdfs:subClassOf[ a owl:Restriction ;owl:someValuesFrom :AnimalClass ;owl:onProperty dc:subject

]

Thomas Schmidtschmidt@informatik.

haw-hamburg.deOWL DL Approaches (I)

Individuals inparallel

:LionsLifeInThePrideBooka :Book ;:bookTitle "Lions: Life in the Pride" ;dc:subject :LionSubject

Now:

:BookAboutAnimalsa owl:Class ;rdfs:subClassOf[ a owl:Restriction ;owl:someValuesFrom :Animal ;owl:onProperty dc:subject

]

Thomas Schmidtschmidt@informatik.

haw-hamburg.deOWL DL Approaches (II)

Unspecifiedclass members

:LionsLifeInThePrideBooka :BookAboutAnimals ;[ a owl:Restriction ;owl:onProperty dc:subject ;owl:someValuesFrom :Lion

]; :bookTitle "Lions: Life in the Pride" ;

Now:

BookAboutAnimals predefined

http://www.w3.org/TR/swbp-classes-as-values/

Use case: ACM Computing Classification System

Thomas Schmidtschmidt@informatik.

haw-hamburg.de

• ACMCCS 1998 (latest version)http://www.acm.org/class

• Widely used in classification of conference papers and articles in computer sciences.

• Structure:– 11 first level nodes– Each list of children for a first or

second level node contains at least one General (0) node and one Miscellaneous (m) node.

– Contains ‘see also’ references between certain nodes

• Represent in processableOntology (not OWL Full)

A.General Literature

A.0General

A.2Reference

A.1Introductory and Survey

A.mMiscellaneous

A.0.0Biographies/

autobiographies

A.0.1Conference Proceedings

A.0.2General literary works

Thomas Schmidtschmidt@informatik.

haw-hamburg.deUse case: Scenario

Idea• Classify content according to ACMCCS98• Enhance search mechanisms by using ACMCCS98 scheme to

discover related information

ToDo• Add classifier to content• Build ontology representation of ACMCCS98• Implement application logic ☺

Thomas Schmidtschmidt@informatik.

haw-hamburg.deSKOS

• SKOS = Simple Knowledge Organisation Systems (http://www.w3.org/2004/02/skos/)

• Outcome of the European SWAD project• Meta Model for representing thesauri a.s. • Built as RDF Schema with OWL property characteristics• Semantic of ‘Concepts’ less restrictive than OWL classes• Provides association of (several) words or phrases to concepts

Thomas Schmidtschmidt@informatik.

haw-hamburg.deSKOS

• OWL complaint framework for building concept schemes

• Basic constructs:– skos:ConceptScheme

– skos:Concept

– skos:narrower

– skos:broader

– skos:related

• Knowledge Entities are Concepts, grouped in a Concept Scheme

http://www.w3.org/2001/sw/Europe/reports/thes/1.0/guide/

Thomas Schmidtschmidt@informatik.

haw-hamburg.deExpressing ACMCCS98 in SKOS

<skos:Concept rdf:about=“C.2.6"><skos:externalID>C.2.6</skos:externalID><skos:prefLabel xml:lang="en">

Internetworking</skos:prefLabel><skos:inScheme rdf:resource=“." /><skos:narrower rdf:resource="C.2.6.1" /><skos:narrower rdf:resource="C.2.6.2" /><skos:related rdf:resource="C.2.2" />

</skos:Concept>

Thomas Schmidtschmidt@informatik.

haw-hamburg.de☺ A part of the RDF data model

Thomas Schmidtschmidt@informatik.

haw-hamburg.deCode Fragments: Obtaining an Inference Model

1. Load SKOS schema (from the web):Model schema = ModelLoader.loadModel(

"http://www.w3.org/2004/02/skos/core.rdf");

2. Load data (ACM instances of SKOS from local file):Model data = ModelLoader.loadModel("acmskos.rdf“);

3. Obtain reasoner (SKOS is build upon OWL, so we need an OWL-capable reasoner):Reasoner reasoner = ReasonerRegistry.getOWLReasoner();

4. Binding schema:reasoner = reasoner.bindSchema(schema);

5. Creating Inference Model:InfModel infModel = ModelFactory.createInfModel(reasoner,

data);

Thomas Schmidtschmidt@informatik.

haw-hamburg.deGetting the non-obvious

//get subject we want information onResource subject = infModel.getResource(

“http://www.acm.org/class/1998/B.8”);

//get type of information (only ‘related’ concepts)Property predicate = infModel.getProperty(

"http://www.w3.org/2004/02/skos/core#related");

//get iterator to all statements matching the given conditionsStmtIterator it = infModel.listStatements(subject, predicate,

null);

//get perfLabel of the first statement returnedString label = it.nextStatement().getProperty(

“http://www.w3.org/2004/02/skos/core#prefLabel”).getString()

Thomas Schmidtschmidt@informatik.

haw-hamburg.deUse Case: eLearning Objects content augmentationIdea• LOM relations expressing connection between eLOs• Relations are qualified• Use LOM relations to suggest further content to the learner

ToDo• Map LOM relations into an ontology• Implement application logic

Thomas Schmidtschmidt@informatik.

haw-hamburg.deSimple scheme representing LOM Relations• Relations referencing other eLearning Objects

owl:ObjectProperties• All relation qualifiers have an inverse equivalent (eg.

isBasisFor isBasedOn)owl:inverseOf

• Qualifiers could be declared as being transitiveowl:TransitivProperty

<owl:ObjectProperty rdf:ID="isBasedOn"><rdf:type rdf:resource="&owl;TransitiveProperty"/><rdfs:range rdf:resource="#LearningObject"/><rdfs:domain rdf:resource="#LearningObject"/>

</owl:ObjectProperty>

<owl:ObjectProperty rdf:ID="isBasisFor"><owl:inverseOf rdf:resource="#isBasedOn" />

</owl:ObjectProperty>

Thomas Schmidtschmidt@informatik.

haw-hamburg.deSample Instances<LearningObject rdf:about="&hylos;DexteReferModel/DexteReferModel.xml">

<title>Dexter</title><isBasedOn rdf:resource="&hylos;MemexVBush1945/MemexVBush1945.xml"/><hasPart rdf:resource="&hylos;DexteDefic/DexteDefic.xml" />

</LearningObject>

<LearningObject rdf:about="&hylos;DexteStora/DexteStora.xml"><title>Dexter Storage</title><isPartOf rdf:resource="&hylos;DexteReferModel/DexteReferModel.xml" />

</LearningObject>

<LearningObject rdf:about="&hylos;AmsteHyperModel/AmsteHyperModel.xml"><title>Amsterdam Hypermedia Model</title><isBasedOn rdf:resource="&hylos;DexteReferModel/DexteReferModel.xml"/>

</LearningObject>

Thomas Schmidtschmidt@informatik.

haw-hamburg.deComfortable Vocabularies• Use the Jena tool schemagen to build vocabulary (java) classes from OWL files

(http://jena.sourceforge.net/how-to/schemagen.html)

<owl:ObjectProperty rdf:ID="isBasisFor"><owl:inverseOf rdf:resource="#isBasedOn" /><rdfs:comment rdf:datatype="&xsd;string">

LOM.Relations.kind is basis for</rdfs:comment>

</owl:ObjectProperty>

/**<p>The ontology model that holds the vocabulary terms</p>*/private static OntModel m_model =

ModelFactory.createOntologyModel(ProfileRegistry.OWL_LANG );

/** <p>LOM.Relations.kind is basis for</p> */public static final ObjectProperty isBasisFor =

m_model.createObjectProperty("http://hylos.fhtw-berlin.de/HylosLOM#isBasisFor" );

Thomas Schmidtschmidt@informatik.

haw-hamburg.deGetting something out of the Inference Model

1. Create Inference Model:Model schema = ModelFactory.loadModel(“hylosLOM.owl”);Model data = ModelFactory.loadModel(“lomData.rdf”);Reasoner reasoner = ReasonerRegistry.createOWLReasoner();reasoner = reasoner.bindSchema(schema);InfModel infModel = ModelFactory.createInfModel(reasoner,

data);

2. Querying the model:Resource s = infModel.getResource(“…AmsteHyperModel.xml”);for( StmtIterator it = infModel.listStatements(s,

HylosLOMVocab.isBasedOn, null); it.hasNext(); ) {

System.out.println(PrintUtil.print(it.nextStatement());}

Thomas Schmidtschmidt@informatik.

haw-hamburg.deRules – Basis for inference

• OWL reasoner is based upon specific rules which model the OWL assertions and constraints

• Applied ruleset could be obtained from FBRuleReasoner via getRules() : List

• Rules are created using Rules.parseRule(String) : Ruleor Rules.parseRules(String) : List

For detailed information on the inference system refer to http://jena.sourceforge.net/inference/index.html

Thomas Schmidtschmidt@informatik.

haw-hamburg.deRule DefinitionRule := bare-rule .

or [ bare-rule ]or [ ruleName : bare-rule ]

bare-rule := term, ... term -> hterm, ... hterm // forward rule or term, ... term <- term, ... term // backward rule

hterm := term or [ bare-rule ]

term := (node, node, node) // triple pattern or (node, node, functor) // extended triple pattern or builtin(node, ... node) // invoke procedural primitive

functor := functorName(node, ... node) // structured literal node := uri-ref // e.g. http://foo.com/eg

or prefix:localname // e.g. rdf:typeor ?varname // variableor 'a literal' // either a string or a number or number // e.g. 42 or 25.5

Thomas Schmidtschmidt@informatik.

haw-hamburg.deCreating own rules

• If A is based on B and B has part C then A is also based on C [myrule1: (?A http://hylos.fhtw-berlin.de/HylosLOM#isBasedOn?B) (?B http://hylos.fhtw-berlin.de/HylosLOM#hasPart ?C) -> (?A http://hylos.fhtw-berlin.de/HylosLOM#isBasedOn ?C)]

• If A is based on B and B is part of C then A is also based on C[myrule2: (?A http://hylos.fhtw-berlin.de/HylosLOM#isBasedOn?B) (?C http://hylos.fhtw-berlin.de/HylosLOM#isPartOf ?B) -> (?A http://hylos.fhtw-berlin.de/HylosLOM#isBasedOn ?C)]

Thomas Schmidtschmidt@informatik.

haw-hamburg.deExtending the standard ruleset

String RULE_FILE = “own.rules”;

//load rules from file own.rulesList rules =

Rule.parseRules(Util.loadResourceFile(RULE_FILE));

//add rules to the existing ruleset((OWLFBRuleReasoner) reasoner).getRules().addAll(rules);

/* * bind schema to reasoner*/

• Attention: ruleset has to be loaded before the schema is bound to the reasoner.

Thomas Schmidtschmidt@informatik.

haw-hamburg.deOWL-S

• Web Ontology Language for Services

• Idea: Provide a computer-interpretable description of a Web Service and any means to access it

• Ontology Standard consisting of basic classes and properties fordeclaring and describing services

• Originally DAML-S from DAML Initiative

• Release 1.0 by DAML (Nov 2003)

• Now: Release 1.1 – Submission to W3C

Thomas Schmidtschmidt@informatik.

haw-hamburg.deMotivation + Use Cases

Goals: Enable agents to discover, invoke, verify, interoperate, composeand monitor Web Services:

1. Automatic Web Service Discovery: Enable declarative advertisements of properties and capabilities

“Find a service, that sells skiing lift tickets for my place and accepts credit cards”

2. Automatic Web Service Invocation: Provide standard means for specifying declarative APIs and parameter semantics

“Buy me that lift ticket using my credit card”

3. Automatic Webs Service Composition and Interoperation: Provide declarative specifications of prerequisites & consequences of apps. and a language to describe composition and data flow interaction

“Determine the place with best snow height and then buy me the lift card”

Thomas Schmidtschmidt@informatik.

haw-hamburg.deOntology Structuring for Services

Three essential types of knowledge about a service:

• What does the service provide?Profile class used to advertise services

• How is it used?ServiceModel class usedto describe the process model

• How to interact with it?ServiceGrounding class specifies details of accessing the service

Thomas Schmidtschmidt@informatik.

haw-hamburg.deService Profile

• A description of services as offered by providers or needed by requestors

• The profile provides a detailed description of a service to a registry, but is useless after service selection (→ ServiceModel)

• Three types of information:

- Provider information: Service Name, Contact, Description

- Functional description: Input, Output, Precondition, Effects

- Additional properties: Attributes, Parameters, Categories …

Thomas Schmidtschmidt@informatik.

haw-hamburg.deService Profiles

Thomas Schmidtschmidt@informatik.

haw-hamburg.deService Model

• Models Services as Processes

• Two types of processes: Atomic or Composite

• Describes:

- Parameters (Input, Output) & Expressions (Precondition, Effects)

- Process Type

- Process composition

- Data flow and parameter binding

Thomas Schmidtschmidt@informatik.

haw-hamburg.de

Thomas Schmidtschmidt@informatik.

haw-hamburg.deService Grounding

• Concrete service access description

• Extends WSDL on atomic processes

• Extensions:

- WSDL message may use owl-s parameter objects

- EncodingStyle may be OWL

- Process composition

- OWL-S process attribute maybe used as WSDL operation element

Thomas Schmidtschmidt@informatik.

haw-hamburg.deThe Semantic of a Hyperlink

• Links encode relations between resources

• Problem: What is their semantic interpretation?

• Get information from - Departure & arrival of a link

- Contextual information of the link itself

• Treat links as separate semantic statements to

- Process Links in applications

- Retrieve information about resources

Thomas Schmidtschmidt@informatik.

haw-hamburg.deLinking & AnchoringIngredients of a link

<a href=“../dort.html#a1" target="_blank"> hier </a>

process instructionsource object & link type

target object source anchor

target anchor

Thomas Schmidtschmidt@informatik.

haw-hamburg.deInteractivity + Relation

• Hyper references are constructed from:– Anchors marking data chunks in documents– Links connecting anchors

• Anchors and Links need not to be stored inside the documents

• XLink (2001)– W3C Standard for creating and describing links– Bidirectional and multidirectional links– Semantic attributes (title, arcrole, … )

Thomas Schmidtschmidt@informatik.

haw-hamburg.deDeriving statements from Meta Data

This page is titledhamster diseases

Subject Predicat

Object

Anchors provide additional specification

Thomas Schmidtschmidt@informatik.

haw-hamburg.deBuilding Link Semantic

• Anchored content carries (RDF-) semantics“This part is about hamsters having hay fever”

• Simple link statement“ ‘This part titled Hay Fever handbook’ representsbackground information on ‘this part about hamsters having hay fever’ ”

• Higher order statement“Link1 says that ‘the part titled Hay Fever Handbook’represents background information on ‘the part about hamsters having hay fever.‘ ”

Thomas Schmidtschmidt@informatik.

haw-hamburg.deDeriving statements from Meta Data

Thomas Schmidtschmidt@informatik.

haw-hamburg.deReferences

• Semantic Web @ W3C - http://www.w3.org/2001/sw/• OWL Semantics & Abstract Syntax - http://www.w3.org/TR/owl-semantics/• Representing Classes As Property Values on the Semantic Web -

http://www.w3.org/TR/swbp-classes-as-values• SKOS-Core 1.0 Guide -

http://www.w3.org/2001/sw/Europe/reports/thes/1.0/guide• Jena Javadoc - http://jena.sourceforge.net/javadoc/• D. Martin et. al.: OWL-S: Semantic Markup for Web Services, W3C Submission

http://www.w3.org/Submission/2004/SUBM-OWL-S-20041122/• DAML Services - http://www.daml.org/services/owl-s/• P. Alesso, C. Smith: Developing Semantic Web Services, Peters, 2005