SlideShare une entreprise Scribd logo
1  sur  31
Ontology Aware Applications



  Nuno Carvalho    Alberto Sim˜es
                              o   Jos´ Jo˜o Almeida
                                     e a
<smash@cpan.org> <ambs@cpan.org> <jjoao@cpan.org>


                           20th August
                          YAPC::EU 2012




          20th August, 2012 YAPC::EU   Ontology Aware Applications   1
Introduction


    ontologies can he used to store data
         create, query, manipulate, maintain, reason, ...
    build applications using ontologies to store information
    approaches for representing ontologies
    mechanisms to implement common operations
    keep programs efficient language-wise
    want to use all this with our favourite programming language
    to develop applications

Perl × ontology −→ modern rich ontology aware applications




              20th August, 2012 YAPC::EU   Ontology Aware Applications   2
Introduction




Motivations
    ontology use is growing
    solutions based in this technology are growing
         Semantic Web, etc.
    ontologies are a good approach to store knowledge
    ontologies are easy to store, share, maintain, ...
    clear border between data and applications




              20th August, 2012 YAPC::EU   Ontology Aware Applications   3
Introduction: Ontology Definition




Ontology - Definition 1
A sphere of thought or action; field, province, scope of a
department of knowledge, etc.

                                           in Oxford English Dictionary, Second Edition




              20th August, 2012 YAPC::EU      Ontology Aware Applications                 4
Introduction: Ontology Definition




Ontology - Definition 2
A domain ontology is an engineered artifact that informally defines
concepts from a specific domain, representing and organizing them
as conceptualizations which a set of systems working cooperatively
with each other agree to share.

                in Ontological Adaptive Integration Of Reverse Engineering Tools




              20th August, 2012 YAPC::EU   Ontology Aware Applications             5
Introduction: Ontology Definition

Ontology - Definition 3

                           O = (C , H, I , R, P, A)
where:
    C: set of concepts (classes and instances)
    H: set of taxonomic relationships between concepts
    I: set of relationships between classes and its instances
    R: set of other relationships
    P: set of properties of ontology classes
    A: set of axioms

  in A Process for Extracting Non-Taxonomic Relationships of Ontologies from Text




               20th August, 2012 YAPC::EU   Ontology Aware Applications             6
Introduction: Ontology Definition
Ontology
A domain ontology is an engineered artifact that informally defines
concepts from a specific domain, representing and organizing them
as conceptualizations which a set of systems working cooperatively
with each other agree to share.

                                     city
                                                         -7.84 ..
                                                                                          Vila Real
                                                                             DST

                                                              LAT
                                                   ISA                          LNG
                                   ISA                                                           39.63 ..


                                                                                     IN
                                                                    Chaves
                         LAT                Lisbon

                                                                                      Portugal
                   -7.47 ..                  LNG                      IN


                                                                               ISA
                                         41.74 ..                                         country


           terms       relations


                   20th August, 2012 YAPC::EU                   Ontology Aware Applications                 7
Ontology Representation



SKOS
    Simple Knowledge Organization Systems
Topic Maps
    specification for representing the structure of information
    resources
OWL
    Web Ontology Language
    family of languages for publishing and sharing ontologies on
    the World Wide Web




         20th August, 2012 YAPC::EU   Ontology Aware Applications   8
Ontology Representation

ISO 2778
    simple representation
    formalization to represent thesaurus (and more)
    plain text, clean
    Biblio::Thesaurus

Frankfurt
CITY-OF Germany
ISA     city

Lisbon
CITY-OF Portugal
ISA    city


              20th August, 2012 YAPC::EU   Ontology Aware Applications   9
Ontology Manipulation



Domain Specific Language
   describe operations on ontologies
    expressive, powerful, yet simple
    rule based
    produce arbitrary side effects
    OML – Ontology Manipulation Language

Rules
                          pattern => actions.




             20th August, 2012 YAPC::EU   Ontology Aware Applications   10
OML Syntax Overview

OML Program


               program → rule +
                     rule → Pattern => Action .

Pattern
    a pattern of information, terms and relations, that can be
    found once or more than once in the ontology

Action
     manipulate information in the ontology
         add, remove, terms or relations, ...
    produce any arbitrary user defined side effects
         produce graphs, images, HTML pages, update databases, ...


              20th August, 2012 YAPC::EU   Ontology Aware Applications   11
OML Patterns Examples


 #    Pattern
  1   term(Frankfurt)            term Frankfurt exists
  2   rel(ISA)                       relation ISA exists
  3   term($t)                              for all terms
  4   rel($r)                            for all relations
  5   Frankfurt ISA city
  6   $name ISA city
  7   $name ISA $place
  8   Frankfurt $rel $term for all related to Frankfurt
  9   Frankfurt ISA city ∧ Germany ISA country
 10   Frankfurt ISA city ∨ Germany ISA country
 11   Chaves LAT $lat ∧ Chaves LNG $lng




         20th August, 2012 YAPC::EU   Ontology Aware Applications   12
OML Actions Examples



Manipulate Information
    add(Germany ISA country)
   del($place ISA city)

Arbitrary Effect
sub {
  $db->execute(
     ’INSERT INTO cities (name) VALUES ($city)’
  );
}




           20th August, 2012 YAPC::EU   Ontology Aware Applications   13
OML Rules Examples

$city IN Germany ⇒ add($city IN Europe).

$c ISA city ∧ $c IN Germany ⇒ add($c LANG German).

$city ISA city ∧ $city ISA country ⇒
  sub { print ”Warning: review $city ISA relation!” }.
                                                   ;

$name ISA city ∧ $name IN $country ⇒ sub {
$db->execute(
 ’INSERT INTO cities (name,country) VALUES ($name,$country)’
)}.

$a $r $b ∧ $b $r $c ⇒ add($a $r $c).

$a $r $b ∧ $b $r $c ∧ $a $r $c ⇒ rem($a $r $c).
              20th August, 2012 YAPC::EU   Ontology Aware Applications   14
OML Compiler




20th August, 2012 YAPC::EU   Ontology Aware Applications   15
Architecture Overview




                              ontology




     program                 compiler                     result




       20th August, 2012 YAPC::EU   Ontology Aware Applications    16
Compiler Architecture Overview


     program                   parser



                              ontology                      pTree



                             expander


     diTree


                               reactor                      result




        20th August, 2012 YAPC::EU   Ontology Aware Applications     17
Embedded OML




20th August, 2012 YAPC::EU   Ontology Aware Applications   18
Embedded OML


Challenge
     can applications and tools be written only in OML?
         actually yes, but do we want to?
              NO!

Why?
   efficient for ontology processing
   real world applications require more
         HTML operations, databases, ...


    we want the best of both worlds
         OML for ontology aware tasks
         general purpose programming language for everything else



              20th August, 2012 YAPC::EU   Ontology Aware Applications   19
Embed OML in Perl Example


#!/usr/bin/perl

use Biblio::Thesaurus::ModRewrite::Embed;

my $term = $ARGV[0];
my $ontology = thesaurusLoad($ARGV[1]);

OML printTerms(ontology,term)
   term $r $t => sub { print "term $r $t"; }.
   $t $r term => sub { print "$t $r term"; }.
ENDOML

printTerms($ontology, $term);



           20th August, 2012 YAPC::EU   Ontology Aware Applications   20
Embed OML


 Initial
Program




                                                           ne




                                                                                   e
                                                                                ut
                                                         bi




                                                                            ec
                                                       m
            lit




                                                                          ex
                                id




                                                    co
           sp




                      Perl
                     Perl                  Perl
                                          Perl
                    Perl                 Perl
 Perl
  +                                                             Perl                   Result
 OML                  Perl
                     Perl                  Perl
                                          Perl
                    OML                  Perl


                             compile


                                                                                       Final
                                                                                       Result




                  20th August, 2012 YAPC::EU      Ontology Aware Applications                   21
Embedded OML Algorithm


Algorithm 1: Weaver(program,split,compile,combine) : program
Input: program – original program to process
Input: split – function that separates the code parts by language
Input: compile – tranforms OML into Perl
Input: combine – joins parts of code together

parts ← split(program)
forall the (lang , code) ∈ parts do
    if lang is DSL then
         code ← compile(code)
    push(parts2, code)
returncombine(parts2)




              20th August, 2012 YAPC::EU   Ontology Aware Applications   22
Example: OntoMap




20th August, 2012 YAPC::EU   Ontology Aware Applications   23
Example Screenshot




       20th August, 2012 YAPC::EU   Ontology Aware Applications   24
Information in JSON

GET /locations.cgi HTTP/1.1
(...)
Content-Type: application/json; charset=UTF-8

{"markers":[{"name":"Braga","desc":"Braga<hr><b>CITY-OF</b>
Portugal<br><b>IS-A</b> city<br><b>LAT</b> 41.5517605<br><b
>LNG</b> -8.4229034<br>","lat":"41.5517605","lng":"-8.42290
34","is":"city"},{"name":"Castelo de Alva","desc":"Castelo
de Alva<hr><b>IS-A</b> castle<br><b>LAT</b> 41.0913745<br><
b>LNG</b> -6.8078773<br>","lat":"41.0913745","lng":"-6.8078
773","is":"castle"},{"name":"Castelo de Tavira","desc":"Cas
telo de Tavira<hr><b>IS-A</b> castle<br><b>LAT</b> 37.12131
22<br><b>LNG</b> -7.6533538<br>","lat":"37.1213122","lng":"
-7.6533538","is":"castle"},{"name":"Guimaraes","desc":"Guim
araes<hr><b>CITY-OF</b> Portugal<br><b>IS-A</b> city<br><b>
LAT</b> 41.4419546<br><b>LNG</b> -8.2956069<br>","lat":"41.
4419546","lng":"-8.2956069","is":"city"},{"name":"Lagos","d
           20th August, 2012 YAPC::EU   Ontology Aware Applications   25
OML Program: locations.cgi

1    use CGI ;
2    use JSON ;
3    use Biblio : : Thesaurus : : ModRewrite : : Embed ;
4
5    my $onto = thesaurusLoad ( ’ geo . iso ’ ) ;
6    my $filter = param ( ’ FILTER ’ ) or ’ ANY ’ ;
7    print header ,
8            ”{ m a r k e r s : ” ,
9               get points ( $onto , $filter ) ,
10                 ”} ” ;
11
12   OML get points ( ontology , filter )
13     $point LAT $x AND $point LNG $y
14     AND $point ISA filter
15       = sub {
          >
16          print to json ( {name= >$point , lat=>$x , lng=>$y} ) ;
17       }.
18   ENDOML


               20th August, 2012 YAPC::EU   Ontology Aware Applications   26
OML Program: addlocation.cgi

1    use CGI ;
2    use Biblio : : Thesaurus : : ModRewrite : : Embed ;
3
4    my   $name = param ( ’ NAME ’ ) ;
5    my   $isa = param ( ’ ISA ’ ) ;
6    my   $lat = param ( ’ LAT ’ ) ;
7    my   $lng = param ( ’ LNG ’ ) ;
8
9    my $onto = thesaurusLoad ( ’ geo . iso ’ ) ;
10   add location ( $onto , $name , $isa , $lat , $lng ) ;
11   $onto−>save ( ’ geo . iso ’ ) ;
12
13   OML add location ( ontology , name , isa , lat , lng )
14     do =>
15       add ( name ISA isa )
16       add ( name LAT lat )
17       add ( name LNG lng ) .
18   ENDOML


                 20th August, 2012 YAPC::EU   Ontology Aware Applications   27
Related Work




CPAN
   RDF::*
   OWL::*
   .. and much more
Zhi#
   integrates the Web Ontology Language (OWL) and XML
   Schema Definition (XSD) data types with C#




       20th August, 2012 YAPC::EU   Ontology Aware Applications   28
Conclusion




increase language efficiency throughout the code
elegant and simple approach to build ontology-aware
applications
modular, build complex applications using small blocks
embedded mechanism is a clear advantage
under research work, not finished! – many things will change




         20th August, 2012 YAPC::EU   Ontology Aware Applications   29
Conclusion


  weaving mechanism can be language-agnostic
  split many languages
  having compilers for each language




                                                       ne




                                                                               e
                                                                            ut
                                                     bi




                                                                        ec
                                                   m
        lit




                                                                      ex
                            id




                                                co
       sp




                  Perl
                 Perl                  Perl
                                      Perl
                Perl                 Perl
Perl
 +                                                          Perl                   Result
DSL*              Perl
                 Perl                  Perl
                                      Perl
                DSL                  Perl


                         compile*




              20th August, 2012 YAPC::EU      Ontology Aware Applications                   30
Thank You!
           smash@cpan.org




20th August, 2012 YAPC::EU   Ontology Aware Applications   31

Contenu connexe

Similaire à Ontology Aware Applications @ YAPC::EU 2012

Comparing Vocabularies for Representing Geographical Features and Their Geometry
Comparing Vocabularies for Representing Geographical Features and Their GeometryComparing Vocabularies for Representing Geographical Features and Their Geometry
Comparing Vocabularies for Representing Geographical Features and Their GeometryGhislain Atemezing
 
GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003butest
 
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF:  Lifting NLP Extraction Results to the Linked Data CloudNERD meets NIF:  Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data CloudGiuseppe Rizzo
 
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic RepresentationGetty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic RepresentationVladimir Alexiev, PhD, PMP
 
Europeana v2.0 WP 7 & EuropeanaTech
Europeana v2.0 WP 7 & EuropeanaTech Europeana v2.0 WP 7 & EuropeanaTech
Europeana v2.0 WP 7 & EuropeanaTech Max Kaiser
 
2P-Kt: logic programming with objects & functions in Kotlin
2P-Kt: logic programming with objects & functions in Kotlin2P-Kt: logic programming with objects & functions in Kotlin
2P-Kt: logic programming with objects & functions in KotlinGiovanni Ciatto
 
2012 oct 22 shaping access presentation_alt
2012 oct 22  shaping access presentation_alt2012 oct 22  shaping access presentation_alt
2012 oct 22 shaping access presentation_altEuropeana
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingRoberto Casadei
 
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and NotationsMathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and NotationsChristoph Lange
 
PhD defense : Multi-points of view semantic enrichment of folksonomies
PhD defense : Multi-points of view semantic enrichment of folksonomiesPhD defense : Multi-points of view semantic enrichment of folksonomies
PhD defense : Multi-points of view semantic enrichment of folksonomiesFreddy Limpens
 
A Project Based Lab Report On AMUZING JOKE
A Project Based Lab Report On AMUZING JOKEA Project Based Lab Report On AMUZING JOKE
A Project Based Lab Report On AMUZING JOKEDaniel Wachtel
 
Recommendations for the automatic enrichment of digital library content using...
Recommendations for the automatic enrichment of digital library content using...Recommendations for the automatic enrichment of digital library content using...
Recommendations for the automatic enrichment of digital library content using...pathsproject
 
Ontology based semantics and graphical notation as directed graphs
Ontology based semantics and graphical notation as directed graphsOntology based semantics and graphical notation as directed graphs
Ontology based semantics and graphical notation as directed graphsJohann Höchtl
 
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT ecij
 
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT ecij
 
Open Nordic 2008 NTNU
Open Nordic 2008 NTNUOpen Nordic 2008 NTNU
Open Nordic 2008 NTNUØyvind Hauge
 
OpenChain Automation Case Study - September to December 2021
OpenChain Automation Case Study - September to December 2021OpenChain Automation Case Study - September to December 2021
OpenChain Automation Case Study - September to December 2021Shane Coughlan
 

Similaire à Ontology Aware Applications @ YAPC::EU 2012 (20)

DTrace and Drupal
DTrace and DrupalDTrace and Drupal
DTrace and Drupal
 
Comparing Vocabularies for Representing Geographical Features and Their Geometry
Comparing Vocabularies for Representing Geographical Features and Their GeometryComparing Vocabularies for Representing Geographical Features and Their Geometry
Comparing Vocabularies for Representing Geographical Features and Their Geometry
 
GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003
 
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF:  Lifting NLP Extraction Results to the Linked Data CloudNERD meets NIF:  Lifting NLP Extraction Results to the Linked Data Cloud
NERD meets NIF: Lifting NLP Extraction Results to the Linked Data Cloud
 
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic RepresentationGetty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
 
Europeana v2.0 WP 7 & EuropeanaTech
Europeana v2.0 WP 7 & EuropeanaTech Europeana v2.0 WP 7 & EuropeanaTech
Europeana v2.0 WP 7 & EuropeanaTech
 
2P-Kt: logic programming with objects & functions in Kotlin
2P-Kt: logic programming with objects & functions in Kotlin2P-Kt: logic programming with objects & functions in Kotlin
2P-Kt: logic programming with objects & functions in Kotlin
 
Ocd arc energy_20160427
Ocd arc energy_20160427Ocd arc energy_20160427
Ocd arc energy_20160427
 
2012 oct 22 shaping access presentation_alt
2012 oct 22  shaping access presentation_alt2012 oct 22  shaping access presentation_alt
2012 oct 22 shaping access presentation_alt
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
 
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and NotationsMathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
 
PhD defense : Multi-points of view semantic enrichment of folksonomies
PhD defense : Multi-points of view semantic enrichment of folksonomiesPhD defense : Multi-points of view semantic enrichment of folksonomies
PhD defense : Multi-points of view semantic enrichment of folksonomies
 
A Project Based Lab Report On AMUZING JOKE
A Project Based Lab Report On AMUZING JOKEA Project Based Lab Report On AMUZING JOKE
A Project Based Lab Report On AMUZING JOKE
 
Recommendations for the automatic enrichment of digital library content using...
Recommendations for the automatic enrichment of digital library content using...Recommendations for the automatic enrichment of digital library content using...
Recommendations for the automatic enrichment of digital library content using...
 
Ontology based semantics and graphical notation as directed graphs
Ontology based semantics and graphical notation as directed graphsOntology based semantics and graphical notation as directed graphs
Ontology based semantics and graphical notation as directed graphs
 
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
 
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
USING MACHINE LEARNING TO BUILD A SEMI-INTELLIGENT BOT
 
Open Nordic 2008 NTNU
Open Nordic 2008 NTNUOpen Nordic 2008 NTNU
Open Nordic 2008 NTNU
 
OpenChain Automation Case Study - September to December 2021
OpenChain Automation Case Study - September to December 2021OpenChain Automation Case Study - September to December 2021
OpenChain Automation Case Study - September to December 2021
 
Rewire the Net
Rewire the NetRewire the Net
Rewire the Net
 

Dernier

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 

Dernier (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 

Ontology Aware Applications @ YAPC::EU 2012

  • 1. Ontology Aware Applications Nuno Carvalho Alberto Sim˜es o Jos´ Jo˜o Almeida e a <smash@cpan.org> <ambs@cpan.org> <jjoao@cpan.org> 20th August YAPC::EU 2012 20th August, 2012 YAPC::EU Ontology Aware Applications 1
  • 2. Introduction ontologies can he used to store data create, query, manipulate, maintain, reason, ... build applications using ontologies to store information approaches for representing ontologies mechanisms to implement common operations keep programs efficient language-wise want to use all this with our favourite programming language to develop applications Perl × ontology −→ modern rich ontology aware applications 20th August, 2012 YAPC::EU Ontology Aware Applications 2
  • 3. Introduction Motivations ontology use is growing solutions based in this technology are growing Semantic Web, etc. ontologies are a good approach to store knowledge ontologies are easy to store, share, maintain, ... clear border between data and applications 20th August, 2012 YAPC::EU Ontology Aware Applications 3
  • 4. Introduction: Ontology Definition Ontology - Definition 1 A sphere of thought or action; field, province, scope of a department of knowledge, etc. in Oxford English Dictionary, Second Edition 20th August, 2012 YAPC::EU Ontology Aware Applications 4
  • 5. Introduction: Ontology Definition Ontology - Definition 2 A domain ontology is an engineered artifact that informally defines concepts from a specific domain, representing and organizing them as conceptualizations which a set of systems working cooperatively with each other agree to share. in Ontological Adaptive Integration Of Reverse Engineering Tools 20th August, 2012 YAPC::EU Ontology Aware Applications 5
  • 6. Introduction: Ontology Definition Ontology - Definition 3 O = (C , H, I , R, P, A) where: C: set of concepts (classes and instances) H: set of taxonomic relationships between concepts I: set of relationships between classes and its instances R: set of other relationships P: set of properties of ontology classes A: set of axioms in A Process for Extracting Non-Taxonomic Relationships of Ontologies from Text 20th August, 2012 YAPC::EU Ontology Aware Applications 6
  • 7. Introduction: Ontology Definition Ontology A domain ontology is an engineered artifact that informally defines concepts from a specific domain, representing and organizing them as conceptualizations which a set of systems working cooperatively with each other agree to share. city -7.84 .. Vila Real DST LAT ISA LNG ISA 39.63 .. IN Chaves LAT Lisbon Portugal -7.47 .. LNG IN ISA 41.74 .. country terms relations 20th August, 2012 YAPC::EU Ontology Aware Applications 7
  • 8. Ontology Representation SKOS Simple Knowledge Organization Systems Topic Maps specification for representing the structure of information resources OWL Web Ontology Language family of languages for publishing and sharing ontologies on the World Wide Web 20th August, 2012 YAPC::EU Ontology Aware Applications 8
  • 9. Ontology Representation ISO 2778 simple representation formalization to represent thesaurus (and more) plain text, clean Biblio::Thesaurus Frankfurt CITY-OF Germany ISA city Lisbon CITY-OF Portugal ISA city 20th August, 2012 YAPC::EU Ontology Aware Applications 9
  • 10. Ontology Manipulation Domain Specific Language describe operations on ontologies expressive, powerful, yet simple rule based produce arbitrary side effects OML – Ontology Manipulation Language Rules pattern => actions. 20th August, 2012 YAPC::EU Ontology Aware Applications 10
  • 11. OML Syntax Overview OML Program program → rule + rule → Pattern => Action . Pattern a pattern of information, terms and relations, that can be found once or more than once in the ontology Action manipulate information in the ontology add, remove, terms or relations, ... produce any arbitrary user defined side effects produce graphs, images, HTML pages, update databases, ... 20th August, 2012 YAPC::EU Ontology Aware Applications 11
  • 12. OML Patterns Examples # Pattern 1 term(Frankfurt) term Frankfurt exists 2 rel(ISA) relation ISA exists 3 term($t) for all terms 4 rel($r) for all relations 5 Frankfurt ISA city 6 $name ISA city 7 $name ISA $place 8 Frankfurt $rel $term for all related to Frankfurt 9 Frankfurt ISA city ∧ Germany ISA country 10 Frankfurt ISA city ∨ Germany ISA country 11 Chaves LAT $lat ∧ Chaves LNG $lng 20th August, 2012 YAPC::EU Ontology Aware Applications 12
  • 13. OML Actions Examples Manipulate Information add(Germany ISA country) del($place ISA city) Arbitrary Effect sub { $db->execute( ’INSERT INTO cities (name) VALUES ($city)’ ); } 20th August, 2012 YAPC::EU Ontology Aware Applications 13
  • 14. OML Rules Examples $city IN Germany ⇒ add($city IN Europe). $c ISA city ∧ $c IN Germany ⇒ add($c LANG German). $city ISA city ∧ $city ISA country ⇒ sub { print ”Warning: review $city ISA relation!” }. ; $name ISA city ∧ $name IN $country ⇒ sub { $db->execute( ’INSERT INTO cities (name,country) VALUES ($name,$country)’ )}. $a $r $b ∧ $b $r $c ⇒ add($a $r $c). $a $r $b ∧ $b $r $c ∧ $a $r $c ⇒ rem($a $r $c). 20th August, 2012 YAPC::EU Ontology Aware Applications 14
  • 15. OML Compiler 20th August, 2012 YAPC::EU Ontology Aware Applications 15
  • 16. Architecture Overview ontology program compiler result 20th August, 2012 YAPC::EU Ontology Aware Applications 16
  • 17. Compiler Architecture Overview program parser ontology pTree expander diTree reactor result 20th August, 2012 YAPC::EU Ontology Aware Applications 17
  • 18. Embedded OML 20th August, 2012 YAPC::EU Ontology Aware Applications 18
  • 19. Embedded OML Challenge can applications and tools be written only in OML? actually yes, but do we want to? NO! Why? efficient for ontology processing real world applications require more HTML operations, databases, ... we want the best of both worlds OML for ontology aware tasks general purpose programming language for everything else 20th August, 2012 YAPC::EU Ontology Aware Applications 19
  • 20. Embed OML in Perl Example #!/usr/bin/perl use Biblio::Thesaurus::ModRewrite::Embed; my $term = $ARGV[0]; my $ontology = thesaurusLoad($ARGV[1]); OML printTerms(ontology,term) term $r $t => sub { print "term $r $t"; }. $t $r term => sub { print "$t $r term"; }. ENDOML printTerms($ontology, $term); 20th August, 2012 YAPC::EU Ontology Aware Applications 20
  • 21. Embed OML Initial Program ne e ut bi ec m lit ex id co sp Perl Perl Perl Perl Perl Perl Perl + Perl Result OML Perl Perl Perl Perl OML Perl compile Final Result 20th August, 2012 YAPC::EU Ontology Aware Applications 21
  • 22. Embedded OML Algorithm Algorithm 1: Weaver(program,split,compile,combine) : program Input: program – original program to process Input: split – function that separates the code parts by language Input: compile – tranforms OML into Perl Input: combine – joins parts of code together parts ← split(program) forall the (lang , code) ∈ parts do if lang is DSL then code ← compile(code) push(parts2, code) returncombine(parts2) 20th August, 2012 YAPC::EU Ontology Aware Applications 22
  • 23. Example: OntoMap 20th August, 2012 YAPC::EU Ontology Aware Applications 23
  • 24. Example Screenshot 20th August, 2012 YAPC::EU Ontology Aware Applications 24
  • 25. Information in JSON GET /locations.cgi HTTP/1.1 (...) Content-Type: application/json; charset=UTF-8 {"markers":[{"name":"Braga","desc":"Braga<hr><b>CITY-OF</b> Portugal<br><b>IS-A</b> city<br><b>LAT</b> 41.5517605<br><b >LNG</b> -8.4229034<br>","lat":"41.5517605","lng":"-8.42290 34","is":"city"},{"name":"Castelo de Alva","desc":"Castelo de Alva<hr><b>IS-A</b> castle<br><b>LAT</b> 41.0913745<br>< b>LNG</b> -6.8078773<br>","lat":"41.0913745","lng":"-6.8078 773","is":"castle"},{"name":"Castelo de Tavira","desc":"Cas telo de Tavira<hr><b>IS-A</b> castle<br><b>LAT</b> 37.12131 22<br><b>LNG</b> -7.6533538<br>","lat":"37.1213122","lng":" -7.6533538","is":"castle"},{"name":"Guimaraes","desc":"Guim araes<hr><b>CITY-OF</b> Portugal<br><b>IS-A</b> city<br><b> LAT</b> 41.4419546<br><b>LNG</b> -8.2956069<br>","lat":"41. 4419546","lng":"-8.2956069","is":"city"},{"name":"Lagos","d 20th August, 2012 YAPC::EU Ontology Aware Applications 25
  • 26. OML Program: locations.cgi 1 use CGI ; 2 use JSON ; 3 use Biblio : : Thesaurus : : ModRewrite : : Embed ; 4 5 my $onto = thesaurusLoad ( ’ geo . iso ’ ) ; 6 my $filter = param ( ’ FILTER ’ ) or ’ ANY ’ ; 7 print header , 8 ”{ m a r k e r s : ” , 9 get points ( $onto , $filter ) , 10 ”} ” ; 11 12 OML get points ( ontology , filter ) 13 $point LAT $x AND $point LNG $y 14 AND $point ISA filter 15 = sub { > 16 print to json ( {name= >$point , lat=>$x , lng=>$y} ) ; 17 }. 18 ENDOML 20th August, 2012 YAPC::EU Ontology Aware Applications 26
  • 27. OML Program: addlocation.cgi 1 use CGI ; 2 use Biblio : : Thesaurus : : ModRewrite : : Embed ; 3 4 my $name = param ( ’ NAME ’ ) ; 5 my $isa = param ( ’ ISA ’ ) ; 6 my $lat = param ( ’ LAT ’ ) ; 7 my $lng = param ( ’ LNG ’ ) ; 8 9 my $onto = thesaurusLoad ( ’ geo . iso ’ ) ; 10 add location ( $onto , $name , $isa , $lat , $lng ) ; 11 $onto−>save ( ’ geo . iso ’ ) ; 12 13 OML add location ( ontology , name , isa , lat , lng ) 14 do => 15 add ( name ISA isa ) 16 add ( name LAT lat ) 17 add ( name LNG lng ) . 18 ENDOML 20th August, 2012 YAPC::EU Ontology Aware Applications 27
  • 28. Related Work CPAN RDF::* OWL::* .. and much more Zhi# integrates the Web Ontology Language (OWL) and XML Schema Definition (XSD) data types with C# 20th August, 2012 YAPC::EU Ontology Aware Applications 28
  • 29. Conclusion increase language efficiency throughout the code elegant and simple approach to build ontology-aware applications modular, build complex applications using small blocks embedded mechanism is a clear advantage under research work, not finished! – many things will change 20th August, 2012 YAPC::EU Ontology Aware Applications 29
  • 30. Conclusion weaving mechanism can be language-agnostic split many languages having compilers for each language ne e ut bi ec m lit ex id co sp Perl Perl Perl Perl Perl Perl Perl + Perl Result DSL* Perl Perl Perl Perl DSL Perl compile* 20th August, 2012 YAPC::EU Ontology Aware Applications 30
  • 31. Thank You! smash@cpan.org 20th August, 2012 YAPC::EU Ontology Aware Applications 31