Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: XML::Simple - Handling inconsistency

by tobyink (Abbot)
on Jan 09, 2013 at 10:27 UTC ( #1012420=note: print w/ replies, xml ) Need Help??

in reply to XML::Simple - Handling inconsistency

You appear to be trying to parse SPARQL result sets. There are some really good RDF/SPARQL modules for Perl, so you needn't be mucking around with XML stuff!

use strict; use warnings; use RDF::Query::Client; my $query = RDF::Query::Client->new(<<'SPARQL'); PREFIX category: <> PREFIX dc: <> PREFIX rdfs: <> SELECT * WHERE { ?resource dc:subject category:English_film_actors . ?resource dc:subject category:Life_peers . ?resource rdfs:label ?name . FILTER ( langMatches(lang(?name), "en") ) } SPARQL my $results = $query->execute(''); while (my $row = $results->next) { printf( "%s <%s>\n", $row->{name}->literal_value, $row->{resource}->uri, ); }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Comment on Re: XML::Simple - Handling inconsistency
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012420]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2015-11-29 10:20 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (750 votes), past polls