haw-hamburg.de
Semantic Web Technologies:
Examples
• Representing Knowledge:
Modelling Thesauri and such
• Web Ontology Language for Services (OWL-S)
• The Semantic of Hyperlinks
schmidt@informatik.
haw-hamburg.de
Representing 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
haw-hamburg.de
Example:
ACM Computing
Classification System
schmidt@informatik.
haw-hamburg.de
Simple 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>
…
haw-hamburg.de
ACM 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
schmidt@informatik.
haw-hamburg.de
Additional 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
haw-hamburg.de
A Simpler Example
Books on Lions:
:TheAfricanLionBook a :Book ;
:bookTitle "The African Lion" ; dc:subject :AfricanLion
:AfricanLion
a owl:Class;
rdfs:subClassOf :Lion
Typical problem:
:BookAboutAnimals a owl:Class ; rdfs:subClassOf
[ a owl:Restriction ;
owl:someValuesFrom :AnimalClass ; owl:onProperty dc:subject
]
schmidt@informatik.
haw-hamburg.de
OWL DL Approaches (I)
Individuals in parallel
:LionsLifeInThePrideBook a :Book ;
:bookTitle "Lions: Life in the Pride" ; dc:subject :LionSubject
Now:
:BookAboutAnimals a owl:Class ; rdfs:subClassOf
[ a owl:Restriction ;
owl:someValuesFrom :Animal ; owl:onProperty dc:subject
]
haw-hamburg.de
OWL DL Approaches (II)
Unspecified
class members
:LionsLifeInThePrideBook a :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
schmidt@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 processable Ontology (not OWL Full)
A.
General Literature
A.0 General
A.2 Reference
A.1
Introductory and Survey
A.m Miscellaneous
A.0.0 Biographies/
autobiographies A.0.1
Conference Proceedings
A.0.2 General literary works
haw-hamburg.de
Use 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 ☺
schmidt@informatik.
haw-hamburg.de
SKOS
• 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
haw-hamburg.de
SKOS
• 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/
schmidt@informatik.
haw-hamburg.de
Expressing 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>
haw-hamburg.de
☺ A part of the RDF data model
schmidt@informatik.
haw-hamburg.de
Code 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);
haw-hamburg.de
Getting the non-obvious
//get subject we want information on
Resource 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 conditions StmtIterator it = infModel.listStatements(subject, predicate,
null);
//get perfLabel of the first statement returned String label = it.nextStatement().getProperty(
“http://www.w3.org/2004/02/skos/core#prefLabel”).getString()
schmidt@informatik.
haw-hamburg.de
Use Case:
eLearning Objects content augmentation
Idea
• 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
haw-hamburg.de
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 transitive owl: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>
schmidt@informatik.
haw-hamburg.de
Sample 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>
haw-hamburg.de
Comfortable Vocabularies
• Use the Jena tool
schemagento 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" );
schmidt@informatik.
haw-hamburg.de
Getting 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());
}
haw-hamburg.de
Rules – Basis for inference
• OWL reasoner is based upon specific rules which model the OWL assertions and constraints
• Applied ruleset could be obtained from
FBRuleReasonervia
getRules() : List
• Rules are created using
Rules.parseRule(String) : Ruleor
Rules.parseRules(String) : ListFor detailed information on the inference system refer to
http://jena.sourceforge.net/inference/index.html
schmidt@informatik.
haw-hamburg.de
Rule Definition
Rule := 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:type or ?varname // variable
or 'a literal' // either a string or a number or number // e.g. 42 or 25.5
haw-hamburg.de
Creating 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)]
schmidt@informatik.
haw-hamburg.de
Extending the standard ruleset
String RULE_FILE = “own.rules”;
//load rules from file own.rules List 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.
haw-hamburg.de
OWL-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 for declaring and describing services
• Originally DAML-S from DAML Initiative
• Release 1.0 by DAML (Nov 2003)
• Now: Release 1.1 – Submission to W3C
schmidt@informatik.
haw-hamburg.de
Motivation + Use Cases
Goals: Enable agents to discover, invoke, verify, interoperate, compose and 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”
haw-hamburg.de
Ontology 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 used
to describe the process model
• How to interact with it?
ServiceGrounding class specifies
details of accessing the service
schmidt@informatik.
haw-hamburg.de
Service 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 …
haw-hamburg.de
Service Profiles
schmidt@informatik.
haw-hamburg.de
Service 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
haw-hamburg.de
schmidt@informatik.
haw-hamburg.de
Service 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 may
be used as WSDL operation element
haw-hamburg.de
The 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
schmidt@informatik.
haw-hamburg.de
Linking & Anchoring
Ingredients of a link
<a href=“../dort.html#a1" target="_blank"> hier </a>
process instruction source object & link type
target object source anchor
target anchor
haw-hamburg.de
Interactivity + 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, … )
schmidt@informatik.
haw-hamburg.de
Deriving statements from Meta Data
This page is titled hamster diseases
Subject Predicat
Object
Anchors provide
additional specification
haw-hamburg.de
Building Link Semantic
• Anchored content carries (RDF-) semantics
“This part is about hamsters having hay fever”
• Simple link statement
“ ‘This part titled Hay Fever handbook’ represents
background 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.‘ ”
schmidt@informatik.
haw-hamburg.de
Deriving statements from Meta Data
haw-hamburg.de