### # Simple commandline-client of the APE webservice. # Sends sentences from STDIN to the webservice and outputs OWL/SWRL (in XML) to STDOUT. # # Kaarel Kaljurand # 2010-11-04 # # Usage: # cat sentences.txt | perl acetext_to_owl-post.perl > ontologies.txt ### use strict; use warnings; use LWP::UserAgent; my $browser = LWP::UserAgent->new; my $url = 'http://attempto.ifi.uzh.ch/ws/ape/apews.perl'; $browser->agent("SimpleApeClientWithLWP/0.7"); while() { chomp; my $query = [ 'text' => $_, 'solo' => 'owlxml' ]; my $response = $browser->post($url, $query); die "Error: ", $response->status_line unless $response->is_success; die "Error: content type not text/xml but ", $response->content_type unless $response->content_type eq 'text/xml'; print $response->content, "\n"; }