Semantic Sticky Note:
RDF Metadata Access and Querying
       Using GT4 Java WS

      Session 49. July 15th, 2009

       Oscar Corcho, Carlos Buil
  (Universidad Politécnica de Madrid)



                  Work distributed under the license Creative Commons
                      Attribution-Noncommercial-Share Alike 3.0
Tutorial Roadmap
• Objectives
• Hands-on: Build a Semantically-Aware Grid Service
   – Structure and materials
   – Exercises
      • 1. Setup the Globus Container
      • 2. Deploy Semantic Services and Operation Providers
      • 3. Attach Semantic Bindings to a Sticky Note
      • 4. Query Semantic Bindings of a Sticky Note
      • 5. Make Inferences on the Semantic Bindings of a Sticky
        Note
      • 6. Query over a Set of Semantic Bindings (advanced)
      • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Metadata about Sticky Notes




  General
descriptions
   about
   events
Context & Technologies
                                                                             Enabling
                                Ontology      Inference                    technologies
                     RDFS

  2   Query/Retrieve Semantic         Metadata
      Bindings Of all Resources        Service          RDF
                                                                                  1.1
                                                                                 Forward request
                                                                                  via Operation
                                                                                     Provider

                                                                   Properties      Resource
                                                                                Service
                                                                Lifetime        “Oscar Corcho
                        1
Metadata                                                      Semantics          is organizing
                             Create/Query Semantic                               an event in ..
Seeking                     Bindings of this Resource
 Client                                                                              ….. ”
                                                                   Others…




 Minimally-intrusive                                        GT4 WSRF Sticky
   augmentation                                           Note resources to be
                                                          described and shared
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
      • 1. Setup the Globus Container
      • 2. Deploy Semantic Services and Operation Providers
      • 3. Attach Semantic Bindings to a Sticky Note
      • 4. Query Semantic Bindings of a Sticky Note
      • 5. Make Inferences on the Semantic Bindings of a Sticky
        Note
      • 6. Query over a Set of Semantic Bindings (advanced)
      • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Structure
• Each chapter includes:
  – A discussion of the concepts
  – A discussion of implementation details
  – Hands-on exercises
  – A summary
Tutorial Material
• In a browser window, please go to &
  bookmark:
  – http://www.dia.fi.upm.es/~ocorcho/ISSGC2009/Semant
    icGridPractical/
• We will be connecting to
  – ssh issgc-client-01.polytech.unice.fr
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
     • 1. Setup the Globus Container and Sticky Note Service
     • 2. Deploy Semantic Services and Operation Providers
     • 3. Attach Semantic Bindings to a Sticky Note
     • 4. Query Semantic Bindings of a Sticky Note
     • 5. Make Inferences on the Semantic Bindings of a Sticky
       Note
     • 6. Query over a Set of Semantic Bindings (advanced)
     • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Ex1. Deploy the Globus Container
• In this exercise,
  – we will download:
     • The Globus Container
     • The source code for the Semantic Grid tutorial
          – Includes Basic Sticky Note source


  – ... and we will setup (set environment and
    run):
     •   The Globus Container
     •   The Semantic Binding Service Suite
     •   An operation provider for sticky notes
     •   The StickyNote Service
Ex1. Deploy Semantic Services &
                                             Operation Provider
Into the Globus Container we will deploy

                                                        Semantic Binding Service Suite
                    create
          WS-Addressing: epr                                SB Factory       create



                 WS-RP: Get/Set/Query Properties                                                    SB
                                                                           query               SB
 Client        WS-Notif: Subscribe / Notify                                               SB

                                                                            Inspect-                     RDF
                  WS-RL: Destroy , SetTerminationTime        Semantic       props . . .
                                                              Binding
              WS-RL ++: archive

          Query w/o Inference, UpdateContent



          Query( over unified view)                                          query
                                                          Metadata Query
Ex1. Deploy Semantic Services &
                           Operation Provider
• The Semantic Services suite:
  – The SB Factory Service,
    • creating contextualized RDF graphs (i.e. Semantic
      Bindings)
  – The SB Service,
    • WS-Resource representatives of Semantic Bindings
  – The Metadata Query Service,
    • Global view over multiple Semantic Bindings


   exercise-install/SemanticBindingService/src/
Ex1. Deploy Semantic Services &
                           Operation Provider
• Semantics Operation Provider, a proxy to the
  Semantic Binding Service. Could be augmented with
  any WSRF service and make it semantically aware.
    exercise-install/SemanticsOperationProvider/src/


• Sticky Note, a WSRF service that allows creating
  and maintaining resources called sticky notes.
    exercise-install/stickynote/src/
Hands-on Exercises




Student Notes, Chapters 1 and 2
Ex1 Review

   • This is the setup obtained after setting
     up all the components in this exercise
                                                Client
WSRF Ops. & Reosurce
                                          create
    Specific Ops                                   EPR

                                                                 End Point
                                                                References

                                                         EPR
         Resources
                                          key
                                       key                     WSRF Operation
        Resource                 RP key ...
                                      RP                         Providers
        Properties          RP     RP     ...
                       RP    RP     ...

       Resource Home        StickyNoteService

                                                     GT4 Java WS Core
Ex1 Base Sticky Note Capabilities
1. Run container.
2. Create a Sticky Note
    $GLOBUS_LOCATION/bin/create-note –s http://local....

•   Write a message to a Sticky Note
    $GLOBUS_LOCATION/bin/write-note –e note-123.epr
       HelloWorld

•   Read the message of a Sticky Note
    $GLOBUS_LOCATION/bin/show-note –e note-123.epr

•   Destroy a Sticky Note
    $GLOBUS_LOCATION/bin/wsrf-destroy –e note123.epr
    Repeat show-note after this step….
Ex1 Review

 • This is the setup obtained after completing
   this exercise

                                   Newly deployed
                                 Semantics operation
                    Client            provider
                                                             Newly deployed
                                                                services


                                EPR
                     key
                  key
          RP   key ...
                 RP
     RP        RP         ...
RP        RP        ...
                                      SemanticBinding
      StickyNoteService                FactoryService     SemanticBindingService   MetadataQueryService

                                                 GT4 Java WS Core
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
     • 1. Setup the Globus Container and Sticky Note Service
     • 2. Deploy Semantic Services and Operation Providers
     • 3. Attach Semantic Bindings to a Sticky Note
     • 4. Query Semantic Bindings of a Sticky Note
     • 5. Make Inferences on the Semantic Bindings of a Sticky
       Note
     • 6. Query over a Set of Semantic Bindings (advanced)
     • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Ex3. Attach Semantic Bindings to a
                                                        rdf:type
                          event1
                                        Sticky Note
                                           event



                                 event2                                       local_event
• RDF is the W3C recommended standard for        rdf:type


  metadata representation.
  “Oscar Corcho  13/07/2008                                        Personal_event
   is organizing                            rdf:type
• RDF is also the base representation for more
   an event in..
                             event5
  expressive SW languages.
       ….. ”                                           rdf:type             rdf:type


• Semantic Bindings could represent metadata
                  involves                                      13/07/2008
                                       event3
  in RDF format in addition to other formats. event4
                            involves

                                                      16/07/2008
• In this exercise we will add RDF based involves
                                     involves
  descriptions to the content of StickyNotes.
      MalcolmAtkinson                                              OscarCorcho
                                    CarlosBuil
      rdf:type

                                             rdf:type              rdf:type

    professor
                                          researcher                           lecturer
Ex3. System Operation


                Clien
                  t

                                 describe-note

Create-note
                                                 createSemantic
                                                 Binding             write


                                         EPR                                                   EPR
                    key
                 key                                    create
           RP key ...
                RP                                                           key
      RP        RP         ...
 RP        RP        ...
                                                 SemanticBinding
       StickyNoteService                          FactoryService      SemanticBindingService         MetadataQueryService

                                                             GT4 Java WS Core
Ex3. Adding a new operation
           • This was the setup after completing
             exercise 2


                 Client



Create-note




                                 EPR
                    key
                 key
           RP key ...
                RP
      RP        RP         ...
 RP        RP        ...
                                       SemanticBinding
       StickyNoteService                FactoryService     SemanticBindingService   MetadataQueryService

                                                  GT4 Java WS Core
Ex3. Adding a new operation
           • Add writeSemanticBinding operation to the
             Sticky Note service. (WSDL file)
             – Input: Semantic Binding content as RDF

                     Client



Create-note




                                 EPR
                    key
                 key
           RP key ...
                RP
      RP        RP         ...
 RP        RP        ...
                                       SemanticBinding
       StickyNoteService                FactoryService     SemanticBindingService   MetadataQueryService

                                                  GT4 Java WS Core
Ex3. Adding a new operation
           • Provide implementation for the new
             operation via the Semantics Operation
             Provider. (wsdd file)

                 Clien
                   t


Create-note




                                 EPR
                    key
                 key
           RP key ...
                RP
      RP        RP         ...
 RP        RP        ...
                                       SemanticBinding
       StickyNoteService                FactoryService     SemanticBindingService   MetadataQueryService

                                                  GT4 Java WS Core
Ex3. Adding a new operation
           • Add JNDI configuration parameters to
             StickyNote to specify location of
             Semantic Services. (jndi xml file,
                      caution to port numbers!!)
                 Client



Create-note




                                           EPR
                    key
                 key
           RP key ...
                RP
      RP        RP         ...
 RP        RP        ...
                                                 SemanticBinding
       StickyNoteService                          FactoryService     SemanticBindingService   MetadataQueryService

                                                            GT4 Java WS Core
                                 Jndi-config
Ex3. Client for Attaching an SB     rdf:type
                                                                   event1                                              event
           • Extend the client to invoke the newly
             added operation. (DescribeNote source
                            event2             local_event
                                                                                              rdf:type
                      code and post-deploy file)
                                                      13/07/2008                                                Personal_event
                                                                                        rdf:type

                 Clien
                                                                      event5                                               rdf:type
                   t                                                                               rdf:type

                                      describe-note
                                                       involves                                               13/07/2008
create-note
                                                                                   event3                                       event4
                                                                     involves

                                                                                                   16/07/2008
                                             EPR
                    key                                                          involves                            involves
                 key
           RP key ...
                RP
      RP        RP         ...   MalcolmAtkinson                                                         OscarCorcho
 RP        RP        ...                                              CarlosBuil
              rdf:type                                SemanticBinding
       StickyNoteService                               FactoryService           SemanticBindingService        MetadataQueryService
                                                                                 rdf:type            rdf:type

                           professor                               GT4 Java WS Core
                               Jndi-config
                                                                          researcher                                lecturer
Hands-on Exercises



Student Notes, Chapter 3
Ex3 Review
          • This is the setup obtained after completing this exercise
                – Now we have a SB resource that contains
                   • The RDF content machine processable
                     representation of the note content
                   • The SB resource is contextualized with a pointer
           Client
                     to the Sticky Note it describes (in its resource
                     properties )


                                EPR                                                 EPR
                   key
                key                          create
          RP key ...
               RP                                                 key
     RP        RP         ...
RP        RP        ...
                                      SemanticBinding
      StickyNoteService                FactoryService      SemanticBindingService         MetadataQueryService

                                                  GT4 Java WS Core
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
     • 1. Setup the Globus Container and Sticky Note Service
     • 2. Deploy Semantic Services and Operation Providers
     • 3. Attach Semantic Bindings to a Sticky Note
     • 4. Query Semantic Bindings of a Sticky Note
     • 5. Make Inferences on the Semantic Bindings of a Sticky
       Note
     • 6. Query over a Set of Semantic Bindings (advanced)
     • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Ex4. Query SBs of a Sticky Note

• RDF Metadata can be queried through a
  variety of languages.
  – Sparql, Serql, RDQL, RQL...
  – Languages allow desired graph patterns
    to be expressed.
  – Execution results are variable bindings for
    nodes in the specified pattern
• In this exercise we’ll do querying of RDF
  based metadata
Ex4. Querying a Semantic Binding
                          Query 1:     SELECT N

          • Create a Sticky Note and attach a Semantic
                                       FROM {N} rdf:type {sti:Event}
                                       USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#>

            Binding to it
            Query 2: SELECT N
                     FROM {N} rdf:type {sti:Event}; sti:involves {sti:OscarCorcho}
          • Query USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> Note
                      the Semantic Binding of the Sticky
            using the query-note operation rdf:type {sti:Professor}
            Query 3: SELECT N
                     FROM {N} rdf:type {sti:Event}; sti:involves {M}
           Clien                       USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#>
             t
                                query-note

                                 SeRQL


                                                            miniQuery
                    ...
                                             EPR                                                 EPR
                   key
                key
          RP key ...
               RP                                                              key
     RP        RP         ...
RP        RP        ...
                                                   SemanticBinding
      StickyNoteService                             FactoryService      SemanticBindingService         MetadataQueryService

                                                              GT4 Java WS Core
Ex4. Query SBs of a Sticky Note

• In this exercise we will add a
  querySemanticBinding operation to the
  Sticky Note Service (wsdl file)
  – Input: SeRQL query to be executed over the
    Semantic Binding attached to a Sticky note.
  – Output: an XML-formatted resultset
• We will extend the client to invoke the
  newly added operation. (QueryNote source
 code and post-deploy file)
Hands-on Exercises



Student Notes, Chapter 4
Ex4 Review
    • We executed queries over SBS
    • As is querying
 Query #1                      RDF content
            rdf:type
       ?               event



                                   ?

• Relationships between
                                             ?
  terms missing
• Represent our model of                          ?           ?
  the world in a simple
  ontology
• Exploit relations
  during querying
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
     • 1. Setup the Globus Container and Sticky Note Service
     • 2. Deploy Semantic Services and Operation Providers
     • 3. Attach Semantic Bindings to a Sticky Note
     • 4. Query Semantic Bindings of a Sticky Note
     • 5. Make Inferences on the Semantic Bindings of a
       Sticky Note
     • 6. Query over a Set of Semantic Bindings (advanced)
     • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Ex5. Query SBs with Inferences
                   thing

• RDF Schema is a simple ontology
                      subClassOf

                           event
  language.                          subClassOf
                                 Personal_event
• RDFS could be used to develop models
                                     subClassOf
                                   local_event
  of different application domains. Model:
                                    subClassOf
                       subClassOf                 educational_event
  – Terms (i.e. Vocabulary to be used in an RDF
    description).                         involves
                          person
  – Relationships between subClassOf
                              terms.
                                                      researcher
• In this exercise we’ll do queries by also
                                    subClassOf
                                    professor
  exploiting the information captured in an
                                    subClassOf

  ontology                           lecturer
Ex5. Query SBs with Inferences

• In this exercise:
   – Setup a second Globus Container
      • With a WS-DAIOnt ontology service
      • Containing an RDFS ontology
Ex5. Query SBs with Inferences
• We will add a querySemanticBindingInference
  operation to the Sticky Note Service (wsdl file)
   – Inputs:
       • SeRQL query to be executed over the Semantic
         Binding attached to a Sticky note.
       • The RDFS based knowledge model to be taken into
         acount during querying
   – Output:
       • an XML-formatted resultset of variable bindings
• We will extend the client to invoke the newly added
  operation. (QueryNoteInference source code
  and post-deploy file)
Ex5. Querying SBs with inferences
                                                      RDF Semantics says:
   • Create a Sticky Note and attach a Semantic
                                      (http://www.w3.org/TR/rdf-mt/)
      Query 1: SELECT N
     Binding FROMit{N} rdf:type {sti:Event}
                to
                               USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#>
                                                                 event
   • Query the Semantic Binding of the Sticky Note using
       Query 2: SELECT N
                                                             subClassOf
                FROM {N} rdf:type {sti:Event}; sti:involves {sti:OscarCorcho}
                                                                        Personal_event
     the query-note-inference operation
                USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#>
                                                                                 subClassOf
               • Query 3: SELECT N rdf:type {sti:Event}; sti:involves {M} rdf:typelocal_event
                  Contacts WS-DAIONT to obtain the RDFS ontology




                                                                                                                              GT4 Java WS Core
                          FROM {N}
             {sti:Professor}




                                                                                                                  WS-DAIONT
        Clien            USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#>
                   query-note-inference
           t                                                          RDFS
                                                                                                       rdf:type
                       SeRQL                                                     Obtain ontology
                                                                           rdf:type
                                RDFS                                                               event2
                                                miniInferenceQuery
           ...                                                       ...
                                 EPR                                                       EPR
                 key
              key
       RP  key ...
             RP                                                       key
   RP    RP     ...
RP    RP    ...
                                       SemanticBinding
     StickyNoteService                  FactoryService        SemanticBindingService                 MetadataQueryService

                                                  GT4 Java WS Core
Hands-on Exercises




Student Notes, Chapter 5
Ex5 Review
• We executed queries over the Semantic
  Binding attached to a Sticky Note via
  the StickyNote.

• The query execution took into account
  not only the asserted but also the
  inferred statements.

• So far, we’ve interrogated one single
  sticky note
• How about queries across the semantic
  bindings of several sticky notes?
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
     • 1. Setup the Globus Container and Sticky Note Service
     • 2. Deploy Semantic Services and Operation Providers
     • 3. Attach Semantic Bindings to a Sticky Note
     • 4. Query Semantic Bindings of a Sticky Note
     • 5. Make Inferences on the Semantic Bindings of a Sticky
       Note
     • 6. Query over a Set of Semantic Bindings (advanced)
     • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Ex6. Query over a Set of SBs

• In this exercise we will use the query
  operation available in the metadata service
   – Input: a SeRQL query to be executed over a
     the set of Semantic Bindings.
   – Output: an XML-formatted resultset of
     variable bindings

• Extend the client to invoke the query
  operation of the Metadata Service.
  (QueryAllNotes source code and post-
  deploy file)
Ex6. Query over a Set of SBs

      • Create a Sticky{N} rdf:type {sti:Event} metadata to it.
           Query 1: SELECT Note and attach
                      FROM
                             N


      • Create a second Sticky Note and attach metadata to it.
                      USING NAMESPACE
           sti=<http://www.ontogrid.net/StickyNote#>

      • Call .the query the operation of the Metadata Service to
               . . .

        search . over all created semantic bindings.
             . . .


               Clien
                 t                                            query
                            describe-note                        SeRQL

Create-note
                                            createSemantic
                                            Binding             write


                                    EPR                                                   EPR
                      key                                                      key
                   key                             create
            RP  key ...
                  RP                                                     key
      RP      RP     ...
 RP        RP    ...
                                            SemanticBinding
       StickyNoteService                     FactoryService      SemanticBindingService         MetadataQueryService

                                                        GT4 Java WS Core
Hands-on Exercises




Student Notes, Chapter 6
Ex6 Review

• We executed queries over a set of SBs
  attached to a set of Sticky Notes
• We used the Metada Service to perform
  this operation
  – Provides a global view of RDF content of
    all SB WS-Resources hosted by an SB
    service
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
     • 1. Setup the Globus Container and Sticky Note Service
     • 2. Deploy Semantic Services and Operation Providers
     • 3. Attach Semantic Bindings to a Sticky Note
     • 4. Query Semantic Bindings of a Sticky Note
     • 5. Make Inferences on the Semantic Bindings of a Sticky
       Note
     • 6. Query over a Set of Semantic Bindings (advanced)
     • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Ex7. Use a Remote SB Service

•   In this exercise we will repeat the previous exercise using a common
    Semantic Binding Factory Service, Semantic Binding Service and
    Metadata Query Service

•   Every student will create its own sticky notes and will attach Semantic
    Bindings to them
     – The content of the Semantic Bindings will be different types of events
        where a student specifies that he/she wants to meet other students
        on a specific date.
     – Every student can be identified by the following URI:
          http://www.ontogrid.net/StickyNote#NameSurname
     – Make queries to see whom you have to meet in the following days,
        and which types of events you have to attend to

•   How do we do it?
     – Change the configuration settings at the JNDI configuration
       parameters to specify where the Semantic Services are available
        • <<URLs of the Semantic Services>>
Ex7. Use a Remote SB Service
                                         EPR
                            key
                         key        ....
                 RP   key ...
                        RP
            RP    RP        ...     ....
       RP    RP       ...         eu.ist..
                 StickyNoteService

             GT4 Java WS Core
Student 1
                                                                                                                     EPR
                                                                                                                                     ..............
                                                                                            ..............
                                                                                            ..............
                                                                                                               key                   ..............
                                                                                                                                ..............
                                                                                                                                    ................
                                                                                                                                ..............




                            ...
                                                                                       ..............
                                                                                           ................
                                                                                       ..............
                                                                                            ..............
                                                                                                              key                    ..............
                                                                                                                               ................
                                                                                                                                     ..............
                                                                                                                                ..............
                                                                                      ................
                                                                                            ..............                      ..............
                                                                                       ..............
                                                                                       ..............




                                                 SemanticBindingFactoryService    SemanticBindingService                   MetadataQueryService

                                                                                 GT4 Java WS Core
                                                                                                                                                       Server
                                         EPR
                            key
                         key        ....
              RP      key ...
                        RP
            RP RP           ...     ....
       RP    RP       ...         eu.ist..
                 StickyNoteService

             GT4 Java WS Core
Student N
Hands-on Exercises




Student Notes, Chapter 7
Roadmap
• Objectives
• Structure and materials
• Hands-on: Build a Semantically-Aware Grid Service
   – Exercises
      • 1. Setup the Globus Container and Sticky Note Service
      • 2. Deploy Semantic Services and Operation Providers
      • 3. Attach Semantic Bindings to a Sticky Note
      • 4. Query Semantic Bindings of a Sticky Note
      • 5. Make Inferences on the Semantic Bindings of a Sticky
        Note
      • 6. Query over a Set of Semantic Bindings (advanced)
      • 7. Use a Remote Semantic Binding Service (advanced)
   – Summary
• Conclusions
Summary
• Storing and querying Semantic Bindings
   – SBs are first class citizens
   – SBs can be managed as any other Grid resource.
• Minimally-intrusive extension mechanisms for
  augmenting existing service with metadata
  capabilities
   – Metadata Operation Provider.

• Knowledge Models and inference rules allow for
  inferring new information
   – If RDFS model is not used for querying, then the
     results are the same as what it could be obtained
     using a traditional database.
Further Reading
• Semantic-OGSA
   – An overview of S-OGSA: a Reference Semantic Grid
     Architecture. Oscar Corcho et. al. Journal of Web Semantics
     4(2):102-115. June 2006
• WS-DAIOnt-RDF(S)
   – Accessing RDF(S) data resources in service-based Grid
     infrastructures. Miguel Esteban Gutiérrez, Isao Kojima, Said
     Mirza Pahlevi, Óscar Corcho, Asunción Gómez-Pérez.
     Concurrency and Computation: Practice and Experience
     21(8): 1029-1051 (2009)

• Websites
    http://www.semanticgrid.org/
    http://www.ontogrid.eu/
Credits
•   The SG tutorial is based on the BAS GT4 Sticky Note Tutorial,
    developed by Rachana Ananthakrishnan, Charles Bacon,
    Lisa Childers, Ben Clifford, Jarek Gawor and Joe Insley
    (Globus Alliance)

•   The tutorial was created by Pinar Alper

•   We also thank people who tested the SG tutorial and helped
    improve it a lot.
         – Ted Wen
         – Borja Sotomayor
         – Paolo Missier
         – Rafael González-Cabero
         – Miguel Esteban Gutiérrez
         – David Buján Carballal
         – Cristina Vicente Torres
         – Carlos Buil Aranda

•   Work funded by the EC, OntoGrid and RSSGRID projects

Session 49 - Semantic metadata management practical

  • 1.
    Semantic Sticky Note: RDFMetadata Access and Querying Using GT4 Java WS Session 49. July 15th, 2009 Oscar Corcho, Carlos Buil (Universidad Politécnica de Madrid) Work distributed under the license Creative Commons Attribution-Noncommercial-Share Alike 3.0
  • 2.
    Tutorial Roadmap • Objectives •Hands-on: Build a Semantically-Aware Grid Service – Structure and materials – Exercises • 1. Setup the Globus Container • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 3.
    Metadata about StickyNotes General descriptions about events
  • 4.
    Context & Technologies Enabling Ontology Inference technologies RDFS 2 Query/Retrieve Semantic Metadata Bindings Of all Resources Service RDF 1.1 Forward request via Operation Provider Properties Resource Service Lifetime “Oscar Corcho 1 Metadata Semantics is organizing Create/Query Semantic an event in .. Seeking Bindings of this Resource Client ….. ” Others… Minimally-intrusive GT4 WSRF Sticky augmentation Note resources to be described and shared
  • 5.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 6.
    Structure • Each chapterincludes: – A discussion of the concepts – A discussion of implementation details – Hands-on exercises – A summary
  • 7.
    Tutorial Material • Ina browser window, please go to & bookmark: – http://www.dia.fi.upm.es/~ocorcho/ISSGC2009/Semant icGridPractical/ • We will be connecting to – ssh issgc-client-01.polytech.unice.fr
  • 8.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 9.
    Ex1. Deploy theGlobus Container • In this exercise, – we will download: • The Globus Container • The source code for the Semantic Grid tutorial – Includes Basic Sticky Note source – ... and we will setup (set environment and run): • The Globus Container • The Semantic Binding Service Suite • An operation provider for sticky notes • The StickyNote Service
  • 10.
    Ex1. Deploy SemanticServices & Operation Provider Into the Globus Container we will deploy Semantic Binding Service Suite create WS-Addressing: epr SB Factory create WS-RP: Get/Set/Query Properties SB query SB Client WS-Notif: Subscribe / Notify SB Inspect- RDF WS-RL: Destroy , SetTerminationTime Semantic props . . . Binding WS-RL ++: archive Query w/o Inference, UpdateContent Query( over unified view) query Metadata Query
  • 11.
    Ex1. Deploy SemanticServices & Operation Provider • The Semantic Services suite: – The SB Factory Service, • creating contextualized RDF graphs (i.e. Semantic Bindings) – The SB Service, • WS-Resource representatives of Semantic Bindings – The Metadata Query Service, • Global view over multiple Semantic Bindings exercise-install/SemanticBindingService/src/
  • 12.
    Ex1. Deploy SemanticServices & Operation Provider • Semantics Operation Provider, a proxy to the Semantic Binding Service. Could be augmented with any WSRF service and make it semantically aware. exercise-install/SemanticsOperationProvider/src/ • Sticky Note, a WSRF service that allows creating and maintaining resources called sticky notes. exercise-install/stickynote/src/
  • 13.
  • 14.
    Ex1 Review • This is the setup obtained after setting up all the components in this exercise Client WSRF Ops. & Reosurce create Specific Ops EPR End Point References EPR Resources key key WSRF Operation Resource RP key ... RP Providers Properties RP RP ... RP RP ... Resource Home StickyNoteService GT4 Java WS Core
  • 15.
    Ex1 Base StickyNote Capabilities 1. Run container. 2. Create a Sticky Note $GLOBUS_LOCATION/bin/create-note –s http://local.... • Write a message to a Sticky Note $GLOBUS_LOCATION/bin/write-note –e note-123.epr HelloWorld • Read the message of a Sticky Note $GLOBUS_LOCATION/bin/show-note –e note-123.epr • Destroy a Sticky Note $GLOBUS_LOCATION/bin/wsrf-destroy –e note123.epr Repeat show-note after this step….
  • 16.
    Ex1 Review •This is the setup obtained after completing this exercise Newly deployed Semantics operation Client provider Newly deployed services EPR key key RP key ... RP RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 17.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 18.
    Ex3. Attach SemanticBindings to a rdf:type event1 Sticky Note event event2 local_event • RDF is the W3C recommended standard for rdf:type metadata representation. “Oscar Corcho 13/07/2008 Personal_event is organizing rdf:type • RDF is also the base representation for more an event in.. event5 expressive SW languages. ….. ” rdf:type rdf:type • Semantic Bindings could represent metadata involves 13/07/2008 event3 in RDF format in addition to other formats. event4 involves 16/07/2008 • In this exercise we will add RDF based involves involves descriptions to the content of StickyNotes. MalcolmAtkinson OscarCorcho CarlosBuil rdf:type rdf:type rdf:type professor researcher lecturer
  • 19.
    Ex3. System Operation Clien t describe-note Create-note createSemantic Binding write EPR EPR key key create RP key ... RP key RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 20.
    Ex3. Adding anew operation • This was the setup after completing exercise 2 Client Create-note EPR key key RP key ... RP RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 21.
    Ex3. Adding anew operation • Add writeSemanticBinding operation to the Sticky Note service. (WSDL file) – Input: Semantic Binding content as RDF Client Create-note EPR key key RP key ... RP RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 22.
    Ex3. Adding anew operation • Provide implementation for the new operation via the Semantics Operation Provider. (wsdd file) Clien t Create-note EPR key key RP key ... RP RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 23.
    Ex3. Adding anew operation • Add JNDI configuration parameters to StickyNote to specify location of Semantic Services. (jndi xml file, caution to port numbers!!) Client Create-note EPR key key RP key ... RP RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core Jndi-config
  • 24.
    Ex3. Client forAttaching an SB rdf:type event1 event • Extend the client to invoke the newly added operation. (DescribeNote source event2 local_event rdf:type code and post-deploy file) 13/07/2008 Personal_event rdf:type Clien event5 rdf:type t rdf:type describe-note involves 13/07/2008 create-note event3 event4 involves 16/07/2008 EPR key involves involves key RP key ... RP RP RP ... MalcolmAtkinson OscarCorcho RP RP ... CarlosBuil rdf:type SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService rdf:type rdf:type professor GT4 Java WS Core Jndi-config researcher lecturer
  • 25.
  • 26.
    Ex3 Review • This is the setup obtained after completing this exercise – Now we have a SB resource that contains • The RDF content machine processable representation of the note content • The SB resource is contextualized with a pointer Client to the Sticky Note it describes (in its resource properties ) EPR EPR key key create RP key ... RP key RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 27.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 28.
    Ex4. Query SBsof a Sticky Note • RDF Metadata can be queried through a variety of languages. – Sparql, Serql, RDQL, RQL... – Languages allow desired graph patterns to be expressed. – Execution results are variable bindings for nodes in the specified pattern • In this exercise we’ll do querying of RDF based metadata
  • 29.
    Ex4. Querying aSemantic Binding Query 1: SELECT N • Create a Sticky Note and attach a Semantic FROM {N} rdf:type {sti:Event} USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> Binding to it Query 2: SELECT N FROM {N} rdf:type {sti:Event}; sti:involves {sti:OscarCorcho} • Query USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> Note the Semantic Binding of the Sticky using the query-note operation rdf:type {sti:Professor} Query 3: SELECT N FROM {N} rdf:type {sti:Event}; sti:involves {M} Clien USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> t query-note SeRQL miniQuery ... EPR EPR key key RP key ... RP key RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 30.
    Ex4. Query SBsof a Sticky Note • In this exercise we will add a querySemanticBinding operation to the Sticky Note Service (wsdl file) – Input: SeRQL query to be executed over the Semantic Binding attached to a Sticky note. – Output: an XML-formatted resultset • We will extend the client to invoke the newly added operation. (QueryNote source code and post-deploy file)
  • 31.
  • 32.
    Ex4 Review • We executed queries over SBS • As is querying Query #1 RDF content rdf:type ? event ? • Relationships between ? terms missing • Represent our model of ? ? the world in a simple ontology • Exploit relations during querying
  • 33.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 34.
    Ex5. Query SBswith Inferences thing • RDF Schema is a simple ontology subClassOf event language. subClassOf Personal_event • RDFS could be used to develop models subClassOf local_event of different application domains. Model: subClassOf subClassOf educational_event – Terms (i.e. Vocabulary to be used in an RDF description). involves person – Relationships between subClassOf terms. researcher • In this exercise we’ll do queries by also subClassOf professor exploiting the information captured in an subClassOf ontology lecturer
  • 35.
    Ex5. Query SBswith Inferences • In this exercise: – Setup a second Globus Container • With a WS-DAIOnt ontology service • Containing an RDFS ontology
  • 36.
    Ex5. Query SBswith Inferences • We will add a querySemanticBindingInference operation to the Sticky Note Service (wsdl file) – Inputs: • SeRQL query to be executed over the Semantic Binding attached to a Sticky note. • The RDFS based knowledge model to be taken into acount during querying – Output: • an XML-formatted resultset of variable bindings • We will extend the client to invoke the newly added operation. (QueryNoteInference source code and post-deploy file)
  • 37.
    Ex5. Querying SBswith inferences RDF Semantics says: • Create a Sticky Note and attach a Semantic (http://www.w3.org/TR/rdf-mt/) Query 1: SELECT N Binding FROMit{N} rdf:type {sti:Event} to USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> event • Query the Semantic Binding of the Sticky Note using Query 2: SELECT N subClassOf FROM {N} rdf:type {sti:Event}; sti:involves {sti:OscarCorcho} Personal_event the query-note-inference operation USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> subClassOf • Query 3: SELECT N rdf:type {sti:Event}; sti:involves {M} rdf:typelocal_event Contacts WS-DAIONT to obtain the RDFS ontology GT4 Java WS Core FROM {N} {sti:Professor} WS-DAIONT Clien USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> query-note-inference t RDFS rdf:type SeRQL Obtain ontology rdf:type RDFS event2 miniInferenceQuery ... ... EPR EPR key key RP key ... RP key RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 38.
  • 39.
    Ex5 Review • Weexecuted queries over the Semantic Binding attached to a Sticky Note via the StickyNote. • The query execution took into account not only the asserted but also the inferred statements. • So far, we’ve interrogated one single sticky note • How about queries across the semantic bindings of several sticky notes?
  • 40.
    • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 41.
    Ex6. Query overa Set of SBs • In this exercise we will use the query operation available in the metadata service – Input: a SeRQL query to be executed over a the set of Semantic Bindings. – Output: an XML-formatted resultset of variable bindings • Extend the client to invoke the query operation of the Metadata Service. (QueryAllNotes source code and post- deploy file)
  • 42.
    Ex6. Query overa Set of SBs • Create a Sticky{N} rdf:type {sti:Event} metadata to it. Query 1: SELECT Note and attach FROM N • Create a second Sticky Note and attach metadata to it. USING NAMESPACE sti=<http://www.ontogrid.net/StickyNote#> • Call .the query the operation of the Metadata Service to . . . search . over all created semantic bindings. . . . Clien t query describe-note SeRQL Create-note createSemantic Binding write EPR EPR key key key create RP key ... RP key RP RP ... RP RP ... SemanticBinding StickyNoteService FactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core
  • 43.
  • 44.
    Ex6 Review • Weexecuted queries over a set of SBs attached to a set of Sticky Notes • We used the Metada Service to perform this operation – Provides a global view of RDF content of all SB WS-Resources hosted by an SB service
  • 45.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 46.
    Ex7. Use aRemote SB Service • In this exercise we will repeat the previous exercise using a common Semantic Binding Factory Service, Semantic Binding Service and Metadata Query Service • Every student will create its own sticky notes and will attach Semantic Bindings to them – The content of the Semantic Bindings will be different types of events where a student specifies that he/she wants to meet other students on a specific date. – Every student can be identified by the following URI: http://www.ontogrid.net/StickyNote#NameSurname – Make queries to see whom you have to meet in the following days, and which types of events you have to attend to • How do we do it? – Change the configuration settings at the JNDI configuration parameters to specify where the Semantic Services are available • <<URLs of the Semantic Services>>
  • 47.
    Ex7. Use aRemote SB Service EPR key key .... RP key ... RP RP RP ... .... RP RP ... eu.ist.. StickyNoteService GT4 Java WS Core Student 1 EPR .............. .............. .............. key .............. .............. ................ .............. ... .............. ................ .............. .............. key .............. ................ .............. .............. ................ .............. .............. .............. .............. SemanticBindingFactoryService SemanticBindingService MetadataQueryService GT4 Java WS Core Server EPR key key .... RP key ... RP RP RP ... .... RP RP ... eu.ist.. StickyNoteService GT4 Java WS Core Student N
  • 48.
  • 49.
    Roadmap • Objectives • Structureand materials • Hands-on: Build a Semantically-Aware Grid Service – Exercises • 1. Setup the Globus Container and Sticky Note Service • 2. Deploy Semantic Services and Operation Providers • 3. Attach Semantic Bindings to a Sticky Note • 4. Query Semantic Bindings of a Sticky Note • 5. Make Inferences on the Semantic Bindings of a Sticky Note • 6. Query over a Set of Semantic Bindings (advanced) • 7. Use a Remote Semantic Binding Service (advanced) – Summary • Conclusions
  • 50.
    Summary • Storing andquerying Semantic Bindings – SBs are first class citizens – SBs can be managed as any other Grid resource. • Minimally-intrusive extension mechanisms for augmenting existing service with metadata capabilities – Metadata Operation Provider. • Knowledge Models and inference rules allow for inferring new information – If RDFS model is not used for querying, then the results are the same as what it could be obtained using a traditional database.
  • 51.
    Further Reading • Semantic-OGSA – An overview of S-OGSA: a Reference Semantic Grid Architecture. Oscar Corcho et. al. Journal of Web Semantics 4(2):102-115. June 2006 • WS-DAIOnt-RDF(S) – Accessing RDF(S) data resources in service-based Grid infrastructures. Miguel Esteban Gutiérrez, Isao Kojima, Said Mirza Pahlevi, Óscar Corcho, Asunción Gómez-Pérez. Concurrency and Computation: Practice and Experience 21(8): 1029-1051 (2009) • Websites http://www.semanticgrid.org/ http://www.ontogrid.eu/
  • 52.
    Credits • The SG tutorial is based on the BAS GT4 Sticky Note Tutorial, developed by Rachana Ananthakrishnan, Charles Bacon, Lisa Childers, Ben Clifford, Jarek Gawor and Joe Insley (Globus Alliance) • The tutorial was created by Pinar Alper • We also thank people who tested the SG tutorial and helped improve it a lot. – Ted Wen – Borja Sotomayor – Paolo Missier – Rafael González-Cabero – Miguel Esteban Gutiérrez – David Buján Carballal – Cristina Vicente Torres – Carlos Buil Aranda • Work funded by the EC, OntoGrid and RSSGRID projects