use Test::More tests => 10; use HTML::Microformats; my $html = <<'HTML';

My Org

General Enquiries: +44 1234 567 890

Fax: +44 1234 567 891

Help Desk +44 1234 567 899

HTML my $document = HTML::Microformats->new_document($html, 'http://example.com/'); $document->assume_all_profiles; my @cards = sort { $a->data->{fn} cmp $b->data->{fn} } $document->objects('hCard'); is($cards[0]->get_kind, 'group', 'Auto-detect group kind.'); is($cards[1]->get_kind, 'org', 'Auto-detect organisation kind.'); is($cards[0]->element->tagName, 'p', 'Can get links back to elements.'); is($cards[1]->get_tel->[0]->get_value, 'tel:+441234567890', 'Parsed tel without type+value'); is($cards[1]->get_tel->[1]->get_value, 'tel:+441234567891', 'Parsed tel with type+value'); is($cards[1]->get_agent->[0], $cards[0], 'Agent works OK'); my $model = $document->model; ok($model->count_statements( $cards[1]->id(1), RDF::Trine::Node::Resource->new('http://www.w3.org/2006/vcard/ns#agent'), $cards[0]->id(1), ), "Agent works OK (RDF)" ); ok($model->count_statements( $cards[1]->id(1), RDF::Trine::Node::Resource->new('http://www.w3.org/2006/vcard/ns#fn'), RDF::Trine::Node::Literal->new('My Org', 'en'), ), "Languages work OK (RDF)" ); ok($model->count_statements( $cards[1]->id(1, 'holder'), RDF::Trine::Node::Resource->new('http://purl.org/uF/hCard/terms/hasCard'), $cards[1]->id(1), ), "Differentiates between vcards and their holders (RDF)" ); ok($model->count_statements( $cards[1]->id(1, 'holder'), RDF::Trine::Node::Resource->new('http://xmlns.com/foaf/0.1/name'), RDF::Trine::Node::Literal->new('My Org', 'en'), ), "Infers information about vcard holder from the vcard (RDF)" );