SlideShare a Scribd company logo
1 of 2
#!/usr/local/bin/perl
package GetMyBMI; # a SADI Service for BMI Calculation
use strict;
use warnings;
#use base 'SADI::Simple::AsyncService';
use base 'SADI::Simple::SyncService';
my $config = {
ServiceName => 'GetMyBMI', # any name you like
ServiceURI => 'http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl', #URL of this script
Description => 'A BMI calculator',
InputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientData',
OutputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientBMI',
Authority => 'wilkinsonlab.info', # domain of organization providing service
Provider => 'markw@illuminae.com', # contact e-mail address of service provider
};
my $service = GetMyBMI->new(%$config);
$service->handle_cgi_request;
#-----------------------------------------------------------------
# SERVICE IMPLEMENTATION
#-----------------------------------------------------------------
use RDF::Trine::Node::Resource;
use RDF::Trine::Node::Literal;
use RDF::Trine::Statement;
sub process_it {
my ($self, $inputs, $input_model, $output_model) = @_;
# $inputs - ref to an array of RDF::Trine::Node::Resource
# $input_model - an RDF::Trine::Model containing the input RDF data
# $output_model - an RDF::Trine::Model containing the output RDF data
my $heightp = RDF::Trine::Node::Resource->new(
'http://mged.sourceforge.net/ontologies/MGEDOntology.owl#has_height');
my $weightp = RDF::Trine::Node::Resource->new(
'http://linkeddata.systems/ontologies/SADITutorial.owl#has_mass');
my $BMIp = RDF::Trine::Node::Resource->new(
'http://sadiframework.org/examples/bmi.owl#BMI');
foreach my $input (@$inputs) {
# retrieve the height and weight node from each input
my ($height) = $input_model->objects($input, $heightp);
my ($weight) = $input_model->objects($input, $weightp);
$height = $height->value;
$weight = $weight->value;
my $BMI = $weight/($height * $height);
my $BMI_literal = RDF::Trine::Node::Literal->new($BMI);
# The output statement is about the $input as the subject node!!
my $statement = RDF::Trine::Statement->new($input, $BMIp, $BMI_literal);
$output_model->add_statement($statement);
}
}
#!/usr/local/bin/perl
package GetMyBMI;
use strict;
use warnings;
use base 'SADI::Simple::SyncService';
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($WARN);
#Log::Log4perl->easy_init($DEBUG);
my $config = {
ServiceName => 'GetMyBMI', # any name you like
ServiceURI => 'http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl',
Description => 'A BMI calculator',
InputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientData',
OutputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientBMI',
Authority => 'wilkinsonlab.info', # domain of organization providing service
Provider => 'markw@illuminae.com', # contact e-mail address of service provider
NanoPublisher => 1, # I want to be a NanoPublisher
};
my $service = GetMyBMI->new(%$config);
$service->handle_cgi_request;
use RDF::Trine::Node::Resource;
use RDF::Trine::Node::Literal;
use RDF::Trine::Statement;
sub process_it {
my ($self, $inputs, $input_model, $output_model) = @_;
# $inputs - ref to an array of RDF::Trine::Node::Resource
# $input_model - an RDF::Trine::Model containing the input RDF data
# $output_model - an RDF::Trine::Model containing the output RDF data
my $heightp = RDF::Trine::Node::Resource->new(
'http://mged.sourceforge.net/ontologies/MGEDOntology.owl#has_height');
my $weightp = RDF::Trine::Node::Resource->new(
'http://linkeddata.systems/ontologies/SADITutorial.owl#has_mass');
my $BMIp = RDF::Trine::Node::Resource->new(
'http://sadiframework.org/examples/bmi.owl#BMI');
foreach my $input (@$inputs) {
my ($height) = $input_model->objects($input, $heightp);
my ($weight) = $input_model->objects($input, $weightp);
$height = $height->value;
$weight = $weight->value;
my $BMI = $weight/($height * $height);
DEBUG("BMI $BMIn");
my $BMI_literal = RDF::Trine::Node::Literal->new($BMI);
my $statement = RDF::Trine::Statement->new($input, $BMIp, $BMI_literal);
$output_model->add_statement($statement, $input);
$output_model->nanopublish_result_for($input);
}
}

More Related Content

What's hot

Generating Power with Yield
Generating Power with YieldGenerating Power with Yield
Generating Power with YieldJason Myers
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowKacper Gunia
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON APIpodsframework
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Arc & Codementor
 
Php pattern matching
Php pattern matchingPhp pattern matching
Php pattern matchingJIGAR MAKHIJA
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using CodeceptionJeroen van Dijk
 
ZCPE - PHP Conference 2015
ZCPE   - PHP Conference 2015ZCPE   - PHP Conference 2015
ZCPE - PHP Conference 2015Matheus Marabesi
 
Php server variables
Php server variablesPhp server variables
Php server variablesJIGAR MAKHIJA
 
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...Matheus Marabesi
 

What's hot (18)

Generating Power with Yield
Generating Power with YieldGenerating Power with Yield
Generating Power with Yield
 
Perl5i
Perl5iPerl5i
Perl5i
 
PHP function
PHP functionPHP function
PHP function
 
PHP 8.1: Enums
PHP 8.1: EnumsPHP 8.1: Enums
PHP 8.1: Enums
 
Php Enums
Php EnumsPhp Enums
Php Enums
 
Laravel the right way
Laravel   the right wayLaravel   the right way
Laravel the right way
 
Php functions
Php functionsPhp functions
Php functions
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON API
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
 
Event Sourcing with php
Event Sourcing with phpEvent Sourcing with php
Event Sourcing with php
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
 
Php pattern matching
Php pattern matchingPhp pattern matching
Php pattern matching
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
ZCPE - PHP Conference 2015
ZCPE   - PHP Conference 2015ZCPE   - PHP Conference 2015
ZCPE - PHP Conference 2015
 
Php server variables
Php server variablesPhp server variables
Php server variables
 
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
 

Viewers also liked

Невероятные способы автоматизации работы в АСУРЭО
Невероятные способы автоматизации работы в АСУРЭОНевероятные способы автоматизации работы в АСУРЭО
Невероятные способы автоматизации работы в АСУРЭОMax Chikhirev
 
Aeroporto de Lisboa nos anos 50
Aeroporto de Lisboa nos anos 50Aeroporto de Lisboa nos anos 50
Aeroporto de Lisboa nos anos 50ppmateus
 
Adopted Glenferrie Road and High Street Structure Plan
Adopted Glenferrie Road and High Street Structure PlanAdopted Glenferrie Road and High Street Structure Plan
Adopted Glenferrie Road and High Street Structure PlanStonnington
 
Y con la familia qué hago
Y con la familia qué hagoY con la familia qué hago
Y con la familia qué hagoRosina Badenes
 
3. el arte contemporáneo frente a la crisis ecológica kom
3. el arte contemporáneo frente a la crisis ecológica kom3. el arte contemporáneo frente a la crisis ecológica kom
3. el arte contemporáneo frente a la crisis ecológica komAmelia Kom Kom
 
Angiomyxoma - A Rare Case Report
Angiomyxoma - A Rare Case ReportAngiomyxoma - A Rare Case Report
Angiomyxoma - A Rare Case ReportApollo Hospitals
 
Princes Gardens Masterplan of Existing Conditions
 Princes Gardens Masterplan of Existing Conditions  Princes Gardens Masterplan of Existing Conditions
Princes Gardens Masterplan of Existing Conditions Stonnington Connect
 
SSG 32 Sustainable Environment Report
SSG 32   Sustainable Environment ReportSSG 32   Sustainable Environment Report
SSG 32 Sustainable Environment ReportStonnington
 
Організація роботи вчителя та учнів по вивченню нового матеріалу
Організація роботи вчителя та учнів по вивченню нового матеріалуОрганізація роботи вчителя та учнів по вивченню нового матеріалу
Організація роботи вчителя та учнів по вивченню нового матеріалуОксана Миколаївна
 
Degree of reaction
Degree of reactionDegree of reaction
Degree of reactionHarshit Jain
 

Viewers also liked (20)

Examem adaptado
Examem adaptadoExamem adaptado
Examem adaptado
 
Невероятные способы автоматизации работы в АСУРЭО
Невероятные способы автоматизации работы в АСУРЭОНевероятные способы автоматизации работы в АСУРЭО
Невероятные способы автоматизации работы в АСУРЭО
 
Biodiesel
BiodieselBiodiesel
Biodiesel
 
Aeroporto de Lisboa nos anos 50
Aeroporto de Lisboa nos anos 50Aeroporto de Lisboa nos anos 50
Aeroporto de Lisboa nos anos 50
 
Marketing Management (EBU2303)
Marketing Management (EBU2303)Marketing Management (EBU2303)
Marketing Management (EBU2303)
 
Adopted Glenferrie Road and High Street Structure Plan
Adopted Glenferrie Road and High Street Structure PlanAdopted Glenferrie Road and High Street Structure Plan
Adopted Glenferrie Road and High Street Structure Plan
 
Y con la familia qué hago
Y con la familia qué hagoY con la familia qué hago
Y con la familia qué hago
 
3. el arte contemporáneo frente a la crisis ecológica kom
3. el arte contemporáneo frente a la crisis ecológica kom3. el arte contemporáneo frente a la crisis ecológica kom
3. el arte contemporáneo frente a la crisis ecológica kom
 
3 AXIS CNC
3 AXIS CNC3 AXIS CNC
3 AXIS CNC
 
Angiomyxoma - A Rare Case Report
Angiomyxoma - A Rare Case ReportAngiomyxoma - A Rare Case Report
Angiomyxoma - A Rare Case Report
 
Princes Gardens Masterplan of Existing Conditions
 Princes Gardens Masterplan of Existing Conditions  Princes Gardens Masterplan of Existing Conditions
Princes Gardens Masterplan of Existing Conditions
 
sohail khan
sohail khansohail khan
sohail khan
 
SSG 32 Sustainable Environment Report
SSG 32   Sustainable Environment ReportSSG 32   Sustainable Environment Report
SSG 32 Sustainable Environment Report
 
Rpp ppkn x bab 3 1516 8 kali jp
Rpp ppkn x bab 3 1516 8 kali jpRpp ppkn x bab 3 1516 8 kali jp
Rpp ppkn x bab 3 1516 8 kali jp
 
NACE-July-6-2015
NACE-July-6-2015NACE-July-6-2015
NACE-July-6-2015
 
project cvs (1)
project cvs (1)project cvs (1)
project cvs (1)
 
Організація роботи вчителя та учнів по вивченню нового матеріалу
Організація роботи вчителя та учнів по вивченню нового матеріалуОрганізація роботи вчителя та учнів по вивченню нового матеріалу
Організація роботи вчителя та учнів по вивченню нового матеріалу
 
Mangosteen
MangosteenMangosteen
Mangosteen
 
Post operatorio
Post operatorioPost operatorio
Post operatorio
 
Degree of reaction
Degree of reactionDegree of reaction
Degree of reaction
 

Similar to Example code for the SADI BMI Calculator Web Service

What RabbitMQ can do for you (phpnw14 Uncon)
What RabbitMQ can do for you (phpnw14 Uncon)What RabbitMQ can do for you (phpnw14 Uncon)
What RabbitMQ can do for you (phpnw14 Uncon)James Titcumb
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012D
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략Jeen Lee
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Curscatalyst
CurscatalystCurscatalyst
CurscatalystKar Juan
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
Desymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesDesymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesAlbert Jessurum
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of LithiumNate Abele
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門lestrrat
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Masahiro Nagano
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Restshravan kumar chelika
 

Similar to Example code for the SADI BMI Calculator Web Service (20)

What RabbitMQ can do for you (phpnw14 Uncon)
What RabbitMQ can do for you (phpnw14 Uncon)What RabbitMQ can do for you (phpnw14 Uncon)
What RabbitMQ can do for you (phpnw14 Uncon)
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
CakePHP workshop
CakePHP workshopCakePHP workshop
CakePHP workshop
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Xmpp prebind
Xmpp prebindXmpp prebind
Xmpp prebind
 
Desymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesDesymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus Bundles
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
PhpBB meets Symfony2
PhpBB meets Symfony2PhpBB meets Symfony2
PhpBB meets Symfony2
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Rest
 

More from Mark Wilkinson

FAIR Metrics - Presentation to NIH KC1
FAIR Metrics - Presentation to NIH KC1FAIR Metrics - Presentation to NIH KC1
FAIR Metrics - Presentation to NIH KC1Mark Wilkinson
 
Introducing the fair evaluator
Introducing the fair evaluatorIntroducing the fair evaluator
Introducing the fair evaluatorMark Wilkinson
 
FAIR Projector Builder
FAIR Projector BuilderFAIR Projector Builder
FAIR Projector BuilderMark Wilkinson
 
Tech. session : Interoperability and Data FAIRness emerges from a novel combi...
Tech. session : Interoperability and Data FAIRness emerges from a novel combi...Tech. session : Interoperability and Data FAIRness emerges from a novel combi...
Tech. session : Interoperability and Data FAIRness emerges from a novel combi...Mark Wilkinson
 
smartAPIs: EUDAT Semantic Working Group Presentation @ RDA 9th Plenary
smartAPIs:  EUDAT Semantic Working Group Presentation @ RDA 9th PlenarysmartAPIs:  EUDAT Semantic Working Group Presentation @ RDA 9th Plenary
smartAPIs: EUDAT Semantic Working Group Presentation @ RDA 9th PlenaryMark Wilkinson
 
IBC FAIR Data Prototype Implementation slideshow
IBC FAIR Data Prototype Implementation   slideshowIBC FAIR Data Prototype Implementation   slideshow
IBC FAIR Data Prototype Implementation slideshowMark Wilkinson
 
FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...
FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...
FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...Mark Wilkinson
 
Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015
Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015
Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015Mark Wilkinson
 
Sample data and other ur ls
Sample data and other ur lsSample data and other ur ls
Sample data and other ur lsMark Wilkinson
 
Tutorial - Creating SADI semantic-web-services
Tutorial - Creating SADI semantic-web-servicesTutorial - Creating SADI semantic-web-services
Tutorial - Creating SADI semantic-web-servicesMark Wilkinson
 
Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015
Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015
Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015Mark Wilkinson
 
Force11 JDDCP workshop presentation, @ Force2015, Oxford
Force11 JDDCP workshop presentation, @ Force2015, OxfordForce11 JDDCP workshop presentation, @ Force2015, Oxford
Force11 JDDCP workshop presentation, @ Force2015, OxfordMark Wilkinson
 
Presentation to the J. Craig Venter Institute, Dec. 2014
Presentation to the J. Craig Venter Institute, Dec. 2014Presentation to the J. Craig Venter Institute, Dec. 2014
Presentation to the J. Craig Venter Institute, Dec. 2014Mark Wilkinson
 
Enhancing Reproducibility and Transparency in Clinical Research through Seman...
Enhancing Reproducibility and Transparency in Clinical Research through Seman...Enhancing Reproducibility and Transparency in Clinical Research through Seman...
Enhancing Reproducibility and Transparency in Clinical Research through Seman...Mark Wilkinson
 
Web Science 2.0 - in silico science
Web Science 2.0 - in silico scienceWeb Science 2.0 - in silico science
Web Science 2.0 - in silico scienceMark Wilkinson
 
Web Science - ISoLA 2012
Web Science - ISoLA 2012Web Science - ISoLA 2012
Web Science - ISoLA 2012Mark Wilkinson
 
Web Science, SADI, and the Singularity
Web Science, SADI, and the SingularityWeb Science, SADI, and the Singularity
Web Science, SADI, and the SingularityMark Wilkinson
 
Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...
Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...
Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...Mark Wilkinson
 

More from Mark Wilkinson (20)

FAIR Metrics - Presentation to NIH KC1
FAIR Metrics - Presentation to NIH KC1FAIR Metrics - Presentation to NIH KC1
FAIR Metrics - Presentation to NIH KC1
 
Introducing the fair evaluator
Introducing the fair evaluatorIntroducing the fair evaluator
Introducing the fair evaluator
 
FAIR Projector Builder
FAIR Projector BuilderFAIR Projector Builder
FAIR Projector Builder
 
Tech. session : Interoperability and Data FAIRness emerges from a novel combi...
Tech. session : Interoperability and Data FAIRness emerges from a novel combi...Tech. session : Interoperability and Data FAIRness emerges from a novel combi...
Tech. session : Interoperability and Data FAIRness emerges from a novel combi...
 
smartAPIs: EUDAT Semantic Working Group Presentation @ RDA 9th Plenary
smartAPIs:  EUDAT Semantic Working Group Presentation @ RDA 9th PlenarysmartAPIs:  EUDAT Semantic Working Group Presentation @ RDA 9th Plenary
smartAPIs: EUDAT Semantic Working Group Presentation @ RDA 9th Plenary
 
IBC FAIR Data Prototype Implementation slideshow
IBC FAIR Data Prototype Implementation   slideshowIBC FAIR Data Prototype Implementation   slideshow
IBC FAIR Data Prototype Implementation slideshow
 
FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...
FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...
FAIR Data Prototype - Interoperability and FAIRness through a novel combinati...
 
Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015
Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015
Building SADI Services Tutorial - SIB Workshop, Geneva, December 2015
 
Sample data and other ur ls
Sample data and other ur lsSample data and other ur ls
Sample data and other ur ls
 
Sadi service
Sadi serviceSadi service
Sadi service
 
Tutorial - Creating SADI semantic-web-services
Tutorial - Creating SADI semantic-web-servicesTutorial - Creating SADI semantic-web-services
Tutorial - Creating SADI semantic-web-services
 
Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015
Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015
Data FAIRport Prototype & Demo - Presentation to Elsevier, Jul 10, 2015
 
Force11 JDDCP workshop presentation, @ Force2015, Oxford
Force11 JDDCP workshop presentation, @ Force2015, OxfordForce11 JDDCP workshop presentation, @ Force2015, Oxford
Force11 JDDCP workshop presentation, @ Force2015, Oxford
 
Presentation to the J. Craig Venter Institute, Dec. 2014
Presentation to the J. Craig Venter Institute, Dec. 2014Presentation to the J. Craig Venter Institute, Dec. 2014
Presentation to the J. Craig Venter Institute, Dec. 2014
 
Enhancing Reproducibility and Transparency in Clinical Research through Seman...
Enhancing Reproducibility and Transparency in Clinical Research through Seman...Enhancing Reproducibility and Transparency in Clinical Research through Seman...
Enhancing Reproducibility and Transparency in Clinical Research through Seman...
 
SADI CSHALS 2013
SADI CSHALS 2013SADI CSHALS 2013
SADI CSHALS 2013
 
Web Science 2.0 - in silico science
Web Science 2.0 - in silico scienceWeb Science 2.0 - in silico science
Web Science 2.0 - in silico science
 
Web Science - ISoLA 2012
Web Science - ISoLA 2012Web Science - ISoLA 2012
Web Science - ISoLA 2012
 
Web Science, SADI, and the Singularity
Web Science, SADI, and the SingularityWeb Science, SADI, and the Singularity
Web Science, SADI, and the Singularity
 
Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...
Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...
Evaluating Hypotheses using SPARQL-DL as an abstract workflow language to cho...
 

Recently uploaded

Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...akbard9823
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 

Recently uploaded (20)

Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 

Example code for the SADI BMI Calculator Web Service

  • 1. #!/usr/local/bin/perl package GetMyBMI; # a SADI Service for BMI Calculation use strict; use warnings; #use base 'SADI::Simple::AsyncService'; use base 'SADI::Simple::SyncService'; my $config = { ServiceName => 'GetMyBMI', # any name you like ServiceURI => 'http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl', #URL of this script Description => 'A BMI calculator', InputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientData', OutputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientBMI', Authority => 'wilkinsonlab.info', # domain of organization providing service Provider => 'markw@illuminae.com', # contact e-mail address of service provider }; my $service = GetMyBMI->new(%$config); $service->handle_cgi_request; #----------------------------------------------------------------- # SERVICE IMPLEMENTATION #----------------------------------------------------------------- use RDF::Trine::Node::Resource; use RDF::Trine::Node::Literal; use RDF::Trine::Statement; sub process_it { my ($self, $inputs, $input_model, $output_model) = @_; # $inputs - ref to an array of RDF::Trine::Node::Resource # $input_model - an RDF::Trine::Model containing the input RDF data # $output_model - an RDF::Trine::Model containing the output RDF data my $heightp = RDF::Trine::Node::Resource->new( 'http://mged.sourceforge.net/ontologies/MGEDOntology.owl#has_height'); my $weightp = RDF::Trine::Node::Resource->new( 'http://linkeddata.systems/ontologies/SADITutorial.owl#has_mass'); my $BMIp = RDF::Trine::Node::Resource->new( 'http://sadiframework.org/examples/bmi.owl#BMI'); foreach my $input (@$inputs) { # retrieve the height and weight node from each input my ($height) = $input_model->objects($input, $heightp); my ($weight) = $input_model->objects($input, $weightp); $height = $height->value; $weight = $weight->value; my $BMI = $weight/($height * $height); my $BMI_literal = RDF::Trine::Node::Literal->new($BMI); # The output statement is about the $input as the subject node!! my $statement = RDF::Trine::Statement->new($input, $BMIp, $BMI_literal); $output_model->add_statement($statement); } }
  • 2. #!/usr/local/bin/perl package GetMyBMI; use strict; use warnings; use base 'SADI::Simple::SyncService'; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($WARN); #Log::Log4perl->easy_init($DEBUG); my $config = { ServiceName => 'GetMyBMI', # any name you like ServiceURI => 'http://linkeddata.systems/cgi-bin/SADI/GetMyBMI.pl', Description => 'A BMI calculator', InputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientData', OutputClass => 'http://linkeddata.systems/ontologies/SADITutorial.owl#PatientBMI', Authority => 'wilkinsonlab.info', # domain of organization providing service Provider => 'markw@illuminae.com', # contact e-mail address of service provider NanoPublisher => 1, # I want to be a NanoPublisher }; my $service = GetMyBMI->new(%$config); $service->handle_cgi_request; use RDF::Trine::Node::Resource; use RDF::Trine::Node::Literal; use RDF::Trine::Statement; sub process_it { my ($self, $inputs, $input_model, $output_model) = @_; # $inputs - ref to an array of RDF::Trine::Node::Resource # $input_model - an RDF::Trine::Model containing the input RDF data # $output_model - an RDF::Trine::Model containing the output RDF data my $heightp = RDF::Trine::Node::Resource->new( 'http://mged.sourceforge.net/ontologies/MGEDOntology.owl#has_height'); my $weightp = RDF::Trine::Node::Resource->new( 'http://linkeddata.systems/ontologies/SADITutorial.owl#has_mass'); my $BMIp = RDF::Trine::Node::Resource->new( 'http://sadiframework.org/examples/bmi.owl#BMI'); foreach my $input (@$inputs) { my ($height) = $input_model->objects($input, $heightp); my ($weight) = $input_model->objects($input, $weightp); $height = $height->value; $weight = $weight->value; my $BMI = $weight/($height * $height); DEBUG("BMI $BMIn"); my $BMI_literal = RDF::Trine::Node::Literal->new($BMI); my $statement = RDF::Trine::Statement->new($input, $BMIp, $BMI_literal); $output_model->add_statement($statement, $input); $output_model->nanopublish_result_for($input); } }