SlideShare uma empresa Scribd logo
1 de 118
Baixar para ler offline
Einführung in Topic Maps




                    Topic Maps Query Language




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



  topicmapslab.de
                                                     topicmapslab.de
Einführung in Topic Maps

introduce myself
 Oct. 2004
             –   matriculation at the university of cooperative
                 education at Leipzig
 Sep 2007
             –   graduation in Computer Science with the diploma
 Oct 2007
             –   matriculation at the university of Leipzig




  topicmapslab.de
                                                                   2
Einführung in Topic Maps

introduce myself
 May 2009
             –   joining the Topic Maps Lab at the university of
                 Leipzig
 Sep 2009
             – finishing my study with the Master of Computer
               Science
             – the subject of my master's thesis was the
               implementation of TMQL4J




  topicmapslab.de
                                                                   3
Einführung in Topic Maps

Agenda
1 the Ontopia Topic Maps Engine
  1.1 Omnigator – a generic topic maps browser
  1.2 Installing Ontopia with all extensions


2 TMQL4J – the first java-based TMQL Engine
  2.1 Architecture
   2.2 TMQL4Ontopia - Integration into Ontopia



  topicmapslab.de
                                                 4
Einführung in Topic Maps

Agenda
3 Introduction of the language TMQL
   3.1 Why do we need a language like TMQL?
   3.2 How can we use TMQL?
   3.3 Are there any alternatives for TMQL?
4 TMQL – the basics of the ISO draft
  4.1 grammar levels
  4.2 literals and references
   4.3 navigation
   4.4 variables
  topicmapslab.de
                                              5
Einführung in Topic Maps

Agenda
5 Learning the high-level expressions
   5.1 Path Expression
   5.2 Select Expression
   5.3 Flwr Expression




  topicmapslab.de
                                        6
Einführung in Topic Maps




      the Ontopia Topic Maps Engine




  topicmapslab.de
                                 topicmapslab.de
Einführung in Topic Maps
the Ontopia Topic Maps Engine
 ●   the topics map engine of the company Ontopia AS
 ●   contains a many tools and utilities for using topic maps
 ●   in summer 2009 the Ontopia topic maps engine
     becomes open source
 ●   supported by a big community
 ●   supports the TMAPI 2.0 specification




     topicmapslab.de
                                                                8
Einführung in Topic Maps
Omnigator – generic topic maps browser
 ●   part of the Ontopia engine
 ●   web-based topic maps browser
 ●   displaying information about topics and associations
 ●   running on a Apache Tomcat server




     topicmapslab.de
                                                            9
Einführung in Topic Maps
Omnigator – generic topic maps browser




  topicmapslab.de
                                         10
Einführung in Topic Maps
Installing Ontopia with all extensions
 ●   needed components
      ●   JRE 5.0 or higher
      ●   Ontopia distribution
      ●   tmql4j library
      ●   tmql4Ontopia library
      ●   a web browser :)




     topicmapslab.de
                                         11
Einführung in Topic Maps




 TMQL4J - the first Java-based TMQL
               Engine




  topicmapslab.de
                              topicmapslab.de
Einführung in Topic Maps
TMQL4J
 ●   TMQL Querying Engine written in Java
 ●   current version 1.0.0
 ●   abstracts from underlying topic map engine
 ●   creates an abstraction layer on top of the TMAPI
 ●   encapsulate the whole querying process
 ●   implements additional cache mechanism
 ●   simple configuration mechanism



     topicmapslab.de
                                                        13
Einführung in Topic Maps
TMQL4J - architecture
 ●   designed as process chain of independent modules
 ●   each module can replace by a domain-specific implementation
 ●   based modules
           –   TMQL4J pre-processor
           –   TMQL4J lexer
           –   TMQL4J parser
           –   TMQL4J interpreter
           –   TMQL4J post-processor


     topicmapslab.de
                                                                   14
Einführung in Topic Maps
TMQL4J – process chain



           environment and     cleaned        TMQL lexical                                  transformed
                                                              parser tree    matches
           system variables   TMQL query        tokens                                         results




  TMQL                          TMQL4J                                        TMQL4J          TMQL4J
             Initialization                   TMQL4J lexer   TMQL4J parser                                  results
  query                       pre-processor                                  interpreter   post-processor




   topicmapslab.de
                                                                                                                      15
Einführung in Topic Maps
TMQL4J – process chain



           environment and        cleaned        TMQL lexical                                  transformed
                                                                 parser tree    matches
           system variables      TMQL query        tokens                                         results




  TMQL                             TMQL4J                                        TMQL4J          TMQL4J
             Initialization                      TMQL4J lexer   TMQL4J parser                                  results
  query                          pre-processor                                  interpreter   post-processor




                              process flow of the TMQL querying
                              process




   topicmapslab.de
                                                                                                                         16
Einführung in Topic Maps
TMQL4J – process chain


                              data flow of the TMQL querying process

           environment and        cleaned        TMQL lexical                                  transformed
                                                                 parser tree    matches
           system variables      TMQL query        tokens                                         results




  TMQL                             TMQL4J                                        TMQL4J          TMQL4J
             Initialization                      TMQL4J lexer   TMQL4J parser                                  results
  query                          pre-processor                                  interpreter   post-processor




   topicmapslab.de
                                                                                                                         17
Einführung in Topic Maps
TMQL4J – application architecture

                                         application
                      TMQL query

                                                       direct access
                              TMQL4J
                    indirect access

                                           TMAPI


                                      topic maps engine




                                         topic maps
                                           backend


  topicmapslab.de
                                                                       18
Einführung in Topic Maps
TMQL4Ontopia
 ●   generic query plug-in for the Omnigator
 ●   current version 0.0.1
 ●   use the TMQL4J engine
 ●   implements Ontopia specific modules
 ●   allows result export as CSV file




     topicmapslab.de
                                               19
Einführung in Topic Maps
result view of TMQL4Ontopia




  topicmapslab.de
                              20
Einführung in Topic Maps
parser tree view of TMQL4Ontopia




  topicmapslab.de
                                   21
Einführung in Topic Maps




   Introduction of the language TMQL




  topicmapslab.de
                                topicmapslab.de
Einführung in Topic Maps
Introduction of the language TMQL
 ●   TMQL is a topic maps query language
 ●   part of ISO standardization ( ISO 18048 )
 ●   discussions about parts of the final standard
 ●   supports different styles of querying
 ●   supports the definition of ontology in context of a query




     topicmapslab.de
                                                                 23
Einführung in Topic Maps
Why do we need a language like TMQL?
 ●   the number of applications using topic maps increases
     fast
 ●   the data base becomes to complex
 ●   complex handling by using TMAPI code fragments
 ●   complex terminology and ontology
 ●   number of topics and associations too huge
 ●   different views of the data in context of different
     business processes


     topicmapslab.de
                                                             24
Einführung in Topic Maps
Why do we need a language like TMQL?
 ●   Example TMAPI vs TMQL
         → extract all player names of the association
         member_of




     topicmapslab.de
                                                         25
Einführung in Topic Maps
●  TMAPI ( for example in Java )
TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance();

TopicMapSystem topicMapSystem = factory.newTopicMapSystem();

TopicMap topicMap = topicMapSystem.getTopicMap("my-topic-map");

// type of the association

Topic type = (Topic)topicMap.getConstructById("member_of");

// extract all association items of the type member-of

TypeInstanceIndex index = topicMap.getIndex(TypeInstanceIndex.class);

for ( Association association : index.getAssociations(type)){

  // extract all roles of the association item

  for ( Role role : association.getRoles()){

      // extract the role player and the names

      names.addAll(role.getPlayer().getNames());

  }


   topicmapslab.de
                                                                        26
Einführung in Topic Maps

 ●   TMQL4J
TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance();

TopicMapSystem topicMapSystem = factory.newTopicMapSystem();

TopicMap topicMap = topicMapSystem.getTopicMap("my-topic-map");

// initialize the tmql4j engine

IQuery query = new QueryImpl("member_of << types >> players / tm:name")

TMQLRuntime runtime = new TMQLRuntime(topicMapSystem,

     Arrays.asList(new TopicMap[] { topicMap }), query);

runtime.run();

// extract result set

names.addAll((ITupleSequence<Name>) runtime

     .getStoredValue(TMQLRuntime.TMQL_RUNTIME_RESULTPROCESSING_RESULT));




     topicmapslab.de
                                                                           27
Einführung in Topic Maps
How can we use TMQL?
 ●   different opportunities
      ●   TMQL4J
      ●   PerlTM
      ●   Hands on ;-)




     topicmapslab.de
                               28
Einführung in Topic Maps
Are there any alternatives for TMQL?
 ●   there are other languages for querying topic maps
      ●   Tolog
           –   a language similar to Prolog
           –   supports predicate-invocations and boolean
               combinations
      ●   Toma
           –   a language similar to SQL
           –   developed by Rani Pinchuk



     topicmapslab.de
                                                            29
Einführung in Topic Maps
Are there any alternatives for TMQL?
 ●   but:
      ●   there expressiveness are lower than TMQL
      ●   TMQL supports different query styles for different domains




     topicmapslab.de
                                                                       30
Einführung in Topic Maps




TMQL - the basics of the current draft




  topicmapslab.de
                                topicmapslab.de
Einführung in Topic Maps
TMQL – the basics of the ISO draft
 ●   only the basics of the ISO draft
 ●   basics important to understand the syntax of TMQL
 ●   learning high-level expressions by doing




     topicmapslab.de
                                                         32
Einführung in Topic Maps
TMQL – grammar levels
 ●   define the terminals of the language
 ●   based on Regular Expressions
     example: $variable | SELECT | FOR




                            Token Level


     topicmapslab.de
                                            33
Einführung in Topic Maps
TMQL – grammar levels
 ●   define the production rules of TMQL
 ●   combination of terminals
     example: tuple-expression := <value-expression>




                            Canonical Level


                             Token Level


     topicmapslab.de
                                                       34
Einführung in Topic Maps
TMQL – grammar levels
 ●   define the shortcuts as term substitutions
     anchor / tm:name ==> anchor >> chracteristics tm:name




                         Non-Canonical Level


                           Canonical Level


                             Token Level


     topicmapslab.de
                                                             35
Einführung in Topic Maps
TMQL – literals or atoms
 ●   atoms defined as constant literals
 ●   atoms are data-types and operators
 ●   supported data-types are an extract of the CTM data-
     types and XSD date and dateTime




     topicmapslab.de
                                                            36
Einführung in Topic Maps
TMQL – literals or atoms
    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     /"([^"]|")*"/ | /'([^']|')*'/
                               source: http://www.isotopicmaps.org/tmql/tmql.html

  topicmapslab.de
                                                                                    37
Einführung in Topic Maps
TMQL – references
 ●   references used to identify topics in context of a TMQL
     query
 ●   supports
           –   item-identifier
           –   subject-identifier
           –   subject-locators
 ●   possible to use relative IRI as identifier or locator




     topicmapslab.de
                                                               38
Einführung in Topic Maps
TMQL – references example
 ●   item-identifier
             puccini

 ●   subject-identifier
             http://psi.ontopedia.net/Puccini

 ●   subject-locator
             http://psi.ontopedia.net/Puccini


     topicmapslab.de
                                                39
Einführung in Topic Maps
TMQL – navigation
 ●   based on the TMRM
 ●   define 12 axes
 ●   can use as a part of path expression
 ●   symbolize navigation throw the abstract topic map graph
 ●   each axis can used in two directions
 ●   syntax
                       navigation   := axis-name direction optional-type

                       direction    := << | >>
     topicmapslab.de
                                                                       40
Einführung in Topic Maps
TMQL – identifier axes
 ●   one axis for each identifier type
 ●   do not supports optional types
 ●   forward-direction
      ●   deliver the identifier of the given topic
      ●   only supports topic items
 ●   backward-direction
      ●   deliver the topic with this identifier
      ●   only supports string literals

     topicmapslab.de
                                                      41
Einführung in Topic Maps
TMQL – identifier axes examples

 ●   item-identifier
             http://psi.ontopedia.net/Puccini >> item

 ●   subject-identifier
             http://psi.ontopedia.net/Puccini >> indicators

 ●   subject-locator
             http://psi.ontopedia.net/Puccini << locators
     topicmapslab.de
                                                              42
Einführung in Topic Maps
TMQL – type-hierarchy axes
 ●   supports is-instance-of and a-kind-of associations
 ●   forward-direction
      ●   deliver the types of given instance ( type-instance)
      ●   deliver the supertypes of given type ( supertype-subtype)
      ●   supports topic items or association items
 ●   backward-direction
      ●   deliver the instances of given type ( type-instance)
      ●   deliver the subtypes of given type ( supertype-subtype)
      ●   supports topic items or association items
     topicmapslab.de
                                                                      43
Einführung in Topic Maps
TMQL – type hierarchy axes examples
 ●   type-instance
             http://psi.ontopedia.net/Puccini >> types
             http://psi.ontopedia.net/Composer << types

 ●   supertype-subtype
             http://psi.ontopedia.net/Composer >> supertypes
             http://psi.ontopedia.net/Composer << supertypes




     topicmapslab.de
                                                               44
Einführung in Topic Maps
TMQL – association axes
 ●   forward-direction
      ●   deliver all roles of given association ( roles )
      ●   deliver all players of given association ( players )
      ●   deliver all players playing with given topic ( traverse )
 ●   backward-direction
      ●   deliver all association items using the given role ( roles )
      ●   deliver all association items using the given player ( players )
      ●   deliver all associations items connected with the given
          association by the same player ( traverse )
     topicmapslab.de
                                                                             45
Einführung in Topic Maps
TMQL – association axes examples
 ●   roles
             http://psi.ontopedia.net/composed_by >> roles
             http://psi.ontopedia.net/Composer << roles
 ●   players
             http://psi.ontopedia.net/composed_by >> players
             http://psi.ontopedia.net/Puccini << players
 ●   traverse
             http://psi.ontopedia.net/Puccini >> traverse
             http://psi.ontopedia.net/composed_by << traversee
     topicmapslab.de
                                                                 46
Einführung in Topic Maps
TMQL – characteristics axis
 ●   forward-direction
      ●   deliver all names and occurrences of given topic
      ●   only supports topic items


 ●   backward-direction
      ●   deliver the topic item using the given characteristic
      ●   only supports names and occurrences



     topicmapslab.de
                                                                  47
Einführung in Topic Maps
TMQL – characteristics axis examples
 ●   all names of puccini


              http://psi.ontopedia.net/Puccini >> characteristics
                                  tm:name


 ●   all occurrences of puccini


            http://psi.ontopedia.net/Puccini >> characteristics
                              tm:occurrence

     topicmapslab.de
                                                                    48
Einführung in Topic Maps
TMQL – scope axis
 ●   forward-direction
      ●   deliver the scope of the given construct
      ●   supports names, occurrences or associations


 ●   backward-direction
      ●   deliver all constructs with the given scope
      ●   only supports topic items



     topicmapslab.de
                                                        49
Einführung in Topic Maps
TMQL – scope axis examples

 ●   the scope of the names of puccini
              http://psi.ontopedia.net/Puccini >> characteristics
                              tm:name >> scope

 ●   all constructs with the scope web
             http://psi.ontopedia.net/Web << scope




     topicmapslab.de
                                                                    50
Einführung in Topic Maps
TMQL – reifier axis
 ●   forward-direction
      ●   deliver the reifier of the given construct
      ●   supports names, occurrences or associations


 ●   backward-direction
      ●   deliver the construct reifies by the given topic item
      ●   only supports topic items



     topicmapslab.de
                                                                  51
Einführung in Topic Maps
TMQL – reifier axis examples

 ●   the construct reified by the topic item A Philatelic
     History


             http://home.prcn.org/~pauld/opera/ >> reifier

 ●   the reifier of this construct


              http://home.prcn.org/~pauld/opera/ >> reifier <<
                                  reifier
     topicmapslab.de
                                                                 52
Einführung in Topic Maps
TMQL – atomify axis
 ●   forward-direction
      ●   deliver the value of the given characteristics
      ●   supports names or occurrences


 ●   backward-direction
      ●   deliver the characteristics with the given value
      ●   supports all literals



     topicmapslab.de
                                                             53
Einführung in Topic Maps
TMQL – atomify axis examples

 ●   the value of the name puccini


                       http://psi.ontopedia.net/Puccini >>
                       characteristics tm:name >> atomify


                                       or


                 http://psi.ontopedia.net/Puccini / tm:name

     topicmapslab.de
                                                              54
Einführung in Topic Maps
TMQL – variables
 ●   using in context of high-level expression
 ●   supported by select expression and flwr expression
 ●   different prefixes


                 $ only bind literals or items
                 @ only bind a tuple
                 % only bind a sequence




     topicmapslab.de
                                                          55
Einführung in Topic Maps
TMQL – variables


  Tuple

          Tuples are ordered collections of simple values (atoms and items).




  Tuple-Sequence

   Tuple sequences are sequences of tuples where all tuples have identical length.
             Tuple sequences can be generated with tuple expressions.




  topicmapslab.de
                                                                                     56
Einführung in Topic Maps
TMQL – protected variables
 ●   variable names can post-fixed by different number of primes '
 ●   variables only differ in number of primes
 ●   can not be bind to the same value




     topicmapslab.de
                                                                     57
Einführung in Topic Maps
TMQL – variables example
 ●   variables
                       $composer    // can be bind to puccini

                       @composers   // can be bind to a tuple

                       %composers   // can be bind to a sequence




     topicmapslab.de
                                                                   58
Einführung in Topic Maps
TMQL – variables example
 ●   tuple
                       ( puccini , "puccini" , “1900-01-01” )

 ●   sequence
                       { ( puccini , "puccini" , “1900-01-01” ) ,
                       ( fontane , "fontane" , “1900-01-01” ) }




     topicmapslab.de
                                                                    59
Einführung in Topic Maps




   TMQL - the high-level expressions

                    - learning by doing -



  topicmapslab.de
                                            topicmapslab.de
Einführung in Topic Maps
TMQL – Path Expression
 ●   combination of navigation steps or predicate invocations
 ●   predicate-invocation
           –   describe associations
           –   similar to tolog




     topicmapslab.de
                                                                61
Einführung in Topic Maps
TMQL – predicate-invocation example




   composed_by ( composer : puccini , opera : le_villi , … )




  topicmapslab.de
                                                               62
Einführung in Topic Maps
TMQL – predicate-invocation example



        association type




   composed_by ( composer : puccini , opera : le_villi , … )




  topicmapslab.de
                                                               63
Einführung in Topic Maps
TMQL – predicate-invocation example



                            role type




   composed_by ( composer : puccini , opera : le_villi , … )




  topicmapslab.de
                                                               64
Einführung in Topic Maps
TMQL – predicate-invocation example



                                      player




   composed_by ( composer : puccini , opera : le_villi , … )




  topicmapslab.de
                                                               65
Einführung in Topic Maps
TMQL – predicate-invocation example



                                              ellipsis




   composed_by ( composer : puccini , opera : le_villi , … )




  topicmapslab.de
                                                               66
Einführung in Topic Maps
TMQL – Path Expression exercises

  Task

                    All names of all instances of composer




  topicmapslab.de
                                                             67
Einführung in Topic Maps
TMQL – Path Expression exercises

  Task

                       All names of all instances of composer




  Solution

                      composer << types >> characteristics tm:name
                                           or
         http://psi.ontopedia.net/Composer << types >> characteristics tm:name




  topicmapslab.de
                                                                                 68
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

   The names of all topis playing the role composer in association composed_by.




  topicmapslab.de
                                                                                  69
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

   The names of all topis playing the role composer in association composed_by.




  Solution

             composed_by >> players composed >> characteristics tm:name
                                          or
  http://psi.ontopedia.net/composed_by >> players http://psi.ontopedia.net/Composer
                              >> characteristics tm:name




  topicmapslab.de
                                                                                      70
Einführung in Topic Maps
TMQL – filter and projection
 ●   filters
           –   post-fixed after navigation
           –   surrounded by square brackets
           –   supported filters
                       – index                   [ number ]
                       – index-range             [ number .. number ]
                       – types                   [ ^ type ]
                       – scope                   [ @ scope ]
                       – boolean-expressions [ … ]



     topicmapslab.de
                                                                        71
Einführung in Topic Maps
TMQL – filter and projection
 ●   projection
           –   post-fixed after navigation
           –   surrounded by round brackets
           –   defined as a tuple-expression
           –   simple navigation from current node
           –   current node symbolize by dot




     topicmapslab.de
                                                     72
Einführung in Topic Maps
TMQL – filter and projection example
 ●   the first name of puccini
      http://psi.ontopedia.net/Puccini >> characteristics tm:name [0]


 ●   Projection of characteristics and associations played by
     instances of composer
         http://psi.ontopedia.net/Composer << types
             ( . >> characteristics , . << players )




     topicmapslab.de
                                                                        73
Einführung in Topic Maps
TMQL – filter and projection example



               navigation




      composer << types ( . >> characteristics , . << players )



  topicmapslab.de
                                                                  74
Einführung in Topic Maps
TMQL – filter and projection example



                            projection definition




      composer << types ( . >> characteristics , . << players )



  topicmapslab.de
                                                                  75
Einführung in Topic Maps
TMQL – filter and projection example



                              current node




      composer << types ( . >> characteristics , . << players )



  topicmapslab.de
                                                                  76
Einführung in Topic Maps
TMQL – filter and projection example



                                        projection




      composer << types ( . >> characteristics , . << players )



  topicmapslab.de
                                                                  77
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

     Create a projection of all name and all occurrence values of all instances of
                                     composer.




  topicmapslab.de
                                                                                     78
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

     Create a projection of all name and all occurrence values of all instances of
                                     composer.




  Solution

                 composer << types ( . / tm:name , . / tm:occurrence )
                                           or
     http://psi.ontopedia.net/Composer << types( . / tm:name, . / tm:occurrence )




  topicmapslab.de
                                                                                     79
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

          All names of all instances of composer in scope short name.




  topicmapslab.de
                                                                        80
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

             All names of all instances of composer in scope short name.




  Solution
             composer << types >> characteristics tm:name @ short_name
                                              or
              http://psi.ontopedia.net/Composer << types >> characteristics
                          [ @ http://psi.ontopedia.net/short_name ]




  topicmapslab.de
                                                                              81
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

         Extract the characteristics of all composers and filter them by the type
                                      date_of_death.




  topicmapslab.de
                                                                                    82
Einführung in Topic Maps
TMQL – Path Expression exercises


  Task

         Extract the characteristics of all composers and filter them by the type
                                      date_of_death.




  Solution
                composer << types >> characteristics [ ^ date_of_death ]
                                               or
             http://psi.ontopedia.net/Composer << types >> characteristics
                         [ ^ http://psi.ontopedia.net/date_of_death ]




  topicmapslab.de
                                                                                    83
Einführung in Topic Maps
TMQL – Select Expression
 ●   similar to SQL
 ●   supports variables




     topicmapslab.de
                            84
Einführung in Topic Maps
TMQL – Select Clause
 ●   only non-optional clause of a select expression
 ●   starts with the keyword SELECT
 ●   contains a number of value expressions
           –   variables
           –   navigations
           –   functions




     topicmapslab.de
                                                       85
Einführung in Topic Maps
TMQL – Select Clause example




        SELECT http://psi.ontopedia.net/Puccini / tm:name ,
             http://psi.ontopedia.net/Puccini / tm:occurrence




  topicmapslab.de
                                                                86
Einführung in Topic Maps
TMQL – Where Clause
 ●   optional clause of a select expression
 ●   starts with the keyword WHERE
 ●   contains a number of boolean-expressions
           –   exists-clause
           –   forall-clause
           –   negation
           –   conjunction
           –   disjunction


     topicmapslab.de
                                                87
Einführung in Topic Maps
TMQL – Where Clause example




   SELECT $composer
      WHERE $composer ISA http://psi.ontopedia.net/Composer




  topicmapslab.de
                                                              88
Einführung in Topic Maps
TMQL – Exists Clause
 ●   specifies the number of items satisfying a condition
 ●   numerically unrestricted
           –   number of satisfying items is not important
           –   starts with keyword EXISTS or SOME
           –   can contain path expressions
 ●   numerically restricted
           –   define the number of satisfying items as upper or lower
               bounds
                  AT LEAST number set SATISFIES boolean-expression
                  AT MOST number set SATISFIES boolean-expression
     topicmapslab.de
                                                                         89
Einführung in Topic Maps
TMQL – Exists Clause example

 SELECT $composer
 WHERE EXISTS $composer ISA http://psi.ontopedia.net/Composer


 SELECT $composer
    WHERE AT LEAST 4 $opera IN // http://psi.ontopedia.net/Opera
     SATISFIES http://psi.ontopedia.net/composed_by
        ( http://psi.ontopedia.net/Composer : $composer ,
            http://psi.ontopedia.net/Work : $work )

  topicmapslab.de
                                                               90
Einführung in Topic Maps
TMQL – Forall Clause
 ●   all items have to satisfy the condition


     EVERY variable IN content SATISFIES boolean-expression




     topicmapslab.de
                                                              91
Einführung in Topic Maps
TMQL – Forall Clause example



   SELECT $composer
      WHERE
          EVERY $opera IN $composer << traverse
              SATISFIES $opera == http://psi.ontopedia.net/Le_Villi




  topicmapslab.de
                                                                      92
Einführung in Topic Maps
TMQL – boolean combination
 ●   negation symbolized by the keyword NOT


 ●   conjunction symbolized by the keyword AND


 ●   disjunction symbolized by the keyword OR




     topicmapslab.de
                                                 93
Einführung in Topic Maps
TMQL – boolean combination example

   SELECT $composer
      WHERE NOT ( $composer ISA
                               http://psi.ontopedia.net/Composer
                               )
   SELECT $composer , $opera
      WHERE
            $composer ISA http://psi.ontopedia.net/Composer
          AND
              $opera ISA http://psi.ontopedia.net/Opera

  topicmapslab.de
                                                                   94
Einführung in Topic Maps
TMQL – From Clause
 ●   optional clause of a select expression
 ●   starts with the keyword FROM
 ●   define the context of the select expression
 ●   have to return a topic map or sequence of constructs




     topicmapslab.de
                                                            95
Einführung in Topic Maps
TMQL – From Clause example




   SELECT $composer
      FROM // http://psi.ontopedia.net/Musician
      WHERE $composer ISA http://psi.ontopedia.net/Composer




  topicmapslab.de
                                                              96
Einführung in Topic Maps
TMQL – Unique Clause
 ●   optional clause of a select expression
 ●   only the keyword UNIQUE
 ●   unify the result set




     topicmapslab.de
                                              97
Einführung in Topic Maps
TMQL – Unique Clause example




   SELECT $composer
      FROM // http://psi.ontopedia.net/Musician
      WHERE $composer ISA http://psi.ontopedia.net/Composer
      UNIQUE



  topicmapslab.de
                                                              98
Einführung in Topic Maps
TMQL – Order-By Clause
 ●   optional clause of a select expression
 ●   starts with the keyword ORDER BY
 ●   define an order of the variable bindings of the where clause




     topicmapslab.de
                                                                    99
Einführung in Topic Maps
TMQL – Order-By Clause example




   SELECT $composer
      FROM // http://psi.ontopedia.net/Musician
      WHERE $composer ISA http://psi.ontopedia.net/Composer
      ORDER BY $composer / tm:name




  topicmapslab.de
                                                              100
Einführung in Topic Maps
TMQL – Limit and Offset
 ●   optional clauses of a select expression
 ●   starts with the keyword LIMIT or OFFSET
 ●   define the selection window after querying




     topicmapslab.de
                                                  101
Einführung in Topic Maps
TMQL – Limit and Offset example



   SELECT $composer
      FROM // http://psi.ontopedia.net/Musician
      WHERE $composer ISA http://psi.ontopedia.net/Composer
      ORDER BY $composer / tm:name
      OFFSET 2
      LIMIT 10

  topicmapslab.de
                                                              102
Einführung in Topic Maps
TMQL – Select Expression exercises


  Task

                    Select all operas composed by puccini.




  topicmapslab.de
                                                             103
Einführung in Topic Maps
TMQL – Select Expression exercises


  Task

                     Select all operas composed by puccini.




  Solution

    SELECT $opera WHERE composed_by ( composer : puccini , work : $opera )
                                           or
          SELECT $opera WHERE http://psi.ontopedia.net/composed_by
       ( http://psi.ontopedia.net/Composer : http://psi.ontopedia.net/Puccini ,
                        http://psi.ontopedia.net/Work : $opera )



  topicmapslab.de
                                                                                  104
Einführung in Topic Maps
TMQL – Select Expression exercises
  Task

   Select the names of all composers who composed at least one opera. Keep in
                   mind that the work should not be an opera.




  topicmapslab.de
                                                                                105
Einführung in Topic Maps
TMQL – Select Expression exercises
  Task

   Select the names of all composers who composed at least one opera. Keep in
                   mind that the work should not be an opera.



  Solution

            SELECT $composer / tm:name WHERE $opera ISA opera AND
   AT MOST 3 SATISFIES composed_by ( work : $opera , composer : $composer )
                                             or
                 SELECT $composer / tm:name WHERE $composer ISA
                         http://psi.ontopedia.net/Composer AND
              SOME $opera IN // http://psi.ontopedia.net/Opera SATISFIES
    http://psi.ontopedia.net/composed_by ( http://psi.ontopedia.net/Work : $opera ,
                    http://psi.ontopedia.net/Composer : $composer )


  topicmapslab.de
                                                                                      106
Einführung in Topic Maps
TMQL – Select Expression exercises


  Task

   Select the topic types which are a kind of composer or where each instance have
                                   at least one name.




  topicmapslab.de
                                                                                     107
Einführung in Topic Maps
TMQL – Select Expression exercises


  Task

   Select the topic types which are a kind of composer or where each instance have
                                   at least one name.




  Solution

                SELECT $type WHERE $type AKO composer OR
                     EXISTS $type << types / tm:name
                                   or
      SELECT $type WHERE $type AKO http://psi.ontopedia.net/Composer OR
                     EXISTS $type << types / tm:name



  topicmapslab.de
                                                                                     108
Einführung in Topic Maps
TMQL – Flwr Expression
 ●   similar to a programming language
 ●   supports variables




     topicmapslab.de
                                         109
Einführung in Topic Maps
TMQL – Return Clause
 ●   only non-optional clause of a flwr expression
 ●   starts with the keyword RETURN
 ●   contains a number of value expressions
           –   variables
           –   navigations
           –   functions
           –   XTM and CTM fragments




     topicmapslab.de
                                                     110
Einführung in Topic Maps
TMQL – Return Clause example




   RETURN http://psi.ontopedia.net/Puccini / tm:name




  topicmapslab.de
                                                       111
Einführung in Topic Maps
TMQL – For Clause
 ●   optional clause of a flwr expression
 ●   starts with the keyword FOR
 ●   can contain more than one for clause
 ●   define a variable set




     topicmapslab.de
                                            112
Einführung in Topic Maps
TMQL – For Clause example


   FOR $composer IN // http://psi.ontopedia.net/Composer
   RETURN $composer


   FOR $composer IN // http://psi.ontopedia.net/Composer
       FOR $opera IN // http://psi.ontopedia.net/Opera
   RETURN $composer, $opera


  topicmapslab.de
                                                           113
Einführung in Topic Maps
TMQL – Where Clause and Order-By
 ●   optional clauses of a flwr expression
 ●   same syntax and meaning like as a part of select expressions




     topicmapslab.de
                                                                    114
Einführung in Topic Maps
TMQL – Where Clause and Order-By

   FOR $composer IN // http://psi.ontopedia.net/Composer
   FOR $opera IN // http://psi.ontopedia.net/Opera
   WHERE
       http://psi.ontopedia.net/composed_by(
       http://psi.ontopedia.net/Composer : $composer ,
       http://psi.ontopedia.net/Work : $opera)
   ORDER BY $composer >> item
   RETURN $composer, $opera

  topicmapslab.de
                                                           115
Einführung in Topic Maps
TMQL – Flwr Expression exercises

  Task

                    Select all operas composed by puccini.




  topicmapslab.de
                                                             116
Einführung in Topic Maps
TMQL – Flwr Expression exercises

  Task

                     Select all operas composed by puccini.




  Solution

  FOR $opera IN opera WHERE composed_by ( composer : puccini , work : $opera )
                                  RETURN $opera
                                           or
                 FOR $opera IN http://psi.ontopedia.net/Opera WHERE
     http://psi.ontopedia.net/composed_by ( http://psi.ontopedia.net/Composer :
      http://psi.ontopedia.net/Puccini , http://psi.ontopedia.net/Work : $opera )
                                  RETURN $opera


  topicmapslab.de
                                                                                    117
Einführung in Topic Maps




            Thank you for your attention!




  topicmapslab.de
                                       topicmapslab.de

Mais conteúdo relacionado

Semelhante a Introduction to TMQL query language

Declarative Experimentation in Information Retrieval using PyTerrier
Declarative Experimentation in Information Retrieval using PyTerrierDeclarative Experimentation in Information Retrieval using PyTerrier
Declarative Experimentation in Information Retrieval using PyTerrierCrai Macdonald
 
Master-Thesis-Matlab-Projects
Master-Thesis-Matlab-ProjectsMaster-Thesis-Matlab-Projects
Master-Thesis-Matlab-ProjectsPhdtopiccom
 
Using Spark Mllib Models in a Production Training and Serving Platform: Exper...
Using Spark Mllib Models in a Production Training and Serving Platform: Exper...Using Spark Mllib Models in a Production Training and Serving Platform: Exper...
Using Spark Mllib Models in a Production Training and Serving Platform: Exper...Databricks
 
MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...
MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...
MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...Spark Summit
 
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten ClusteringWebinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten ClusteringContinuent
 
JRuby Topic Maps
JRuby Topic MapsJRuby Topic Maps
JRuby Topic Mapstmra
 
Topic Maps Web Service: Case Examples and General Structure
Topic Maps Web Service: Case Examples and General StructureTopic Maps Web Service: Case Examples and General Structure
Topic Maps Web Service: Case Examples and General Structuretmra
 
Guglielmo iozzia - Google I/O extended dublin 2018
Guglielmo iozzia - Google  I/O extended dublin 2018Guglielmo iozzia - Google  I/O extended dublin 2018
Guglielmo iozzia - Google I/O extended dublin 2018Guglielmo Iozzia
 
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...Spark Summit
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
 
Keras_Core_introduction.pptx
Keras_Core_introduction.pptxKeras_Core_introduction.pptx
Keras_Core_introduction.pptxGDSCBBIT
 
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark ClustersTensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark ClustersDataWorks Summit
 
Using Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.twUsing Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.twKazuho Oku
 
A Gomez TimTrack at C E S G A
A Gomez  TimTrack at C E S G AA Gomez  TimTrack at C E S G A
A Gomez TimTrack at C E S G AMiguel Morales
 
Distributed tracing - get a grasp on your production
Distributed tracing - get a grasp on your productionDistributed tracing - get a grasp on your production
Distributed tracing - get a grasp on your productionnklmish
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules RestructuredDoiT International
 

Semelhante a Introduction to TMQL query language (20)

Declarative Experimentation in Information Retrieval using PyTerrier
Declarative Experimentation in Information Retrieval using PyTerrierDeclarative Experimentation in Information Retrieval using PyTerrier
Declarative Experimentation in Information Retrieval using PyTerrier
 
Master-Thesis-Matlab-Projects
Master-Thesis-Matlab-ProjectsMaster-Thesis-Matlab-Projects
Master-Thesis-Matlab-Projects
 
Using Spark Mllib Models in a Production Training and Serving Platform: Exper...
Using Spark Mllib Models in a Production Training and Serving Platform: Exper...Using Spark Mllib Models in a Production Training and Serving Platform: Exper...
Using Spark Mllib Models in a Production Training and Serving Platform: Exper...
 
MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...
MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...
MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library...
 
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten ClusteringWebinar Slides: MySQL Native Replication vs. Tungsten Clustering
Webinar Slides: MySQL Native Replication vs. Tungsten Clustering
 
JRuby Topic Maps
JRuby Topic MapsJRuby Topic Maps
JRuby Topic Maps
 
Evolution in the large
Evolution in the largeEvolution in the large
Evolution in the large
 
Topic Maps Web Service: Case Examples and General Structure
Topic Maps Web Service: Case Examples and General StructureTopic Maps Web Service: Case Examples and General Structure
Topic Maps Web Service: Case Examples and General Structure
 
Guglielmo iozzia - Google I/O extended dublin 2018
Guglielmo iozzia - Google  I/O extended dublin 2018Guglielmo iozzia - Google  I/O extended dublin 2018
Guglielmo iozzia - Google I/O extended dublin 2018
 
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
Keras_Core_introduction.pptx
Keras_Core_introduction.pptxKeras_Core_introduction.pptx
Keras_Core_introduction.pptx
 
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark ClustersTensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters
 
mlp10-sem2.pdf
mlp10-sem2.pdfmlp10-sem2.pdf
mlp10-sem2.pdf
 
Using Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.twUsing Q4M - a message queue for MySQL #osdc.tw
Using Q4M - a message queue for MySQL #osdc.tw
 
A Gomez TimTrack at C E S G A
A Gomez  TimTrack at C E S G AA Gomez  TimTrack at C E S G A
A Gomez TimTrack at C E S G A
 
Meetup tensorframes
Meetup tensorframesMeetup tensorframes
Meetup tensorframes
 
Distributed tracing - get a grasp on your production
Distributed tracing - get a grasp on your productionDistributed tracing - get a grasp on your production
Distributed tracing - get a grasp on your production
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules Restructured
 

Mais de tmra

Topic Maps for improved access to and use of content in relational databases ...
Topic Maps for improved access to and use of content in relational databases ...Topic Maps for improved access to and use of content in relational databases ...
Topic Maps for improved access to and use of content in relational databases ...tmra
 
External Schema for Topic Map Database
External Schema for Topic Map DatabaseExternal Schema for Topic Map Database
External Schema for Topic Map Databasetmra
 
Weber 2010 brn
Weber 2010 brnWeber 2010 brn
Weber 2010 brntmra
 
Subject Headings make information to be topic maps
Subject Headings make information to be topic mapsSubject Headings make information to be topic maps
Subject Headings make information to be topic mapstmra
 
Inquiry Optimization Technique for a Topic Map Database
Inquiry Optimization Technique for a Topic Map DatabaseInquiry Optimization Technique for a Topic Map Database
Inquiry Optimization Technique for a Topic Map Databasetmra
 
Topic Merge Scenarios for Knowledge Federation
Topic Merge Scenarios for Knowledge FederationTopic Merge Scenarios for Knowledge Federation
Topic Merge Scenarios for Knowledge Federationtmra
 
JavaScript Topic Maps in server environments
JavaScript Topic Maps in server environmentsJavaScript Topic Maps in server environments
JavaScript Topic Maps in server environmentstmra
 
Modelling IMS QTI with Topic Maps
Modelling IMS QTI with Topic MapsModelling IMS QTI with Topic Maps
Modelling IMS QTI with Topic Mapstmra
 
Hatana - Virtual Topic Map Merging
Hatana - Virtual Topic Map MergingHatana - Virtual Topic Map Merging
Hatana - Virtual Topic Map Mergingtmra
 
Designing a gui_description_language_with_topic_maps
Designing a gui_description_language_with_topic_mapsDesigning a gui_description_language_with_topic_maps
Designing a gui_description_language_with_topic_mapstmra
 
Maiana - The social Topic Maps explorer
Maiana - The social Topic Maps explorerMaiana - The social Topic Maps explorer
Maiana - The social Topic Maps explorertmra
 
Tmra2010 matsuuraposter
Tmra2010 matsuuraposterTmra2010 matsuuraposter
Tmra2010 matsuurapostertmra
 
Automatic semantic interpretation of unstructured data for knowledge management
Automatic semantic interpretation of unstructured data for knowledge managementAutomatic semantic interpretation of unstructured data for knowledge management
Automatic semantic interpretation of unstructured data for knowledge managementtmra
 
Putting topic maps to rest.tmra2010
Putting topic maps to rest.tmra2010Putting topic maps to rest.tmra2010
Putting topic maps to rest.tmra2010tmra
 
Presentation final
Presentation finalPresentation final
Presentation finaltmra
 
Evaluation of Instances Asset in a Topic Maps-Based Ontology
Evaluation of Instances Asset in a Topic Maps-Based OntologyEvaluation of Instances Asset in a Topic Maps-Based Ontology
Evaluation of Instances Asset in a Topic Maps-Based Ontologytmra
 
Defining Domain-Specific Facets for Topic Maps With TMQL Path Expressions
Defining Domain-Specific Facets for Topic Maps With TMQL Path ExpressionsDefining Domain-Specific Facets for Topic Maps With TMQL Path Expressions
Defining Domain-Specific Facets for Topic Maps With TMQL Path Expressionstmra
 
Mappe1
Mappe1Mappe1
Mappe1tmra
 
Et Tu, Brute? Topic Maps and Discourse Semantics
Et Tu, Brute? Topic Maps and Discourse SemanticsEt Tu, Brute? Topic Maps and Discourse Semantics
Et Tu, Brute? Topic Maps and Discourse Semanticstmra
 
A PHP library for Ontopia-CMS Integration
A PHP library for Ontopia-CMS IntegrationA PHP library for Ontopia-CMS Integration
A PHP library for Ontopia-CMS Integrationtmra
 

Mais de tmra (20)

Topic Maps for improved access to and use of content in relational databases ...
Topic Maps for improved access to and use of content in relational databases ...Topic Maps for improved access to and use of content in relational databases ...
Topic Maps for improved access to and use of content in relational databases ...
 
External Schema for Topic Map Database
External Schema for Topic Map DatabaseExternal Schema for Topic Map Database
External Schema for Topic Map Database
 
Weber 2010 brn
Weber 2010 brnWeber 2010 brn
Weber 2010 brn
 
Subject Headings make information to be topic maps
Subject Headings make information to be topic mapsSubject Headings make information to be topic maps
Subject Headings make information to be topic maps
 
Inquiry Optimization Technique for a Topic Map Database
Inquiry Optimization Technique for a Topic Map DatabaseInquiry Optimization Technique for a Topic Map Database
Inquiry Optimization Technique for a Topic Map Database
 
Topic Merge Scenarios for Knowledge Federation
Topic Merge Scenarios for Knowledge FederationTopic Merge Scenarios for Knowledge Federation
Topic Merge Scenarios for Knowledge Federation
 
JavaScript Topic Maps in server environments
JavaScript Topic Maps in server environmentsJavaScript Topic Maps in server environments
JavaScript Topic Maps in server environments
 
Modelling IMS QTI with Topic Maps
Modelling IMS QTI with Topic MapsModelling IMS QTI with Topic Maps
Modelling IMS QTI with Topic Maps
 
Hatana - Virtual Topic Map Merging
Hatana - Virtual Topic Map MergingHatana - Virtual Topic Map Merging
Hatana - Virtual Topic Map Merging
 
Designing a gui_description_language_with_topic_maps
Designing a gui_description_language_with_topic_mapsDesigning a gui_description_language_with_topic_maps
Designing a gui_description_language_with_topic_maps
 
Maiana - The social Topic Maps explorer
Maiana - The social Topic Maps explorerMaiana - The social Topic Maps explorer
Maiana - The social Topic Maps explorer
 
Tmra2010 matsuuraposter
Tmra2010 matsuuraposterTmra2010 matsuuraposter
Tmra2010 matsuuraposter
 
Automatic semantic interpretation of unstructured data for knowledge management
Automatic semantic interpretation of unstructured data for knowledge managementAutomatic semantic interpretation of unstructured data for knowledge management
Automatic semantic interpretation of unstructured data for knowledge management
 
Putting topic maps to rest.tmra2010
Putting topic maps to rest.tmra2010Putting topic maps to rest.tmra2010
Putting topic maps to rest.tmra2010
 
Presentation final
Presentation finalPresentation final
Presentation final
 
Evaluation of Instances Asset in a Topic Maps-Based Ontology
Evaluation of Instances Asset in a Topic Maps-Based OntologyEvaluation of Instances Asset in a Topic Maps-Based Ontology
Evaluation of Instances Asset in a Topic Maps-Based Ontology
 
Defining Domain-Specific Facets for Topic Maps With TMQL Path Expressions
Defining Domain-Specific Facets for Topic Maps With TMQL Path ExpressionsDefining Domain-Specific Facets for Topic Maps With TMQL Path Expressions
Defining Domain-Specific Facets for Topic Maps With TMQL Path Expressions
 
Mappe1
Mappe1Mappe1
Mappe1
 
Et Tu, Brute? Topic Maps and Discourse Semantics
Et Tu, Brute? Topic Maps and Discourse SemanticsEt Tu, Brute? Topic Maps and Discourse Semantics
Et Tu, Brute? Topic Maps and Discourse Semantics
 
A PHP library for Ontopia-CMS Integration
A PHP library for Ontopia-CMS IntegrationA PHP library for Ontopia-CMS Integration
A PHP library for Ontopia-CMS Integration
 

Último

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

Introduction to TMQL query language

  • 1. Einführung in Topic Maps Topic Maps Query Language Sven Krosse M. Sc. Topic Maps Lab an der Universität Leipzig krosse@informatik.uni-leipzig.de topicmapslab.de topicmapslab.de
  • 2. Einführung in Topic Maps introduce myself Oct. 2004 – matriculation at the university of cooperative education at Leipzig Sep 2007 – graduation in Computer Science with the diploma Oct 2007 – matriculation at the university of Leipzig topicmapslab.de 2
  • 3. Einführung in Topic Maps introduce myself May 2009 – joining the Topic Maps Lab at the university of Leipzig Sep 2009 – finishing my study with the Master of Computer Science – the subject of my master's thesis was the implementation of TMQL4J topicmapslab.de 3
  • 4. Einführung in Topic Maps Agenda 1 the Ontopia Topic Maps Engine 1.1 Omnigator – a generic topic maps browser 1.2 Installing Ontopia with all extensions 2 TMQL4J – the first java-based TMQL Engine 2.1 Architecture 2.2 TMQL4Ontopia - Integration into Ontopia topicmapslab.de 4
  • 5. Einführung in Topic Maps Agenda 3 Introduction of the language TMQL 3.1 Why do we need a language like TMQL? 3.2 How can we use TMQL? 3.3 Are there any alternatives for TMQL? 4 TMQL – the basics of the ISO draft 4.1 grammar levels 4.2 literals and references 4.3 navigation 4.4 variables topicmapslab.de 5
  • 6. Einführung in Topic Maps Agenda 5 Learning the high-level expressions 5.1 Path Expression 5.2 Select Expression 5.3 Flwr Expression topicmapslab.de 6
  • 7. Einführung in Topic Maps the Ontopia Topic Maps Engine topicmapslab.de topicmapslab.de
  • 8. Einführung in Topic Maps the Ontopia Topic Maps Engine ● the topics map engine of the company Ontopia AS ● contains a many tools and utilities for using topic maps ● in summer 2009 the Ontopia topic maps engine becomes open source ● supported by a big community ● supports the TMAPI 2.0 specification topicmapslab.de 8
  • 9. Einführung in Topic Maps Omnigator – generic topic maps browser ● part of the Ontopia engine ● web-based topic maps browser ● displaying information about topics and associations ● running on a Apache Tomcat server topicmapslab.de 9
  • 10. Einführung in Topic Maps Omnigator – generic topic maps browser topicmapslab.de 10
  • 11. Einführung in Topic Maps Installing Ontopia with all extensions ● needed components ● JRE 5.0 or higher ● Ontopia distribution ● tmql4j library ● tmql4Ontopia library ● a web browser :) topicmapslab.de 11
  • 12. Einführung in Topic Maps TMQL4J - the first Java-based TMQL Engine topicmapslab.de topicmapslab.de
  • 13. Einführung in Topic Maps TMQL4J ● TMQL Querying Engine written in Java ● current version 1.0.0 ● abstracts from underlying topic map engine ● creates an abstraction layer on top of the TMAPI ● encapsulate the whole querying process ● implements additional cache mechanism ● simple configuration mechanism topicmapslab.de 13
  • 14. Einführung in Topic Maps TMQL4J - architecture ● designed as process chain of independent modules ● each module can replace by a domain-specific implementation ● based modules – TMQL4J pre-processor – TMQL4J lexer – TMQL4J parser – TMQL4J interpreter – TMQL4J post-processor topicmapslab.de 14
  • 15. Einführung in Topic Maps TMQL4J – process chain environment and cleaned TMQL lexical transformed parser tree matches system variables TMQL query tokens results TMQL TMQL4J TMQL4J TMQL4J Initialization TMQL4J lexer TMQL4J parser results query pre-processor interpreter post-processor topicmapslab.de 15
  • 16. Einführung in Topic Maps TMQL4J – process chain environment and cleaned TMQL lexical transformed parser tree matches system variables TMQL query tokens results TMQL TMQL4J TMQL4J TMQL4J Initialization TMQL4J lexer TMQL4J parser results query pre-processor interpreter post-processor process flow of the TMQL querying process topicmapslab.de 16
  • 17. Einführung in Topic Maps TMQL4J – process chain data flow of the TMQL querying process environment and cleaned TMQL lexical transformed parser tree matches system variables TMQL query tokens results TMQL TMQL4J TMQL4J TMQL4J Initialization TMQL4J lexer TMQL4J parser results query pre-processor interpreter post-processor topicmapslab.de 17
  • 18. Einführung in Topic Maps TMQL4J – application architecture application TMQL query direct access TMQL4J indirect access TMAPI topic maps engine topic maps backend topicmapslab.de 18
  • 19. Einführung in Topic Maps TMQL4Ontopia ● generic query plug-in for the Omnigator ● current version 0.0.1 ● use the TMQL4J engine ● implements Ontopia specific modules ● allows result export as CSV file topicmapslab.de 19
  • 20. Einführung in Topic Maps result view of TMQL4Ontopia topicmapslab.de 20
  • 21. Einführung in Topic Maps parser tree view of TMQL4Ontopia topicmapslab.de 21
  • 22. Einführung in Topic Maps Introduction of the language TMQL topicmapslab.de topicmapslab.de
  • 23. Einführung in Topic Maps Introduction of the language TMQL ● TMQL is a topic maps query language ● part of ISO standardization ( ISO 18048 ) ● discussions about parts of the final standard ● supports different styles of querying ● supports the definition of ontology in context of a query topicmapslab.de 23
  • 24. Einführung in Topic Maps Why do we need a language like TMQL? ● the number of applications using topic maps increases fast ● the data base becomes to complex ● complex handling by using TMAPI code fragments ● complex terminology and ontology ● number of topics and associations too huge ● different views of the data in context of different business processes topicmapslab.de 24
  • 25. Einführung in Topic Maps Why do we need a language like TMQL? ● Example TMAPI vs TMQL → extract all player names of the association member_of topicmapslab.de 25
  • 26. Einführung in Topic Maps ● TMAPI ( for example in Java ) TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance(); TopicMapSystem topicMapSystem = factory.newTopicMapSystem(); TopicMap topicMap = topicMapSystem.getTopicMap("my-topic-map"); // type of the association Topic type = (Topic)topicMap.getConstructById("member_of"); // extract all association items of the type member-of TypeInstanceIndex index = topicMap.getIndex(TypeInstanceIndex.class); for ( Association association : index.getAssociations(type)){ // extract all roles of the association item for ( Role role : association.getRoles()){ // extract the role player and the names names.addAll(role.getPlayer().getNames()); } topicmapslab.de 26
  • 27. Einführung in Topic Maps ● TMQL4J TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance(); TopicMapSystem topicMapSystem = factory.newTopicMapSystem(); TopicMap topicMap = topicMapSystem.getTopicMap("my-topic-map"); // initialize the tmql4j engine IQuery query = new QueryImpl("member_of << types >> players / tm:name") TMQLRuntime runtime = new TMQLRuntime(topicMapSystem, Arrays.asList(new TopicMap[] { topicMap }), query); runtime.run(); // extract result set names.addAll((ITupleSequence<Name>) runtime .getStoredValue(TMQLRuntime.TMQL_RUNTIME_RESULTPROCESSING_RESULT)); topicmapslab.de 27
  • 28. Einführung in Topic Maps How can we use TMQL? ● different opportunities ● TMQL4J ● PerlTM ● Hands on ;-) topicmapslab.de 28
  • 29. Einführung in Topic Maps Are there any alternatives for TMQL? ● there are other languages for querying topic maps ● Tolog – a language similar to Prolog – supports predicate-invocations and boolean combinations ● Toma – a language similar to SQL – developed by Rani Pinchuk topicmapslab.de 29
  • 30. Einführung in Topic Maps Are there any alternatives for TMQL? ● but: ● there expressiveness are lower than TMQL ● TMQL supports different query styles for different domains topicmapslab.de 30
  • 31. Einführung in Topic Maps TMQL - the basics of the current draft topicmapslab.de topicmapslab.de
  • 32. Einführung in Topic Maps TMQL – the basics of the ISO draft ● only the basics of the ISO draft ● basics important to understand the syntax of TMQL ● learning high-level expressions by doing topicmapslab.de 32
  • 33. Einführung in Topic Maps TMQL – grammar levels ● define the terminals of the language ● based on Regular Expressions example: $variable | SELECT | FOR Token Level topicmapslab.de 33
  • 34. Einführung in Topic Maps TMQL – grammar levels ● define the production rules of TMQL ● combination of terminals example: tuple-expression := <value-expression> Canonical Level Token Level topicmapslab.de 34
  • 35. Einführung in Topic Maps TMQL – grammar levels ● define the shortcuts as term substitutions anchor / tm:name ==> anchor >> chracteristics tm:name Non-Canonical Level Canonical Level Token Level topicmapslab.de 35
  • 36. Einführung in Topic Maps TMQL – literals or atoms ● atoms defined as constant literals ● atoms are data-types and operators ● supported data-types are an extract of the CTM data- types and XSD date and dateTime topicmapslab.de 36
  • 37. Einführung in Topic Maps TMQL – literals or atoms 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 /"([^"]|")*"/ | /'([^']|')*'/ source: http://www.isotopicmaps.org/tmql/tmql.html topicmapslab.de 37
  • 38. Einführung in Topic Maps TMQL – references ● references used to identify topics in context of a TMQL query ● supports – item-identifier – subject-identifier – subject-locators ● possible to use relative IRI as identifier or locator topicmapslab.de 38
  • 39. Einführung in Topic Maps TMQL – references example ● item-identifier puccini ● subject-identifier http://psi.ontopedia.net/Puccini ● subject-locator http://psi.ontopedia.net/Puccini topicmapslab.de 39
  • 40. Einführung in Topic Maps TMQL – navigation ● based on the TMRM ● define 12 axes ● can use as a part of path expression ● symbolize navigation throw the abstract topic map graph ● each axis can used in two directions ● syntax navigation := axis-name direction optional-type direction := << | >> topicmapslab.de 40
  • 41. Einführung in Topic Maps TMQL – identifier axes ● one axis for each identifier type ● do not supports optional types ● forward-direction ● deliver the identifier of the given topic ● only supports topic items ● backward-direction ● deliver the topic with this identifier ● only supports string literals topicmapslab.de 41
  • 42. Einführung in Topic Maps TMQL – identifier axes examples ● item-identifier http://psi.ontopedia.net/Puccini >> item ● subject-identifier http://psi.ontopedia.net/Puccini >> indicators ● subject-locator http://psi.ontopedia.net/Puccini << locators topicmapslab.de 42
  • 43. Einführung in Topic Maps TMQL – type-hierarchy axes ● supports is-instance-of and a-kind-of associations ● forward-direction ● deliver the types of given instance ( type-instance) ● deliver the supertypes of given type ( supertype-subtype) ● supports topic items or association items ● backward-direction ● deliver the instances of given type ( type-instance) ● deliver the subtypes of given type ( supertype-subtype) ● supports topic items or association items topicmapslab.de 43
  • 44. Einführung in Topic Maps TMQL – type hierarchy axes examples ● type-instance http://psi.ontopedia.net/Puccini >> types http://psi.ontopedia.net/Composer << types ● supertype-subtype http://psi.ontopedia.net/Composer >> supertypes http://psi.ontopedia.net/Composer << supertypes topicmapslab.de 44
  • 45. Einführung in Topic Maps TMQL – association axes ● forward-direction ● deliver all roles of given association ( roles ) ● deliver all players of given association ( players ) ● deliver all players playing with given topic ( traverse ) ● backward-direction ● deliver all association items using the given role ( roles ) ● deliver all association items using the given player ( players ) ● deliver all associations items connected with the given association by the same player ( traverse ) topicmapslab.de 45
  • 46. Einführung in Topic Maps TMQL – association axes examples ● roles http://psi.ontopedia.net/composed_by >> roles http://psi.ontopedia.net/Composer << roles ● players http://psi.ontopedia.net/composed_by >> players http://psi.ontopedia.net/Puccini << players ● traverse http://psi.ontopedia.net/Puccini >> traverse http://psi.ontopedia.net/composed_by << traversee topicmapslab.de 46
  • 47. Einführung in Topic Maps TMQL – characteristics axis ● forward-direction ● deliver all names and occurrences of given topic ● only supports topic items ● backward-direction ● deliver the topic item using the given characteristic ● only supports names and occurrences topicmapslab.de 47
  • 48. Einführung in Topic Maps TMQL – characteristics axis examples ● all names of puccini http://psi.ontopedia.net/Puccini >> characteristics tm:name ● all occurrences of puccini http://psi.ontopedia.net/Puccini >> characteristics tm:occurrence topicmapslab.de 48
  • 49. Einführung in Topic Maps TMQL – scope axis ● forward-direction ● deliver the scope of the given construct ● supports names, occurrences or associations ● backward-direction ● deliver all constructs with the given scope ● only supports topic items topicmapslab.de 49
  • 50. Einführung in Topic Maps TMQL – scope axis examples ● the scope of the names of puccini http://psi.ontopedia.net/Puccini >> characteristics tm:name >> scope ● all constructs with the scope web http://psi.ontopedia.net/Web << scope topicmapslab.de 50
  • 51. Einführung in Topic Maps TMQL – reifier axis ● forward-direction ● deliver the reifier of the given construct ● supports names, occurrences or associations ● backward-direction ● deliver the construct reifies by the given topic item ● only supports topic items topicmapslab.de 51
  • 52. Einführung in Topic Maps TMQL – reifier axis examples ● the construct reified by the topic item A Philatelic History http://home.prcn.org/~pauld/opera/ >> reifier ● the reifier of this construct http://home.prcn.org/~pauld/opera/ >> reifier << reifier topicmapslab.de 52
  • 53. Einführung in Topic Maps TMQL – atomify axis ● forward-direction ● deliver the value of the given characteristics ● supports names or occurrences ● backward-direction ● deliver the characteristics with the given value ● supports all literals topicmapslab.de 53
  • 54. Einführung in Topic Maps TMQL – atomify axis examples ● the value of the name puccini http://psi.ontopedia.net/Puccini >> characteristics tm:name >> atomify or http://psi.ontopedia.net/Puccini / tm:name topicmapslab.de 54
  • 55. Einführung in Topic Maps TMQL – variables ● using in context of high-level expression ● supported by select expression and flwr expression ● different prefixes $ only bind literals or items @ only bind a tuple % only bind a sequence topicmapslab.de 55
  • 56. Einführung in Topic Maps TMQL – variables Tuple Tuples are ordered collections of simple values (atoms and items). Tuple-Sequence Tuple sequences are sequences of tuples where all tuples have identical length. Tuple sequences can be generated with tuple expressions. topicmapslab.de 56
  • 57. Einführung in Topic Maps TMQL – protected variables ● variable names can post-fixed by different number of primes ' ● variables only differ in number of primes ● can not be bind to the same value topicmapslab.de 57
  • 58. Einführung in Topic Maps TMQL – variables example ● variables $composer // can be bind to puccini @composers // can be bind to a tuple %composers // can be bind to a sequence topicmapslab.de 58
  • 59. Einführung in Topic Maps TMQL – variables example ● tuple ( puccini , "puccini" , “1900-01-01” ) ● sequence { ( puccini , "puccini" , “1900-01-01” ) , ( fontane , "fontane" , “1900-01-01” ) } topicmapslab.de 59
  • 60. Einführung in Topic Maps TMQL - the high-level expressions - learning by doing - topicmapslab.de topicmapslab.de
  • 61. Einführung in Topic Maps TMQL – Path Expression ● combination of navigation steps or predicate invocations ● predicate-invocation – describe associations – similar to tolog topicmapslab.de 61
  • 62. Einführung in Topic Maps TMQL – predicate-invocation example composed_by ( composer : puccini , opera : le_villi , … ) topicmapslab.de 62
  • 63. Einführung in Topic Maps TMQL – predicate-invocation example association type composed_by ( composer : puccini , opera : le_villi , … ) topicmapslab.de 63
  • 64. Einführung in Topic Maps TMQL – predicate-invocation example role type composed_by ( composer : puccini , opera : le_villi , … ) topicmapslab.de 64
  • 65. Einführung in Topic Maps TMQL – predicate-invocation example player composed_by ( composer : puccini , opera : le_villi , … ) topicmapslab.de 65
  • 66. Einführung in Topic Maps TMQL – predicate-invocation example ellipsis composed_by ( composer : puccini , opera : le_villi , … ) topicmapslab.de 66
  • 67. Einführung in Topic Maps TMQL – Path Expression exercises Task All names of all instances of composer topicmapslab.de 67
  • 68. Einführung in Topic Maps TMQL – Path Expression exercises Task All names of all instances of composer Solution composer << types >> characteristics tm:name or http://psi.ontopedia.net/Composer << types >> characteristics tm:name topicmapslab.de 68
  • 69. Einführung in Topic Maps TMQL – Path Expression exercises Task The names of all topis playing the role composer in association composed_by. topicmapslab.de 69
  • 70. Einführung in Topic Maps TMQL – Path Expression exercises Task The names of all topis playing the role composer in association composed_by. Solution composed_by >> players composed >> characteristics tm:name or http://psi.ontopedia.net/composed_by >> players http://psi.ontopedia.net/Composer >> characteristics tm:name topicmapslab.de 70
  • 71. Einführung in Topic Maps TMQL – filter and projection ● filters – post-fixed after navigation – surrounded by square brackets – supported filters – index [ number ] – index-range [ number .. number ] – types [ ^ type ] – scope [ @ scope ] – boolean-expressions [ … ] topicmapslab.de 71
  • 72. Einführung in Topic Maps TMQL – filter and projection ● projection – post-fixed after navigation – surrounded by round brackets – defined as a tuple-expression – simple navigation from current node – current node symbolize by dot topicmapslab.de 72
  • 73. Einführung in Topic Maps TMQL – filter and projection example ● the first name of puccini http://psi.ontopedia.net/Puccini >> characteristics tm:name [0] ● Projection of characteristics and associations played by instances of composer http://psi.ontopedia.net/Composer << types ( . >> characteristics , . << players ) topicmapslab.de 73
  • 74. Einführung in Topic Maps TMQL – filter and projection example navigation composer << types ( . >> characteristics , . << players ) topicmapslab.de 74
  • 75. Einführung in Topic Maps TMQL – filter and projection example projection definition composer << types ( . >> characteristics , . << players ) topicmapslab.de 75
  • 76. Einführung in Topic Maps TMQL – filter and projection example current node composer << types ( . >> characteristics , . << players ) topicmapslab.de 76
  • 77. Einführung in Topic Maps TMQL – filter and projection example projection composer << types ( . >> characteristics , . << players ) topicmapslab.de 77
  • 78. Einführung in Topic Maps TMQL – Path Expression exercises Task Create a projection of all name and all occurrence values of all instances of composer. topicmapslab.de 78
  • 79. Einführung in Topic Maps TMQL – Path Expression exercises Task Create a projection of all name and all occurrence values of all instances of composer. Solution composer << types ( . / tm:name , . / tm:occurrence ) or http://psi.ontopedia.net/Composer << types( . / tm:name, . / tm:occurrence ) topicmapslab.de 79
  • 80. Einführung in Topic Maps TMQL – Path Expression exercises Task All names of all instances of composer in scope short name. topicmapslab.de 80
  • 81. Einführung in Topic Maps TMQL – Path Expression exercises Task All names of all instances of composer in scope short name. Solution composer << types >> characteristics tm:name @ short_name or http://psi.ontopedia.net/Composer << types >> characteristics [ @ http://psi.ontopedia.net/short_name ] topicmapslab.de 81
  • 82. Einführung in Topic Maps TMQL – Path Expression exercises Task Extract the characteristics of all composers and filter them by the type date_of_death. topicmapslab.de 82
  • 83. Einführung in Topic Maps TMQL – Path Expression exercises Task Extract the characteristics of all composers and filter them by the type date_of_death. Solution composer << types >> characteristics [ ^ date_of_death ] or http://psi.ontopedia.net/Composer << types >> characteristics [ ^ http://psi.ontopedia.net/date_of_death ] topicmapslab.de 83
  • 84. Einführung in Topic Maps TMQL – Select Expression ● similar to SQL ● supports variables topicmapslab.de 84
  • 85. Einführung in Topic Maps TMQL – Select Clause ● only non-optional clause of a select expression ● starts with the keyword SELECT ● contains a number of value expressions – variables – navigations – functions topicmapslab.de 85
  • 86. Einführung in Topic Maps TMQL – Select Clause example SELECT http://psi.ontopedia.net/Puccini / tm:name , http://psi.ontopedia.net/Puccini / tm:occurrence topicmapslab.de 86
  • 87. Einführung in Topic Maps TMQL – Where Clause ● optional clause of a select expression ● starts with the keyword WHERE ● contains a number of boolean-expressions – exists-clause – forall-clause – negation – conjunction – disjunction topicmapslab.de 87
  • 88. Einführung in Topic Maps TMQL – Where Clause example SELECT $composer WHERE $composer ISA http://psi.ontopedia.net/Composer topicmapslab.de 88
  • 89. Einführung in Topic Maps TMQL – Exists Clause ● specifies the number of items satisfying a condition ● numerically unrestricted – number of satisfying items is not important – starts with keyword EXISTS or SOME – can contain path expressions ● numerically restricted – define the number of satisfying items as upper or lower bounds AT LEAST number set SATISFIES boolean-expression AT MOST number set SATISFIES boolean-expression topicmapslab.de 89
  • 90. Einführung in Topic Maps TMQL – Exists Clause example SELECT $composer WHERE EXISTS $composer ISA http://psi.ontopedia.net/Composer SELECT $composer WHERE AT LEAST 4 $opera IN // http://psi.ontopedia.net/Opera SATISFIES http://psi.ontopedia.net/composed_by ( http://psi.ontopedia.net/Composer : $composer , http://psi.ontopedia.net/Work : $work ) topicmapslab.de 90
  • 91. Einführung in Topic Maps TMQL – Forall Clause ● all items have to satisfy the condition EVERY variable IN content SATISFIES boolean-expression topicmapslab.de 91
  • 92. Einführung in Topic Maps TMQL – Forall Clause example SELECT $composer WHERE EVERY $opera IN $composer << traverse SATISFIES $opera == http://psi.ontopedia.net/Le_Villi topicmapslab.de 92
  • 93. Einführung in Topic Maps TMQL – boolean combination ● negation symbolized by the keyword NOT ● conjunction symbolized by the keyword AND ● disjunction symbolized by the keyword OR topicmapslab.de 93
  • 94. Einführung in Topic Maps TMQL – boolean combination example SELECT $composer WHERE NOT ( $composer ISA http://psi.ontopedia.net/Composer ) SELECT $composer , $opera WHERE $composer ISA http://psi.ontopedia.net/Composer AND $opera ISA http://psi.ontopedia.net/Opera topicmapslab.de 94
  • 95. Einführung in Topic Maps TMQL – From Clause ● optional clause of a select expression ● starts with the keyword FROM ● define the context of the select expression ● have to return a topic map or sequence of constructs topicmapslab.de 95
  • 96. Einführung in Topic Maps TMQL – From Clause example SELECT $composer FROM // http://psi.ontopedia.net/Musician WHERE $composer ISA http://psi.ontopedia.net/Composer topicmapslab.de 96
  • 97. Einführung in Topic Maps TMQL – Unique Clause ● optional clause of a select expression ● only the keyword UNIQUE ● unify the result set topicmapslab.de 97
  • 98. Einführung in Topic Maps TMQL – Unique Clause example SELECT $composer FROM // http://psi.ontopedia.net/Musician WHERE $composer ISA http://psi.ontopedia.net/Composer UNIQUE topicmapslab.de 98
  • 99. Einführung in Topic Maps TMQL – Order-By Clause ● optional clause of a select expression ● starts with the keyword ORDER BY ● define an order of the variable bindings of the where clause topicmapslab.de 99
  • 100. Einführung in Topic Maps TMQL – Order-By Clause example SELECT $composer FROM // http://psi.ontopedia.net/Musician WHERE $composer ISA http://psi.ontopedia.net/Composer ORDER BY $composer / tm:name topicmapslab.de 100
  • 101. Einführung in Topic Maps TMQL – Limit and Offset ● optional clauses of a select expression ● starts with the keyword LIMIT or OFFSET ● define the selection window after querying topicmapslab.de 101
  • 102. Einführung in Topic Maps TMQL – Limit and Offset example SELECT $composer FROM // http://psi.ontopedia.net/Musician WHERE $composer ISA http://psi.ontopedia.net/Composer ORDER BY $composer / tm:name OFFSET 2 LIMIT 10 topicmapslab.de 102
  • 103. Einführung in Topic Maps TMQL – Select Expression exercises Task Select all operas composed by puccini. topicmapslab.de 103
  • 104. Einführung in Topic Maps TMQL – Select Expression exercises Task Select all operas composed by puccini. Solution SELECT $opera WHERE composed_by ( composer : puccini , work : $opera ) or SELECT $opera WHERE http://psi.ontopedia.net/composed_by ( http://psi.ontopedia.net/Composer : http://psi.ontopedia.net/Puccini , http://psi.ontopedia.net/Work : $opera ) topicmapslab.de 104
  • 105. Einführung in Topic Maps TMQL – Select Expression exercises Task Select the names of all composers who composed at least one opera. Keep in mind that the work should not be an opera. topicmapslab.de 105
  • 106. Einführung in Topic Maps TMQL – Select Expression exercises Task Select the names of all composers who composed at least one opera. Keep in mind that the work should not be an opera. Solution SELECT $composer / tm:name WHERE $opera ISA opera AND AT MOST 3 SATISFIES composed_by ( work : $opera , composer : $composer ) or SELECT $composer / tm:name WHERE $composer ISA http://psi.ontopedia.net/Composer AND SOME $opera IN // http://psi.ontopedia.net/Opera SATISFIES http://psi.ontopedia.net/composed_by ( http://psi.ontopedia.net/Work : $opera , http://psi.ontopedia.net/Composer : $composer ) topicmapslab.de 106
  • 107. Einführung in Topic Maps TMQL – Select Expression exercises Task Select the topic types which are a kind of composer or where each instance have at least one name. topicmapslab.de 107
  • 108. Einführung in Topic Maps TMQL – Select Expression exercises Task Select the topic types which are a kind of composer or where each instance have at least one name. Solution SELECT $type WHERE $type AKO composer OR EXISTS $type << types / tm:name or SELECT $type WHERE $type AKO http://psi.ontopedia.net/Composer OR EXISTS $type << types / tm:name topicmapslab.de 108
  • 109. Einführung in Topic Maps TMQL – Flwr Expression ● similar to a programming language ● supports variables topicmapslab.de 109
  • 110. Einführung in Topic Maps TMQL – Return Clause ● only non-optional clause of a flwr expression ● starts with the keyword RETURN ● contains a number of value expressions – variables – navigations – functions – XTM and CTM fragments topicmapslab.de 110
  • 111. Einführung in Topic Maps TMQL – Return Clause example RETURN http://psi.ontopedia.net/Puccini / tm:name topicmapslab.de 111
  • 112. Einführung in Topic Maps TMQL – For Clause ● optional clause of a flwr expression ● starts with the keyword FOR ● can contain more than one for clause ● define a variable set topicmapslab.de 112
  • 113. Einführung in Topic Maps TMQL – For Clause example FOR $composer IN // http://psi.ontopedia.net/Composer RETURN $composer FOR $composer IN // http://psi.ontopedia.net/Composer FOR $opera IN // http://psi.ontopedia.net/Opera RETURN $composer, $opera topicmapslab.de 113
  • 114. Einführung in Topic Maps TMQL – Where Clause and Order-By ● optional clauses of a flwr expression ● same syntax and meaning like as a part of select expressions topicmapslab.de 114
  • 115. Einführung in Topic Maps TMQL – Where Clause and Order-By FOR $composer IN // http://psi.ontopedia.net/Composer FOR $opera IN // http://psi.ontopedia.net/Opera WHERE http://psi.ontopedia.net/composed_by( http://psi.ontopedia.net/Composer : $composer , http://psi.ontopedia.net/Work : $opera) ORDER BY $composer >> item RETURN $composer, $opera topicmapslab.de 115
  • 116. Einführung in Topic Maps TMQL – Flwr Expression exercises Task Select all operas composed by puccini. topicmapslab.de 116
  • 117. Einführung in Topic Maps TMQL – Flwr Expression exercises Task Select all operas composed by puccini. Solution FOR $opera IN opera WHERE composed_by ( composer : puccini , work : $opera ) RETURN $opera or FOR $opera IN http://psi.ontopedia.net/Opera WHERE http://psi.ontopedia.net/composed_by ( http://psi.ontopedia.net/Composer : http://psi.ontopedia.net/Puccini , http://psi.ontopedia.net/Work : $opera ) RETURN $opera topicmapslab.de 117
  • 118. Einführung in Topic Maps Thank you for your attention! topicmapslab.de topicmapslab.de