TMQL tutorial - part 1
-
Upload
lutz-maicher -
Category
Technology
-
view
1.695 -
download
2
description
Transcript of TMQL tutorial - part 1
Einführung in Topic Maps
topicmapslab.de
Topic Maps Query Language
Sven Krosse M. Sc.
Topic Maps Lab an der Universität Leipzig
Session 1
Einführung in Topic Maps
topicmapslab.de
Agenda
1. Grundlagen
● TMQL Metamodell
– Vergleich zum TMDM
● Grammatik
2. TMQL als Sprache
● Topic Identifizierung
● Navigationskonzept
Einführung in Topic Maps
topicmapslab.de
GrundlagenMetamodell
Einführung in Topic Maps
topicmapslab.de
Metamodell
● als Topic Map repräsentiert
● jedes Topic kann im Query verwendet werden
● Topic Maps Elemente anders repräsentiert als im TMDM
Einführung in Topic Maps
topicmapslab.de
TMDM
Einführung in Topic Maps
topicmapslab.de
TMQL
● Topic Map Konstrukt existiert nicht
● keine Reifikation von Topic Maps möglich
● Abfrage aller Topics bzw. Assoziation schwer
Einführung in Topic Maps
topicmapslab.de
TMDM
Einführung in Topic Maps
topicmapslab.de
TMDM → TMQL
Einführung in Topic Maps
topicmapslab.de
TMQL
● keine Unterscheidung zwischen Name und Occurrence
→ Characteristics
Einführung in Topic Maps
topicmapslab.de
TMDM
Einführung in Topic Maps
topicmapslab.de
TMDM → TMQL
Einführung in Topic Maps
topicmapslab.de
TMQL
● keine direkte Unterstützung von Varianten
→ Abfrage nur über spezielle Funktion
Einführung in Topic Maps
topicmapslab.de
TMDM
Einführung in Topic Maps
topicmapslab.de
TMDM → TMQL
Einführung in Topic Maps
topicmapslab.de
TMQL
● keine Rollenkonstrukte
→ keine Reifikation von Rollen
Einführung in Topic Maps
topicmapslab.de
Zusammenfassung
● keine Unterscheidung zwischen Namen und Occurrences
● keine Varianten von Namen
● keine Rollenkonstrukte
● kein Topic Map Konstrukt
Einführung in Topic Maps
topicmapslab.de
GrundlagenGrammatik
Einführung in Topic Maps
topicmapslab.de
Grammatik
● in drei Ebene definiert
● jede Ebene inspiriert von anderen Standards
Einführung in Topic Maps
topicmapslab.de19
Token Level
● Terminalsymbole der Sprache
● Definition auf Basis von regulären Ausdrücken
Token Level
Einführung in Topic Maps
topicmapslab.de20
Canonical Level
● Definition von Produktionsregeln
Beispiel: tuple-expression := <value-expression>
Token Level
Canonical Level
Einführung in Topic Maps
topicmapslab.de21
Non-Canonical Level
Token Level
Canonical Level
Non-Canonical Level
● Termsubstitution als neue Produktionsregeln
● Definition von kürzeren Ausdrücken
anchor / tm:name ==> anchor >> chracteristics tm:name
Einführung in Topic Maps
topicmapslab.de
SprachbestandteileLiterale und Konstanten
Einführung in Topic Maps
topicmapslab.de
Literale und Konstanten
● Konstanten ( atoms ) sind Datentypen und Operatoren
● Übernahme von CTM Datentypen
Einführung in Topic Maps
topicmapslab.de
Literale und Konstanten
atom possible value
atom Undefined | boolean | number | date | dateTime | string | iri
undefined undef
boolean true or false
number decimal or integer
decimal /[+-]?\d+(\.\d+)?/
integer /[+-]?\d+/
date '-'? yyyy '-' mm '-' dd (zzzzzz)?
dateTime '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
iri see RFC 3987
string /"([^"]|\")*"/ | /'([^']|\')*'/
Einführung in Topic Maps
topicmapslab.de
SprachbestandteileTopic Identifizierung
Einführung in Topic Maps
topicmapslab.de
Topic Identifizierung
● Verwendung von Referenzen oder String Literalen
● String Literale durch Achsen übersetzt
● Referenzen werden automatisch übersetzt
● Subject-Identifier
● Subject-Locator
● Item-Identifier
Einführung in Topic Maps
topicmapslab.de
Topic Identifizierung
● item-identifier
puccini
● subject-identifier
http://en.wikipedia.org/wiki/Puccini
● subject-locator
http://en.wikipedia.org/wiki/Puccini
Einführung in Topic Maps
topicmapslab.de
Topic Identifizierung
● Item-identifier
”puccini“ << item
● Subject-identifier
“http://en.wikipedia.org/wiki/Puccini“ << indicators
● Subject-locator
“http://en.wikipedia.org/wiki/Puccini“ << locators
Einführung in Topic Maps
topicmapslab.de
SprachbestandteileNavigationskonzept
Einführung in Topic Maps
topicmapslab.de30
Navigationskonzept
● basiert auf dem Proxy-Konzept des TMRM
● Modell der Topic Map als abstrakter bidirektionaler Graph
● Definition von 12 Achsen ( +2 NCL )
Einführung in Topic Maps
topicmapslab.de31
Navigationskonzept - Syntax
DIRECTION ::= '<<' | '>>'
AXIS-NAME ::= 'item' | 'indicators' | 'locators' | 'traverse' | 'players' | 'roles' | 'types' | 'reifier' | 'atomify' | 'characteristics' | 'supertypes' | 'scope'
STEP ::= DIRECTION AXIS-NAME [ TOPIC-REF ]
Einführung in Topic Maps
topicmapslab.de32
Achse - indicators
● keine optionalen Typen
● vorwärts: alle Subject-Identifier eines Topics
● rückwärts: Adressierung eines Topics mit Subject Identifier
Einführung in Topic Maps
topicmapslab.de33
Achse - indicators
http://en.wikipedia.org/wiki/Puccini >> indicators
“http://en.wikipedia.org/wiki/Puccini” << indicators
Einführung in Topic Maps
topicmapslab.de34
Achse - locators
● keine optionalen Typen
● vorwärts: alle Subject-Locator eines Topics
● rückwärts: Adressierung eines Topics mit Subject Locator
Einführung in Topic Maps
topicmapslab.de35
Achse - locators
http://en.wikipedia.org/wiki/Puccini >> locators
“http://en.wikipedia.org/wiki/Puccini” << locators
Einführung in Topic Maps
topicmapslab.de36
Achse - item
● keine optionalen Typen
● ohne Pluralisierung!
→ items
● vorwärts: alle Item-Identifier eines Topics
● rückwärts: Adressierung eines Topics mit Item Identifier
Einführung in Topic Maps
topicmapslab.de37
Achse - item
http://en.wikipedia.org/wiki/Puccini >> item
“http://en.wikipedia.org/wiki/Puccini” << item
Einführung in Topic Maps
topicmapslab.de38
Achse - types
● keine optionalen Typen
● vorwärts: alle Typen eines Topics oder der Typ eines Topic Maps Konstruktes
● rückwärts: alle Instanzen eines Topic Typs
● NCL: instances – Achse
● vorwärts: alle Instanzen eines Topics Typs
● rückwärts: alle Typen einer Topics oder der Typ eines Topic
Maps Konstruktes
Einführung in Topic Maps
topicmapslab.de39
Achse - types
http://en.wikipedia.org/wiki/Puccini >> types
http://psi.ontopia.net/music/composer << types
http://en.wikipedia.org/wiki/Puccini << instances
http://psi.ontopia.net/music/composer >> instances
Einführung in Topic Maps
topicmapslab.de40
Achse - supertypes
● keine optionalen Typen
● vorwärts: alle Super-Typen eines Topic Typs
● rückwärts: alle Sub-Typen eines Topic Typs
● NCL: subtypes – Achse
● vorwärts: alle Sub-Typen eines Topic Typs
● rückwärts: alle Super-Typen eines Topic Typs
Einführung in Topic Maps
topicmapslab.de41
Achse - supertypes
http://psi.ontopia.net/music/composer >> supertypes
http://psi.ontopia.net/music/musician << supertypes
http://psi.ontopia.net/music/composer << subtypes
http://psi.ontopia.net/music/musician >> subtypes
Einführung in Topic Maps
topicmapslab.de42
TMQL – Typhierarchie
e1
A
B CD
E F G
e2 g1 g2
Einführung in Topic Maps
topicmapslab.de43
e1
A
B CD
E F G
e2 g1 g2
TMQL – Typhierarchie
TMQL-Query: e1 >> types
Einführung in Topic Maps
topicmapslab.de44
e1
A
B CD
E F G
e2 g1 g2
TMQL – Typhierarchie
TMQL-Query: E >> supertypes
Einführung in Topic Maps
topicmapslab.de45
e1
A
B CD
E F G
e2 g1 g2
TMQL – Typhierarchie
TMQL-Query: A >> instances
Einführung in Topic Maps
topicmapslab.de46
Achse - characteristics
● vorwärts: alle Eigenschaften eines Topics
● rückwärts: das Topic mit der Eigenschaft
● vordefinierte Typen
● alle Name tm:name
● alle Occurrences tm:occurrence
Einführung in Topic Maps
topicmapslab.de47
Achse - characteristics
http://en.wikipedia.org/wiki/Puccini >> characteristics
http://en.wikipedia.org/wiki/Puccini >> characteristics tm:name
http://en.wikipedia.org/wiki/Puccini >> characteristics tm:occurrence
Einführung in Topic Maps
topicmapslab.de48
e1
Name 1
Name 2
t
g
Occurrence 1
Occurrence 2
t
g
TMQL – characteristics axis
Einführung in Topic Maps
topicmapslab.de49
e1
Name 1
Name 2
t
g
Occurrence 1
Occurrence 2
t
g
TMQL – characteristics axis
TMQL-Query: e1 >> characteristics g
Einführung in Topic Maps
topicmapslab.de
ENDE