SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
Einführung in Topic Maps




                    Topic Maps Query Language
                                Session 5




         Sven Krosse M. Sc.
         Topic Maps Lab an der Universität Leipzig
         krosse@informatik.uni-leipzig.de



  topicmapslab.de
Einführung in Topic Maps
Review – Session 4
Funktionen
    ●   Zeichenketten-Funktionen
    ●   numerische Funktionen
    ●   Transformationsfunktionen




  topicmapslab.de
Einführung in Topic Maps
Agenda
 1. Sortierung
 2. High-Level
    ●   Environment
    ●   SELECT Style




  topicmapslab.de
Einführung in Topic Maps




                   Sprachbestandteile
                           Sortierung




 topicmapslab.de
Einführung in Topic Maps
Sortierung
 ●   Sortierung von Tupeln in einer Sequenz
      ●   Projektion und Tuple-Sequenzen
 ●   Schlüsselwörter ASC und DESC
      ●   Standard ASC
 ●   Vorkommen von mindestens einem Schlüsselwort




     topicmapslab.de
                                                    5
Einführung in Topic Maps
Sortierung - Routine
 ●   fehlendes Schlüsselwort wird durch ASC ersetzt
 ●   Sortierung des Tupels anhand des aktuellen Indexes
 ●   Sortierung immer von links nach rechts
 ●   nächste Iteration
      ●   Sortierung von Kollision durch gleiche Werte in letzter
          Iteration




     topicmapslab.de
                                                                    6
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] , . / tm:name[1] )


   unsortiertes Ergebnis
      { [ „A“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AA“ ] ; [ „D“ , „AD“ ] }


   sortiertes Ergebnis?



  topicmapslab.de
                                                                              7
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] , . / tm:name[1] )


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }


   keine Sortierung, da kein Schlüsselwort vorkommt!



  topicmapslab.de
                                                                              8
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] , . / tm:name[1] ASC )


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }
   Ergebnis?
   1: { [ „A“ , „BA“ ] ; [ „C“ , „AA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }
   2: { [ „C“ , „AA“ ] ; [ „A“ , „AB“ ] ; [ „D“ , „AD“ ] ; [ „A“ , „BA“ ] }

  topicmapslab.de
                                                                              9
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] , . / tm:name[1] ASC )


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }


      { [ „A“ , „BA“ ] ; [ „C“ , „AA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }



  topicmapslab.de
                                                                              10
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] DESC, . / tm:name[1] )


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }


      sortiertes Ergebnis?



  topicmapslab.de
                                                                              11
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] DESC, . / tm:name[1] )


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }


      { [ „D“ , „AD“ ] ; [ „C“ , „AA“ ] ; [ „C“ , „AB“ ] ; [ „A“ , „BA“ ] }



  topicmapslab.de
                                                                              12
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] DESC, . / tm:name[1] DESC )


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }


      sortiertes Ergebnis?



  topicmapslab.de
                                                                              13
Einführung in Topic Maps
Sortierung - Routine
   Query
      … ( . / tm:name[0] DESC, . / tm:name[1] DESC)


   unsortiertes Ergebnis
      { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] }


      { [ „D“ , „AD“ ] ; [ „C“ , „AB“ ] ; [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] }



  topicmapslab.de
                                                                              14
Einführung in Topic Maps




                   Sprachbestandteile
                        High-Level




 topicmapslab.de
Einführung in Topic Maps
High-Level
 ●   Alternativen zu Path-Expression
 ●   zwei unterstütze Typen
      ●   SELECT ( Ähnlichkeit zu SQL )
      ●   FLW(O)R ( Ähnlichkeit zu OOL ( For-Loop ) )
 ●   Umgebungsdefinitionen vor der eigentlichen Abfrage




     topicmapslab.de
                                                          16
Einführung in Topic Maps




                   Sprachbestandteile
                        Environment




 topicmapslab.de
Einführung in Topic Maps
Environment
 ●   Umgebungsdefinition zu Beginn eines Query
 ●   vor allen drei Typen unterstützt
 ●   Definition von
      ●   Ontologie
      ●   Prefixen




     topicmapslab.de
                                                 18
Einführung in Topic Maps
Prefix-Definition
 ●   gekennzeichnet durch Schlüsselwort %prefix
 ●   Tripple-Darstellung


         %prefix identifier QIRI


 ●   Verwendung als relative IRI




     topicmapslab.de
                                                  19
Einführung in Topic Maps
Prefix-Definition
   %prefix o http://psi.ontopia.net/
   %prefix tml http://www.topicmapslab.de/
   // o:Composer ++ // tml:person




   topicmapslab.de
                                             20
Einführung in Topic Maps
Pragma-Definition
 ●   gekennzeichnet durch Schlüsselwort %pragma
 ●   Tripple-Darstellung


          %pragma identifier QIRI


 ●   Definition von Ontologie
      ●   Transitivität



     topicmapslab.de
                                                  21
Einführung in Topic Maps
Pragma-Definition - Transitivität
 ●   Draft definiert nur Transitivität als Pragma
 ●   Signatur
      ●   identifier:   taxonometry
      ●   QIRI:         tm:intransitive or tm:transitive




     topicmapslab.de
                                                           22
Einführung in Topic Maps
Pragma-Definition - Transitivität
   %prefix o http://psi.ontopia.net/
   %prefix tml http://www.topicmapslab.de/
   %pragma taxonometry tm:intransitive
   // o:Composer ++ // tml:person




   topicmapslab.de
                                             23
Einführung in Topic Maps




                   Sprachbestandteile
                        Select - Style




 topicmapslab.de
Einführung in Topic Maps
Select-Style
 ●   syntaktische Ähnlichkeit zu SQL
 ●   besteht aus einer Menge von Sub-Expressions
 ●   erlaubt Bindung von Variablen
 ●   einziger Typ mit Schlüsselwort für Duplikat – Behandlung und
     Selektion




     topicmapslab.de
                                                                    25
Einführung in Topic Maps
Select-Style
   select < value-expression >
   [ from value-expression ]
   [ where boolean-expression ]
   [ order    by < value-expression > ]
   [ unique ]
   [ offset value-expression ]
   [ limit value-expression ]



  topicmapslab.de
                                          26
Einführung in Topic Maps




                   Sprachbestandteile
                        Select - Clause




 topicmapslab.de
Einführung in Topic Maps
Select-Klausel
 ●   Besteht aus nicht leerer Menge von Pfad-Ausdrücken zur
     Auswahl der Ergebniswerte
 ●   Verwendung von gebundenen Variablen möglich
 ●   einziger nicht optionaler Teil der Select-Expression




     topicmapslab.de
                                                              28
Einführung in Topic Maps
Select-Klausel
   %prefix wiki http://en.wikipedia.org/wiki/
   SELECT wiki:Puccini




   %prefix wiki http://en.wikipedia.org/wiki/
   SELECT wiki:Puccini / tm:name , wiki:Puccini >> indicators




  topicmapslab.de
                                                                29
Einführung in Topic Maps




                   Sprachbestandteile
                        From - Clause




 topicmapslab.de
Einführung in Topic Maps
From-Klausel
 ●   Definition des Kontextes für das Variablen Binding
 ●   optionaler Teil der Select-Expression




     topicmapslab.de
                                                          31
Einführung in Topic Maps




                   Sprachbestandteile
                     Where – Clause und Variablen




 topicmapslab.de
Einführung in Topic Maps
Where-Klausel
 ●   Einschränkung möglicher Bindings einer Variable
 ●   Definition von Variablen, welche in der Select Clause verwendet
     werden können
 ●   Funktional ähnlich zu Filtern




     topicmapslab.de
                                                                       33
Einführung in Topic Maps
Variablen
 ●   Variablen:
      ●   Verwendung als Platzhalter innerhalb einer Query
      ●   Bindung an Werte erfolgt zur Laufzeit durch Bedingungen
      ●   Muster
           –   '$' [w#]+'*/




     topicmapslab.de
                                                                    34
Einführung in Topic Maps
vordefinierte Variablen
 ●   reservierte System-Variablen
         @_            aktuelles Tuple
         $#            aktueller Index
         %%            Environment Topic Map
         %_            angefragte Topic Map
         $[0-9]+       indiziertes Element eines Tupels
         $_            write-only Variable




     topicmapslab.de
                                                          35
Einführung in Topic Maps
Where-Klausel
   %prefix o http://psi.ontopia.net/music/
   SELECT $composer
   WHERE $composer ISA o:composer


   %prefix o http://psi.ontopia.net/music/
   %prefix l http://psi.ontopia.net/literature/
   SELECT $composer, $opera
   WHERE $composer ISA o:composer AND o:composed-by ( l:work :
   $opera, o:composer : $composer )

  topicmapslab.de
                                                                 36
Einführung in Topic Maps




                   Sprachbestandteile
                       Order By – Clause




 topicmapslab.de
Einführung in Topic Maps
Order By-Klausel
 ●   Sortierung der Ergebnis Menge
 ●   Definition über Pfadausdrücke
      ●   Verarbeitung erfolgt abhängig vom vorherigen
          Sortierungsergebnis




     topicmapslab.de
                                                         38
Einführung in Topic Maps
Order By-Klausel
   %prefix o http://psi.ontopia.net/music/
   %prefix l http://psi.ontopia.net/literature/
   SELECT $composer, $opera
   WHERE $composer ISA o:composer AND o:composed-by ( l:work :
   $opera, o:composer : $composer )
   ORDER BY $composer / tm:name [0] , $opera / tm:name [0] DESC




  topicmapslab.de
                                                                  39
Einführung in Topic Maps




                   Sprachbestandteile
                       Limit / Offset – Clause




 topicmapslab.de
Einführung in Topic Maps
Limit- und Offset-Klausel
 ●   Einschränkung eines Fensters zur Auswahl der Ergebnismenge
 ●   Offset definiert erstes Element der Auswahl
 ●   Limit definiert maximale Anzahl von Elementen
 ●   Funktional ähnlich zu Index-Range-Filter




     topicmapslab.de
                                                                  41
Einführung in Topic Maps
Order By-Klausel
   %prefix o http://psi.ontopia.net/music/
   %prefix l http://psi.ontopia.net/literature/
   SELECT $composer, $opera
   WHERE $composer ISA o:composer AND o:composed-by ( l:work :
   $opera, o:composer : $composer )
   ORDER BY $composer / tm:name [0] , $opera / tm:name [0] DESC
   OFFSET 5
   LIMIT 10



  topicmapslab.de
                                                                  42
Einführung in Topic Maps




                       ENDE




 topicmapslab.de

Weitere ähnliche Inhalte

Mehr von Lutz Maicher

Semantische Technologien für kleine und mittlere Unternehmen
Semantische Technologien für kleine und mittlere UnternehmenSemantische Technologien für kleine und mittlere Unternehmen
Semantische Technologien für kleine und mittlere UnternehmenLutz Maicher
 
TMQL tutorial - part 8
TMQL tutorial - part 8TMQL tutorial - part 8
TMQL tutorial - part 8Lutz Maicher
 
TMQL tutorial - part 6
TMQL tutorial - part 6TMQL tutorial - part 6
TMQL tutorial - part 6Lutz Maicher
 
Topic Maps In The eHumanities
Topic Maps In The eHumanitiesTopic Maps In The eHumanities
Topic Maps In The eHumanitiesLutz Maicher
 
Medieninformatik und Topic Maps
Medieninformatik und Topic MapsMedieninformatik und Topic Maps
Medieninformatik und Topic MapsLutz Maicher
 
The Impact Of Semantic Handshakes
The Impact Of Semantic HandshakesThe Impact Of Semantic Handshakes
The Impact Of Semantic HandshakesLutz Maicher
 
Topic Maps Portals
Topic Maps PortalsTopic Maps Portals
Topic Maps PortalsLutz Maicher
 
Argumentation Trails and Topic Maps
Argumentation Trails and Topic MapsArgumentation Trails and Topic Maps
Argumentation Trails and Topic MapsLutz Maicher
 
Tutorial Introduction to Topic Maps
Tutorial Introduction to Topic MapsTutorial Introduction to Topic Maps
Tutorial Introduction to Topic MapsLutz Maicher
 
Topic Maps Lab and its portal at the Topic Maps User Conference 2009
Topic Maps Lab and its portal at the Topic Maps User Conference 2009Topic Maps Lab and its portal at the Topic Maps User Conference 2009
Topic Maps Lab and its portal at the Topic Maps User Conference 2009Lutz Maicher
 
Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...
Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...
Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...Lutz Maicher
 
Einführung in Musica migrans
Einführung in Musica migransEinführung in Musica migrans
Einführung in Musica migransLutz Maicher
 
Dissertationsverteidigung "Autonome Topic Maps"
Dissertationsverteidigung "Autonome Topic Maps"Dissertationsverteidigung "Autonome Topic Maps"
Dissertationsverteidigung "Autonome Topic Maps"Lutz Maicher
 

Mehr von Lutz Maicher (15)

Semantische Technologien für kleine und mittlere Unternehmen
Semantische Technologien für kleine und mittlere UnternehmenSemantische Technologien für kleine und mittlere Unternehmen
Semantische Technologien für kleine und mittlere Unternehmen
 
TMQL tutorial - part 8
TMQL tutorial - part 8TMQL tutorial - part 8
TMQL tutorial - part 8
 
TMQL tutorial - part 6
TMQL tutorial - part 6TMQL tutorial - part 6
TMQL tutorial - part 6
 
Maiana
MaianaMaiana
Maiana
 
Topic Maps In The eHumanities
Topic Maps In The eHumanitiesTopic Maps In The eHumanities
Topic Maps In The eHumanities
 
Musica migrans
Musica migransMusica migrans
Musica migrans
 
Medieninformatik und Topic Maps
Medieninformatik und Topic MapsMedieninformatik und Topic Maps
Medieninformatik und Topic Maps
 
The Impact Of Semantic Handshakes
The Impact Of Semantic HandshakesThe Impact Of Semantic Handshakes
The Impact Of Semantic Handshakes
 
Topic Maps Portals
Topic Maps PortalsTopic Maps Portals
Topic Maps Portals
 
Argumentation Trails and Topic Maps
Argumentation Trails and Topic MapsArgumentation Trails and Topic Maps
Argumentation Trails and Topic Maps
 
Tutorial Introduction to Topic Maps
Tutorial Introduction to Topic MapsTutorial Introduction to Topic Maps
Tutorial Introduction to Topic Maps
 
Topic Maps Lab and its portal at the Topic Maps User Conference 2009
Topic Maps Lab and its portal at the Topic Maps User Conference 2009Topic Maps Lab and its portal at the Topic Maps User Conference 2009
Topic Maps Lab and its portal at the Topic Maps User Conference 2009
 
Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...
Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...
Musica migrans - Topic Maps portal about the migration paths of Eastern Europ...
 
Einführung in Musica migrans
Einführung in Musica migransEinführung in Musica migrans
Einführung in Musica migrans
 
Dissertationsverteidigung "Autonome Topic Maps"
Dissertationsverteidigung "Autonome Topic Maps"Dissertationsverteidigung "Autonome Topic Maps"
Dissertationsverteidigung "Autonome Topic Maps"
 

TMQL tutorial - part 5

  • 1. Einführung in Topic Maps Topic Maps Query Language Session 5 Sven Krosse M. Sc. Topic Maps Lab an der Universität Leipzig krosse@informatik.uni-leipzig.de topicmapslab.de
  • 2. Einführung in Topic Maps Review – Session 4 Funktionen ● Zeichenketten-Funktionen ● numerische Funktionen ● Transformationsfunktionen topicmapslab.de
  • 3. Einführung in Topic Maps Agenda 1. Sortierung 2. High-Level ● Environment ● SELECT Style topicmapslab.de
  • 4. Einführung in Topic Maps Sprachbestandteile Sortierung topicmapslab.de
  • 5. Einführung in Topic Maps Sortierung ● Sortierung von Tupeln in einer Sequenz ● Projektion und Tuple-Sequenzen ● Schlüsselwörter ASC und DESC ● Standard ASC ● Vorkommen von mindestens einem Schlüsselwort topicmapslab.de 5
  • 6. Einführung in Topic Maps Sortierung - Routine ● fehlendes Schlüsselwort wird durch ASC ersetzt ● Sortierung des Tupels anhand des aktuellen Indexes ● Sortierung immer von links nach rechts ● nächste Iteration ● Sortierung von Kollision durch gleiche Werte in letzter Iteration topicmapslab.de 6
  • 7. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] , . / tm:name[1] ) unsortiertes Ergebnis { [ „A“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AA“ ] ; [ „D“ , „AD“ ] } sortiertes Ergebnis? topicmapslab.de 7
  • 8. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] , . / tm:name[1] ) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } keine Sortierung, da kein Schlüsselwort vorkommt! topicmapslab.de 8
  • 9. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] , . / tm:name[1] ASC ) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } Ergebnis? 1: { [ „A“ , „BA“ ] ; [ „C“ , „AA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } 2: { [ „C“ , „AA“ ] ; [ „A“ , „AB“ ] ; [ „D“ , „AD“ ] ; [ „A“ , „BA“ ] } topicmapslab.de 9
  • 10. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] , . / tm:name[1] ASC ) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } { [ „A“ , „BA“ ] ; [ „C“ , „AA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } topicmapslab.de 10
  • 11. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] DESC, . / tm:name[1] ) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } sortiertes Ergebnis? topicmapslab.de 11
  • 12. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] DESC, . / tm:name[1] ) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } { [ „D“ , „AD“ ] ; [ „C“ , „AA“ ] ; [ „C“ , „AB“ ] ; [ „A“ , „BA“ ] } topicmapslab.de 12
  • 13. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] DESC, . / tm:name[1] DESC ) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } sortiertes Ergebnis? topicmapslab.de 13
  • 14. Einführung in Topic Maps Sortierung - Routine Query … ( . / tm:name[0] DESC, . / tm:name[1] DESC) unsortiertes Ergebnis { [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] ; [ „C“ , „AB“ ] ; [ „D“ , „AD“ ] } { [ „D“ , „AD“ ] ; [ „C“ , „AB“ ] ; [ „C“ , „AA“ ] ; [ „A“ , „BA“ ] } topicmapslab.de 14
  • 15. Einführung in Topic Maps Sprachbestandteile High-Level topicmapslab.de
  • 16. Einführung in Topic Maps High-Level ● Alternativen zu Path-Expression ● zwei unterstütze Typen ● SELECT ( Ähnlichkeit zu SQL ) ● FLW(O)R ( Ähnlichkeit zu OOL ( For-Loop ) ) ● Umgebungsdefinitionen vor der eigentlichen Abfrage topicmapslab.de 16
  • 17. Einführung in Topic Maps Sprachbestandteile Environment topicmapslab.de
  • 18. Einführung in Topic Maps Environment ● Umgebungsdefinition zu Beginn eines Query ● vor allen drei Typen unterstützt ● Definition von ● Ontologie ● Prefixen topicmapslab.de 18
  • 19. Einführung in Topic Maps Prefix-Definition ● gekennzeichnet durch Schlüsselwort %prefix ● Tripple-Darstellung %prefix identifier QIRI ● Verwendung als relative IRI topicmapslab.de 19
  • 20. Einführung in Topic Maps Prefix-Definition %prefix o http://psi.ontopia.net/ %prefix tml http://www.topicmapslab.de/ // o:Composer ++ // tml:person topicmapslab.de 20
  • 21. Einführung in Topic Maps Pragma-Definition ● gekennzeichnet durch Schlüsselwort %pragma ● Tripple-Darstellung %pragma identifier QIRI ● Definition von Ontologie ● Transitivität topicmapslab.de 21
  • 22. Einführung in Topic Maps Pragma-Definition - Transitivität ● Draft definiert nur Transitivität als Pragma ● Signatur ● identifier: taxonometry ● QIRI: tm:intransitive or tm:transitive topicmapslab.de 22
  • 23. Einführung in Topic Maps Pragma-Definition - Transitivität %prefix o http://psi.ontopia.net/ %prefix tml http://www.topicmapslab.de/ %pragma taxonometry tm:intransitive // o:Composer ++ // tml:person topicmapslab.de 23
  • 24. Einführung in Topic Maps Sprachbestandteile Select - Style topicmapslab.de
  • 25. Einführung in Topic Maps Select-Style ● syntaktische Ähnlichkeit zu SQL ● besteht aus einer Menge von Sub-Expressions ● erlaubt Bindung von Variablen ● einziger Typ mit Schlüsselwort für Duplikat – Behandlung und Selektion topicmapslab.de 25
  • 26. Einführung in Topic Maps Select-Style select < value-expression > [ from value-expression ] [ where boolean-expression ] [ order by < value-expression > ] [ unique ] [ offset value-expression ] [ limit value-expression ] topicmapslab.de 26
  • 27. Einführung in Topic Maps Sprachbestandteile Select - Clause topicmapslab.de
  • 28. Einführung in Topic Maps Select-Klausel ● Besteht aus nicht leerer Menge von Pfad-Ausdrücken zur Auswahl der Ergebniswerte ● Verwendung von gebundenen Variablen möglich ● einziger nicht optionaler Teil der Select-Expression topicmapslab.de 28
  • 29. Einführung in Topic Maps Select-Klausel %prefix wiki http://en.wikipedia.org/wiki/ SELECT wiki:Puccini %prefix wiki http://en.wikipedia.org/wiki/ SELECT wiki:Puccini / tm:name , wiki:Puccini >> indicators topicmapslab.de 29
  • 30. Einführung in Topic Maps Sprachbestandteile From - Clause topicmapslab.de
  • 31. Einführung in Topic Maps From-Klausel ● Definition des Kontextes für das Variablen Binding ● optionaler Teil der Select-Expression topicmapslab.de 31
  • 32. Einführung in Topic Maps Sprachbestandteile Where – Clause und Variablen topicmapslab.de
  • 33. Einführung in Topic Maps Where-Klausel ● Einschränkung möglicher Bindings einer Variable ● Definition von Variablen, welche in der Select Clause verwendet werden können ● Funktional ähnlich zu Filtern topicmapslab.de 33
  • 34. Einführung in Topic Maps Variablen ● Variablen: ● Verwendung als Platzhalter innerhalb einer Query ● Bindung an Werte erfolgt zur Laufzeit durch Bedingungen ● Muster – '$' [w#]+'*/ topicmapslab.de 34
  • 35. Einführung in Topic Maps vordefinierte Variablen ● reservierte System-Variablen @_ aktuelles Tuple $# aktueller Index %% Environment Topic Map %_ angefragte Topic Map $[0-9]+ indiziertes Element eines Tupels $_ write-only Variable topicmapslab.de 35
  • 36. Einführung in Topic Maps Where-Klausel %prefix o http://psi.ontopia.net/music/ SELECT $composer WHERE $composer ISA o:composer %prefix o http://psi.ontopia.net/music/ %prefix l http://psi.ontopia.net/literature/ SELECT $composer, $opera WHERE $composer ISA o:composer AND o:composed-by ( l:work : $opera, o:composer : $composer ) topicmapslab.de 36
  • 37. Einführung in Topic Maps Sprachbestandteile Order By – Clause topicmapslab.de
  • 38. Einführung in Topic Maps Order By-Klausel ● Sortierung der Ergebnis Menge ● Definition über Pfadausdrücke ● Verarbeitung erfolgt abhängig vom vorherigen Sortierungsergebnis topicmapslab.de 38
  • 39. Einführung in Topic Maps Order By-Klausel %prefix o http://psi.ontopia.net/music/ %prefix l http://psi.ontopia.net/literature/ SELECT $composer, $opera WHERE $composer ISA o:composer AND o:composed-by ( l:work : $opera, o:composer : $composer ) ORDER BY $composer / tm:name [0] , $opera / tm:name [0] DESC topicmapslab.de 39
  • 40. Einführung in Topic Maps Sprachbestandteile Limit / Offset – Clause topicmapslab.de
  • 41. Einführung in Topic Maps Limit- und Offset-Klausel ● Einschränkung eines Fensters zur Auswahl der Ergebnismenge ● Offset definiert erstes Element der Auswahl ● Limit definiert maximale Anzahl von Elementen ● Funktional ähnlich zu Index-Range-Filter topicmapslab.de 41
  • 42. Einführung in Topic Maps Order By-Klausel %prefix o http://psi.ontopia.net/music/ %prefix l http://psi.ontopia.net/literature/ SELECT $composer, $opera WHERE $composer ISA o:composer AND o:composed-by ( l:work : $opera, o:composer : $composer ) ORDER BY $composer / tm:name [0] , $opera / tm:name [0] DESC OFFSET 5 LIMIT 10 topicmapslab.de 42
  • 43. Einführung in Topic Maps ENDE topicmapslab.de