Test::RDF - Test RDF data for content, validity and equality, etc.


Test-RDF documentation  | view source Contained in the Test-RDF distribution.

Index


NAME

Top

Test::RDF - Test RDF data for content, validity and equality, etc.

VERSION

Top

Version 0.22

SYNOPSIS

Top

 use Test::RDF;

 is_valid_rdf($rdf_string, $syntax,  'RDF string is valid according to selected syntax');
 is_rdf($rdf_string, $syntax1, $expected_rdf_string, $syntax2, 'The two strings have the same triples');
 isomorph_graphs($model, $expected_model, 'The two models have the same triples');
 are_subgraphs($model1, $model2, 'Model 1 is a subgraph of model 2' );
 has_subject($uri_string, $model, 'Subject URI is found');
 has_predicate($uri_string, $model, 'Predicate URI is found');
 has_object_uri($uri_string, $model, 'Object URI is found');
 has_literal($string, $language, $datatype, $model, 'Literal is found');




EXPORT

Top

is_valid_rdf

Use to check if the input RDF string is valid in the chosen syntax

is_rdf

Use to check if the input RDF strings are isomorphic (i.e. the same).

isomorph_graphs

Use to check if the input RDF::Trine::Models have isomorphic graphs.

are_subgraphs

Use to check if the first RDF::Trine::Models is a subgraph of the second.

has_subject

Check if the string URI passed as first argument is a subject in any of the statements given in the model given as second argument.

has_predicate

Check if the string URI passed as first argument is a predicate in any of the statements given in the model given as second argument.

has_object_uri

Check if the string URI passed as first argument is a object in any of the statements given in the model given as second argument.

has_literal

Check if the string passed as first argument, with corresponding optional language and datatype as second and third respectively, is a literal in any of the statements given in the model given as fourth argument.

language and datatype may not occur in the same statement, so the test fails if they are both set. If none are used, use undef, like e.g.

 has_literal('A test', undef, undef, $model, 'Simple literal');

A test for a typed literal may be done like

 has_literal('42', undef, 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Just an integer');

and a language literal like

 has_literal('This is a Another test', 'en', undef, $model, 'Language literal');




has_uri

Check if the string URI passed as first argument is present in any of the statements given in the model given as second argument.

NOTE

Top

Graph isomorphism is a complex problem, so do not attempt to run the isomorphism tests on large datasets. For more information see http://en.wikipedia.org/wiki/Graph_isomorphism_problem.

AUTHOR

Top

Kjetil Kjernsmo, <kjetilk at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-test-rdf at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-RDF. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Test::RDF




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-RDF

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Test-RDF

* CPAN Ratings

http://cpanratings.perl.org/d/Test-RDF

* Search CPAN

http://search.cpan.org/dist/Test-RDF/

ACKNOWLEDGEMENTS

Top

Michael Hendricks wrote the first Test::RDF. The present module is a complete rewrite from scratch using Gregory Todd William's RDF::Trine::Graph to do the heavy lifting.

LICENSE AND COPYRIGHT

Top


Test-RDF documentation  | view source Contained in the Test-RDF distribution.