1. Einführung in Topic Maps
Topic Maps Query Language
Session 8
Sven Krosse M. Sc.
Topic Maps Lab an der Universität Leipzig
krosse@informatik.uni-leipzig.de
topicmapslab.de
3. Einführung in Topic Maps
Agenda
TMQL Part-2
1. Update-Expression
a) Context-independent
b) Context-dependent
topicmapslab.de
4. Einführung in Topic Maps
Sprachbestandteile
Update Expression
topicmapslab.de
5. Einführung in Topic Maps
Update-Expression
● Änderungen der Topic Map
● atomare Änderungen an Konstrukten der Topic Map
● mehrere Änderungen am selben Kontext möglich
● aber: alle Änderungen am selben Kontext!
● Änderungen können neue Daten hinzufügen oder Werte
modifizieren!
topicmapslab.de
5
6. Einführung in Topic Maps
Update-Expression
● Grammatik:
update-ex ::= UPDATE < update-clause > { where-clause }
update-clause ::= anchor { param } ( SET | ADD ) value-ex
● Anchor: Schlüsselwort zur Definition der Änderung
● Param: optionales Argument
● Value-Ex: neuer Wert der Änderung
topicmapslab.de
6
7. Einführung in Topic Maps
Update-Expression
● kontextfreie Änderungen ( Kontext ist Topic Map! )
● Hinzufügen neuer Topics
● Hinzufügen neuer Assoziation
→ ohne CTM
topicmapslab.de
7
8. Einführung in Topic Maps
Neues Topic anlegen
● Schlüsselwort: topics
● Definition über Identifier
● Identifier bereits in Benutzung? → keine Änderungen
UPDATE topics ADD „http://psi.example.org/topic“
→ kein Identifier-Typ definiert (Standard: Subject-Identifier)
topicmapslab.de
8
9. Einführung in Topic Maps
Topic mit Subject-Identifier anlegen
UPDATE topics ADD „http://psi.example.org/topic“
UPDATE topics ADD „http://psi.example.org/topic“ ~
UPDATE topics ADD „http://psi.example.org/topic“ << indicators
→ neues Topic mit dem Subject-Identifier
topicmapslab.de
9
10. Einführung in Topic Maps
Topic mit Item-Identifier anlegen
UPDATE topics ADD „http://psi.example.org/topic“ !
UPDATE topics ADD „http://psi.example.org/topic“ << item
→ neues Topic mit dem Item-Identifier
topicmapslab.de
10
11. Einführung in Topic Maps
Topic mit Subject-Locator anlegen
UPDATE topics ADD „http://psi.example.org/topic“ =
UPDATE topics ADD „http://psi.example.org/topic“ << locators
→ neues Topic mit dem Subject-Locator
topicmapslab.de
11
12. Einführung in Topic Maps
Neue Assoziation anlegen
● Schlüsselwort: associations
● Definition über Association-Definition ( keine Ellipse )
● tm:subject verboten!
UPDATE associations ADD association-type ( role-type : player )
→ erzeugt neue Assoziation mit einer Rolle
→ alle Topics werden bei nicht Existenz erzeugt
topicmapslab.de
12
13. Einführung in Topic Maps
Neue Assoziation anlegen
● Variablen können durch Where-Klausel gebunden werden
UPDATE associations ADD association-type ( role-type : $c )
WHERE $c ISA composer
→ erzeugt für jeden Komponist eine neue Assoziation vom Typ
association-type
topicmapslab.de
13
14. Einführung in Topic Maps
Update-Expression
● kontextsensitive Änderungen ( Kontext über Where-Klausel )
topicmapslab.de
14
18. Einführung in Topic Maps
Neuen Name anlegen
● Schlüsselwort: names
● Optional: Namenstyp
● Kontext: Topic
UPDATE names name-type ADD „name“
WHERE http://en.wikipedia.org/wiki/Puccini
topicmapslab.de
18
19. Einführung in Topic Maps
Name ändern
● Schlüsselwort: names
● Optional: kein
● Kontext: Topic Name
UPDATE names SET „name“
WHERE http://en.wikipedia.org/wiki/Puccini >> characteristics
tm:name @short-name
topicmapslab.de
19
20. Einführung in Topic Maps
Neue Occurrence anlegen
● Schlüsselwort: occurrences
● Optional: Occurrence-Typ
● Kontext: Topic
UPDATE occurrences occ-type ADD „1“^^xsd:integer
WHERE http://en.wikipedia.org/wiki/Puccini
topicmapslab.de
20
21. Einführung in Topic Maps
Occurrence ändern
● Schlüsselwort: occurrences
● Optional: kein
● Kontext: Occurrence
UPDATE occurrences SET „1“^^xsd:integer
WHERE http://en.wikipedia.org/wiki/Puccini >> characteristics
tm:occurrence @web
topicmapslab.de
21
22. Einführung in Topic Maps
Neues Theme hinzufügen
● Schlüsselwort: scope
● Optional: kein
● Kontext: Assoziation, Name, Occurrence
UPDATE scope ADD http://psi.example.org/deprecated
WHERE http://en.wikipedia.org/wiki/Puccini << players
topicmapslab.de
22
23. Einführung in Topic Maps
Neuen Typ hinzufügen
● Schlüsselwort: types
● Optional: kein
● Kontext: Topic
UPDATE types ADD http://psi.example.org/type
WHERE http://en.wikipedia.org/wiki/Puccini
topicmapslab.de
23
24. Einführung in Topic Maps
Typ ändern
● Schlüsselwort: types
● Optional: kein
● Kontext: Assoziation, Name, Occurrence
UPDATE types SET http://psi.example.org/type
WHERE http://en.wikipedia.org/wiki/Puccini >> characteristics
tm:occurrence @web
topicmapslab.de
24
25. Einführung in Topic Maps
Neue Instanz hinzufügen
● Schlüsselwort: instances
● Optional: kein
● Kontext: Topic
UPDATE instances ADD http://en.wikipedia.org/wiki/Puccini
WHERE http://psi.example.org/type
topicmapslab.de
25
26. Einführung in Topic Maps
Neuen Supertyp hinzufügen
● Schlüsselwort: supertypes
● Optional: kein
● Kontext: Topic
UPDATE supertypes ADD http://psi.example.org/type
WHERE http://en.wikipedia.org/wiki/Puccini
topicmapslab.de
26
27. Einführung in Topic Maps
Neuen Subtyp hinzufügen
● Schlüsselwort: subtypes
● Optional: kein
● Kontext: Topic
UPDATE subtypes ADD http://en.wikipedia.org/wiki/Puccini
WHERE http://psi.example.org/type
topicmapslab.de
27
28. Einführung in Topic Maps
Spieler ändern
● Schlüsselwort: players
● Optional: Rollentyp ( Standard: alle Rollen!!! )
● Kontext: Assoziation
UPDATE players composer SET http://psi.example.org/me
WHERE http://en.wikipedia.org/wiki/Puccini << players
topicmapslab.de
28
29. Einführung in Topic Maps
Rolle hinzufügen
● Schlüsselwort: roles
● Optional: Topic ( Spieler )
● Kontext: Assoziation
UPDATE roles http://psi.example.org/me
ADD http://psi.example.org/roleType
WHERE http://en.wikipedia.org/wiki/Puccini << players
topicmapslab.de
29
30. Einführung in Topic Maps
Reifier ändern
● Schlüsselwort: reifier
● Optional: kein
● Kontext: Assoziation, Name, Occurrence, Topic
UPDATE reifier SET http://psi.example.org/reifier
WHERE http://en.wikipedia.org/wiki/Puccini >> characteristics
tm:occurrence @web
topicmapslab.de
30
31. Einführung in Topic Maps
Reifier ändern
● Schlüsselwort: reifier
● Optional: kein
● Kontext: Assoziation, Name, Occurrence, Topic
UPDATE reifier
SET http://en.wikipedia.org/wiki/Puccini >> characteristics
tm:occurrence @web
WHERE http://psi.example.org/reifier
topicmapslab.de
31
33. Einführung in Topic Maps
Geplante Features
● Transaktionen ( Engine-Funktion nutzen )
● Aktuelle Engines mit Transaktionssupport
– TM2JDBC ( nur DB )
– Ontopia ( nur DB )
– MaJorToM
topicmapslab.de
33
34. Einführung in Topic Maps
Geplante Features
● Spracherweiterung
● UPDATE mit Assoziation-Definition ( als Bedingung )
● Assoziation-Definition für FLW(O)R, SELECT, PATH, DELETE
● neue Content-Typen (JSON, LTM, …)
topicmapslab.de
34