Commits

Konstantin Baierer  committed 03367c3

cleaned up test directory into subdirectories

  • Participants
  • Parent commits 7c0af3e

Comments (0)

Files changed (23)

 syntax: glob
 _build
 **/*.swp
+*.swp
+**/*.swo
+*.swo
 blib
 Build
 MANIFEST.bak

File t/mock_server.t

-use Test::More; 
-use Test::Moose;
-use Data::Dumper;
-use MooseX::Semantic::Test::MockServer;
-use MooseX::Semantic::Test::Person;
-
-my $server = MooseX::Semantic::Test::MockServer->new;
-my $pid = fork;
-if ($pid) {
-    $server->run;
-}
-
-my $p = MooseX::Semantic::Test::Person->new(
-    'name' => 'ABC',
-);
-my $resp =
-  $p->export_to_web( PUT => 'http://localhost:54321', format => 'turtle' );
-my $in_turtle = $p->export_to_string( format => 'turtle' );
-
-is($resp->request->content, $in_turtle, 'Server received correct serialization');
-is($resp->request->method, 'PUT', 'Server was requested using PUT');
-
-# HTTP::Request
-
-done_testing;
-$server->kill;
-# exit;

File t/rdf_backend/role_rdfbackend.t

+use Test::More;
+use Test::Moose;
+use RDF::Trine;
+use Data::Dumper;
+use MooseX::Semantic::Test qw(ser ser_dump diff_models);
+
+use MooseX::Semantic::Test::BackendPerson;
+
+
+MooseX::Semantic::Test::BackendPerson->_trine_store_opts(
+    storetype => 'DBI',
+    name => 'semantic_moose',
+    dsn => 'dbi:SQLite:dbname=t/data/semantic_moose.sqlite',
+    username => 'FAKE',
+    password => 'FAKE',
+);
+
+isa_ok( MooseX::Semantic::Test::BackendPerson->rdf_store, 'RDF::Trine::Store');
+is( MooseX::Semantic::Test::BackendPerson->rdf_store->model_name, 'semantic_moose');
+my $store = MooseX::Semantic::Test::BackendPerson->rdf_store;
+# warn Dumper $store;
+
+my $rdf_about_uri = 'http://example/#me';
+my $p = MooseX::Semantic::Test::BackendPerson->new(rdf_about => $rdf_about_uri, name => 'kb', favorite_numer => 3);
+# warn Dumper $p->name;
+# warn Dumper $p->meta->get_attribute('name');
+# warn Dumper [$p->meta->get_attribute_list];
+# warn Dumper [$p->meta->get_class_attribute_list];
+# warn Dumper $p;
+$p->store;
+my $p2 = MooseX::Semantic::Test::BackendPerson->new_from_store( $rdf_about_uri );
+# warn Dumper $p2;
+is($p->name, $p2->name, 'Backend Person can be round-tripped');
+
+done_testing;

File t/rdf_export/basic.t

+use Test::More tests=>10;
+use Test::Moose;
+use RDF::Trine qw(blank);
+use Data::Dumper;
+use MooseX::Semantic::Test::Person;
+use File::Temp qw( tempfile );
+
+sub basic_export {
+    my $toby = MooseX::Semantic::Test::Person->new(
+        rdf_about => 'http://tobyinkster.co.uk/#i',
+        name => 'Toby Inkster',
+        country => 'UK',
+        subjects => ['perl'],
+    );
+    my $greg = MooseX::Semantic::Test::Person->new(
+        rdf_about => 'http://kasei.us/about/foaf.xrdf#greg',
+        name => 'Gregory Williams',
+        country => 'USA',
+        favorite_numer => 3,
+        friends => [ $toby ],
+    );
+    my $model = $greg->export_to_model;
+    isa_ok($model, 'RDF::Trine::Model');
+    ok($model->size == 9, 'generated 9 statments');
+    # warn Dumper $model->size;
+    # warn Dumper $model;
+    ok(my $model_as_string = $greg->export_to_string(format=>'ntriples'), 'export_to_string works');
+    # warn Dumper $model_as_string;
+
+    my ( $fh, $fname ) = tempfile;
+    ok( $greg->export_to_file( $fh, format=>'ntriples' ), 'export_to_file works');
+    close $fh;
+    # open $fh, "<", $fname;
+    my $fh_contents = do { local $/; open $fh, "<$fname"; <$fh> };
+    # close $fh;
+    is( $fh_contents, $model_as_string, 'File export and String export match');
+}
+
+sub basic_blank_node {
+    my $bob = MooseX::Semantic::Test::Person->new(
+        rdf_about => blank,
+        name => 'Bob',
+    );
+    my $alice = MooseX::Semantic::Test::Person->new(
+        rdf_about => blank,
+        name => 'Alice',
+    );
+    $bob->add_friend( $alice );
+    ok($bob->rdf_about->is_blank, 'Bob is blank');
+    ok($alice->rdf_about->is_blank, 'Alice is blank');
+    is($bob->get_friend(0), $alice, "Alice is Bob's friend");
+    ok(my $model = $bob->export_to_model, 'Can export Bob to model');
+    is($model->size, 5, 'Correct number of statements exported');
+}
+
+&basic_export;
+&basic_blank_node;
+# done_testing;

File t/rdf_export/mock_server.t

+use Test::More skip_all => 'bad solution as of now'; 
+use Test::Moose;
+use Data::Dumper;
+use MooseX::Semantic::Test::MockServer;
+use MooseX::Semantic::Test::Person;
+
+my $server = MooseX::Semantic::Test::MockServer->new;
+my $pid = fork;
+if ($pid) {
+    $server->run;
+}
+
+my $p = MooseX::Semantic::Test::Person->new(
+    'name' => 'ABC',
+);
+my $resp =
+  $p->export_to_web( PUT => 'http://localhost:54321', format => 'turtle' );
+my $in_turtle = $p->export_to_string( format => 'turtle' );
+
+is($resp->request->content, $in_turtle, 'Server received correct serialization');
+is($resp->request->method, 'PUT', 'Server was requested using PUT');
+
+# HTTP::Request
+
+done_testing;
+$server->kill;
+# exit;

File t/rdf_import/blank_node.t

+use Test::More tests=>4;
+use RDF::Trine;
+use Data::Dumper;
+use MooseX::Semantic::Test::Person;
+
+my $model = RDF::Trine::Model->new;
+RDF::Trine::Parser::Turtle
+	->new
+	->parse_file_into_model('http://example.com/', 't/data/blank_node_01.ttl', $model);
+
+# warn Dumper $model;
+# my $serializer = RDF::Trine::Serializer->new('turtle');
+# warn Dumper $serializer->serialize_model_to_string($model);
+ok( my $alice = MooseX::Semantic::Test::Person->new_from_model($model, 'http://example.com/alice'), 'Alice is detected');
+ok( $alice->has_friends, 'Alice has a friend' );
+TODO: {
+    local $TODO = "recursive import NIH";
+    is( $alice->friends->[0]->name, Bob, "Alice's friend's name is Bob" );
+}
+ok( $alice->friends->[0]->is_blank, "Bob is a blank node" );
+# warn Dumper $alice;

File t/rdf_import/import_all.t

+use Test::More tests => 5;
+use RDF::Trine;
+use MooseX::Semantic::Test::StrictPerson;
+
+my $model = RDF::Trine::Model->new;
+RDF::Trine::Parser::Turtle
+	->new
+	->parse_file_into_model('http://example.com/', 't/data/multiple_persons.ttl', $model);
+
+my @people = 
+	sort { $a->name cmp $b->name }
+	MooseX::Semantic::Test::StrictPerson->import_all_from_model($model);
+
+is(scalar @people, 4, "Correct number of people found.");
+is($people[0]->name, "Alice");
+is($people[1]->name, "Bob");
+is($people[2]->name, "Carol");
+is($people[3]->name, "Dave");
+

File t/rdf_import/role_rdfimport.t

+use Test::More;
+use Test::Moose;
+use RDF::Trine;
+use Data::Dumper;
+use MooseX::Semantic::Test::Person;
+use MooseX::Semantic::Test qw(ser ser_dump diff_models);
+
+
+sub import_from_ttl {
+    my $base_uri = 'http://tobyinkster.co.uk/#i';
+    my $test_model = RDF::Trine::Model->temporary_model;
+    RDF::Trine::Parser::Turtle->parse_file_into_model(
+        $base_uri,
+        't/data/toby_inkster.ttl',
+        $test_model,
+    );
+    my $person = MooseX::Semantic::Test::Person->new_from_model( $test_model, $base_uri );
+    ok (! $person->is_blank, "Toby isn't a blank node");
+    # warn Dumper $person;
+    ok(! ref $person->name, 'Single Value -> Str');
+    ok($person->name eq 'Toby Inkster', 'name attribute is set ');
+
+    is(ref $person->topic_interest, 'ARRAY', 'Multiple Values -> ArrayRef');
+    is(scalar(@{$person->topic_interest}), 2, 'All values are imported');
+
+    ok(! ref $person->country, 'Multiple values -> Str');
+    is($person->country, 'USA', 'country set to last value in Turtle syntax (weakly defined behaviour here)');
+
+    ok( ref $person->subjects eq 'ARRAY', 'Single Value -> ArrayRef');
+    is( $person->subjects->[0], 'homepage', 'subjects imported');
+
+    is( ref $person->friends,  'ARRAY', 'Single URI -> ArrayRef' );
+    is( $person->get_friend(0)->rdf_about->value, 'http://kasei.us/about/foaf.xrdf#greg', 'friends correctly detected');
+    ok( $person->get_friend(0)->is_resource, "Greg isn't a blank node");
+
+    isa_ok( ref $person->generic_one_to_one_relation,  'MooseX::Semantic::Test::Person', 'Single URI -> Resource Object' );
+    is( $person->generic_one_to_one_relation->rdf_about->uri, 'http://kasei.us/about/foaf.xrdf#greg', 'Object created');
+    ok( !  $person->generic_one_to_one_relation->is_blank,, "Greg isn't a blank node");
+
+    ok(my $got_model = $person->export_to_model);
+
+    my $test_model_str = ser_dump($test_model);
+    # my $got_model_str = ser->serialize_model_to_string($got_model);
+    # warn Dumper [$test_model_str, $got_model_str];
+    diff_models($test_model, $got_model);
+    my $old_size = $test_model->size;
+    my $new_size = $got_model;
+    TODO: {
+        cmp_ok($new_size, '>=', $old_size, 'Same number of statements after round-trip (sans information lost on multiple values)');
+    }
+}
+
+sub import_from_web {
+    my $base_uri = 'http://kasei.us/about/foaf.xrdf#greg';
+    my $model = MooseX::Semantic::Test::Person->new_from_web( $base_uri );
+}
+
+sub symmetrical_property {
+    my $base_uri = 'http://example.org/';
+    my $test_model = RDF::Trine::Model->temporary_model;
+    RDF::Trine::Parser::Turtle->parse_file_into_model(
+        $base_uri,
+        't/data/symmetrical_property.ttl',
+        $test_model,
+    );
+    ok( my $alice = MooseX::Semantic::Test::Person->new_from_model( $test_model, $base_uri . 'F' )
+        , 'Alice can be loaded from RDF');
+    ok( my $alice_model_str = $alice->export_to_string(format=>'ntriples') );
+    # warn Dumper $alice_model_str;
+}
+
+&import_from_ttl;
+&symmetrical_property;
+# &import_from_web;
+done_testing;

File t/rdf_metabuilder.t

-use Test::More tests=>4;
-use Test::Moose;
-use RDF::Trine::Namespace qw(rdf);
-use RDF::Trine qw(iri);
-use Data::Dumper;
-use MooseX::Semantic::Test::Person;
-use MooseX::Semantic::Test qw(ser ser_dump diff_models);
-
-use MooseX::Semantic::MetaBuilder::Class;
-use MooseX::Semantic::MetaBuilder::Attribute;
-
-my $base_uri = 'http://myapp/';
-my $test_model = RDF::Trine::Model->temporary_model;
-RDF::Trine::Parser::Turtle->parse_file_into_model(
-    $base_uri,
-    't/data/person_moose_definition.ttl',
-    $test_model,
-);
-
-my $MOOSE = 'http://moose.perl.org/onto#';
-my $moose = RDF::Trine::Namespace->new($MOOSE);
-my $myapp = RDF::Trine::Namespace->new($base_uri);
-# my $classes;
-
-# warn ser_dump( $test_model );
-
-{ 
-    package EmptyMoosePackage;
-    use Moose;
-    1;
-}
-
-ok(
-my $foaf_metaclass_builder = MooseX::Semantic::MetaBuilder::Class->new_from_model(
-    $test_model, 
-    $myapp->FoafMixin
-), 'loaded FoafMixin Metaclass Builder from model');
-is(scalar @{$foaf_metaclass_builder->has_attribute}, 2, 'FoafMixin Metaclass Builder has 2 attributes');
-
-is( scalar EmptyMoosePackage->meta->get_attribute_list, 0, 'EmptyMoosePackage has 0 attributes');
-# my $classes_iter = $test_model->subjects( $rdf->type, $moose->Class );
-# while (my $res = $classes_iter->next) {
- # }
-$foaf_metaclass_builder->add_attributes_to_class( 'EmptyMoosePackage' );
-is( scalar EmptyMoosePackage->meta->get_attribute_list, 2, 'EmptyMoosePackage has 2 attributes');
-# warn Dumper(
-    # EmptyMoosePackage->meta->get_attribute('knows')
-# );
-# warn Dumper __PACKAGE__->meta;
-
-

File t/rdf_metabuilder/from_foaf.t

+use Test::More tests=>4;
+use Test::Moose;
+use RDF::Trine::Namespace qw(rdf);
+use Data::Dumper;
+use MooseX::Semantic::Test qw(ser ser_dump diff_models);
+use MooseX::Semantic::Test::Person;
+use MooseX::Semantic::MetaBuilder;
+use MooseX::Semantic::Test::MetaPerson;
+
+my $x = MooseX::Semantic::Test::MetaPerson->new(
+    firstName => 'mister x',
+    lastName => 'X',
+);
+my $p = MooseX::Semantic::Test::MetaPerson->new(
+    firstName => 'Jim',
+    lastName => 'Powers',
+    knows => [ $x ],
+);
+# warn Dumper $p->knows->[0];
+ok($p->meta->get_attribute('firstName'), 'Attribute "firstName" was added from RDF');
+is($p->firstName, 'Jim' );
+isa_ok($p->knows->[0], 'MooseX::Semantic::Test::MetaPerson', '"knows" is multi-valued object attribute');
+is($p->knows->[0]->firstName, 'mister x');
+
+
+
+
+# # my $base_uri = 'http://myapp/';
+# my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
+# my $ont_foaf = RDF::Trine::Model->temporary_model;
+# RDF::Trine::Parser->parse_file_into_model(
+#     "http://example.org/",
+#     't/data/ontologies/foaf.rdf',
+#     $ont_foaf,
+# );
+# warn Dumper (
+#     MooseX::Semantic::MetaBuilder->_build_attributes_for(
+#         $ont_foaf, 
+#         $foaf->Person,
+#         {
+#             $foaf->Person => 'MooseX::Semantic::Test::FoafPerson',
+#         }
+#     )
+# );
+# warn Dumper ser_dump($ont_foaf);

File t/rdf_metabuilder/from_moose_ttl.t

+use Test::More tests=>4;
+use Test::Moose;
+use RDF::Trine::Namespace qw(rdf);
+use RDF::Trine qw(iri);
+use Data::Dumper;
+use MooseX::Semantic::Test::Person;
+use MooseX::Semantic::Test qw(ser ser_dump diff_models);
+
+use MooseX::Semantic::MetaBuilder::Class;
+use MooseX::Semantic::MetaBuilder::Attribute;
+
+my $base_uri = 'http://myapp/';
+my $test_model = RDF::Trine::Model->temporary_model;
+RDF::Trine::Parser::Turtle->parse_file_into_model(
+    $base_uri,
+    't/data/person_moose_definition.ttl',
+    $test_model,
+);
+
+my $MOOSE = 'http://moose.perl.org/onto#';
+my $moose = RDF::Trine::Namespace->new($MOOSE);
+my $myapp = RDF::Trine::Namespace->new($base_uri);
+# my $classes;
+
+# warn ser_dump( $test_model );
+
+{ 
+    package EmptyMoosePackage;
+    use Moose;
+    1;
+}
+
+ok(
+my $foaf_metaclass_builder = MooseX::Semantic::MetaBuilder::Class->new_from_model(
+    $test_model, 
+    $myapp->FoafMixin
+), 'loaded FoafMixin Metaclass Builder from model');
+is(scalar @{$foaf_metaclass_builder->has_attribute}, 2, 'FoafMixin Metaclass Builder has 2 attributes');
+
+is( scalar EmptyMoosePackage->meta->get_attribute_list, 0, 'EmptyMoosePackage has 0 attributes');
+# my $classes_iter = $test_model->subjects( $rdf->type, $moose->Class );
+# while (my $res = $classes_iter->next) {
+ # }
+$foaf_metaclass_builder->add_attributes_to_class( 'EmptyMoosePackage' );
+is( scalar EmptyMoosePackage->meta->get_attribute_list, 2, 'EmptyMoosePackage has 2 attributes');
+# warn Dumper(
+    # EmptyMoosePackage->meta->get_attribute('knows')
+# );
+# warn Dumper __PACKAGE__->meta;
+
+

File t/rdf_metabuilder_foaf.t

-use Test::More tests=>4;
-use Test::Moose;
-use RDF::Trine::Namespace qw(rdf);
-use Data::Dumper;
-use MooseX::Semantic::Test qw(ser ser_dump diff_models);
-use MooseX::Semantic::Test::Person;
-use MooseX::Semantic::MetaBuilder;
-use MooseX::Semantic::Test::MetaPerson;
-
-my $x = MooseX::Semantic::Test::MetaPerson->new(
-    firstName => 'mister x',
-    lastName => 'X',
-);
-my $p = MooseX::Semantic::Test::MetaPerson->new(
-    firstName => 'Jim',
-    lastName => 'Powers',
-    knows => [ $x ],
-);
-# warn Dumper $p->knows->[0];
-ok($p->meta->get_attribute('firstName'), 'Attribute "firstName" was added from RDF');
-is($p->firstName, 'Jim' );
-isa_ok($p->knows->[0], 'MooseX::Semantic::Test::MetaPerson', '"knows" is multi-valued object attribute');
-is($p->knows->[0]->firstName, 'mister x');
-
-
-
-
-# # my $base_uri = 'http://myapp/';
-# my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
-# my $ont_foaf = RDF::Trine::Model->temporary_model;
-# RDF::Trine::Parser->parse_file_into_model(
-#     "http://example.org/",
-#     't/data/ontologies/foaf.rdf',
-#     $ont_foaf,
-# );
-# warn Dumper (
-#     MooseX::Semantic::MetaBuilder->_build_attributes_for(
-#         $ont_foaf, 
-#         $foaf->Person,
-#         {
-#             $foaf->Person => 'MooseX::Semantic::Test::FoafPerson',
-#         }
-#     )
-# );
-# warn Dumper ser_dump($ont_foaf);

File t/role_rdfbackend.t

-use Test::More;
-use Test::Moose;
-use RDF::Trine;
-use Data::Dumper;
-use MooseX::Semantic::Test qw(ser ser_dump diff_models);
-
-use MooseX::Semantic::Test::BackendPerson;
-
-
-MooseX::Semantic::Test::BackendPerson->_trine_store_opts(
-    storetype => 'DBI',
-    name => 'semantic_moose',
-    dsn => 'dbi:SQLite:dbname=t/data/semantic_moose.sqlite',
-    username => 'FAKE',
-    password => 'FAKE',
-);
-
-isa_ok( MooseX::Semantic::Test::BackendPerson->rdf_store, 'RDF::Trine::Store');
-is( MooseX::Semantic::Test::BackendPerson->rdf_store->model_name, 'semantic_moose');
-my $store = MooseX::Semantic::Test::BackendPerson->rdf_store;
-# warn Dumper $store;
-
-my $rdf_about_uri = 'http://example/#me';
-my $p = MooseX::Semantic::Test::BackendPerson->new(rdf_about => $rdf_about_uri, name => 'kb', favorite_numer => 3);
-# warn Dumper $p->name;
-# warn Dumper $p->meta->get_attribute('name');
-# warn Dumper [$p->meta->get_attribute_list];
-# warn Dumper [$p->meta->get_class_attribute_list];
-# warn Dumper $p;
-$p->store;
-my $p2 = MooseX::Semantic::Test::BackendPerson->new_from_store( $rdf_about_uri );
-# warn Dumper $p2;
-is($p->name, $p2->name, 'Backend Person can be round-tripped');
-
-done_testing;

File t/role_rdfexport.t

-use Test::More tests=>10;
-use Test::Moose;
-use RDF::Trine qw(blank);
-use Data::Dumper;
-use MooseX::Semantic::Test::Person;
-use File::Temp qw( tempfile );
-
-sub basic_export {
-    my $toby = MooseX::Semantic::Test::Person->new(
-        rdf_about => 'http://tobyinkster.co.uk/#i',
-        name => 'Toby Inkster',
-        country => 'UK',
-        subjects => ['perl'],
-    );
-    my $greg = MooseX::Semantic::Test::Person->new(
-        rdf_about => 'http://kasei.us/about/foaf.xrdf#greg',
-        name => 'Gregory Williams',
-        country => 'USA',
-        favorite_numer => 3,
-        friends => [ $toby ],
-    );
-    my $model = $greg->export_to_model;
-    isa_ok($model, 'RDF::Trine::Model');
-    ok($model->size == 9, 'generated 9 statments');
-    # warn Dumper $model->size;
-    # warn Dumper $model;
-    ok(my $model_as_string = $greg->export_to_string(format=>'ntriples'), 'export_to_string works');
-    # warn Dumper $model_as_string;
-
-    my ( $fh, $fname ) = tempfile;
-    ok( $greg->export_to_file( $fh, format=>'ntriples' ), 'export_to_file works');
-    close $fh;
-    # open $fh, "<", $fname;
-    my $fh_contents = do { local $/; open $fh, "<$fname"; <$fh> };
-    # close $fh;
-    is( $fh_contents, $model_as_string, 'File export and String export match');
-}
-
-sub basic_blank_node {
-    my $bob = MooseX::Semantic::Test::Person->new(
-        rdf_about => blank,
-        name => 'Bob',
-    );
-    my $alice = MooseX::Semantic::Test::Person->new(
-        rdf_about => blank,
-        name => 'Alice',
-    );
-    $bob->add_friend( $alice );
-    ok($bob->rdf_about->is_blank, 'Bob is blank');
-    ok($alice->rdf_about->is_blank, 'Alice is blank');
-    is($bob->get_friend(0), $alice, "Alice is Bob's friend");
-    ok(my $model = $bob->export_to_model, 'Can export Bob to model');
-    is($model->size, 5, 'Correct number of statements exported');
-}
-
-&basic_export;
-&basic_blank_node;
-# done_testing;

File t/role_rdfimport.t

-use Test::More;
-use Test::Moose;
-use RDF::Trine;
-use Data::Dumper;
-use MooseX::Semantic::Test::Person;
-use MooseX::Semantic::Test qw(ser ser_dump diff_models);
-
-
-sub import_from_ttl {
-    my $base_uri = 'http://tobyinkster.co.uk/#i';
-    my $test_model = RDF::Trine::Model->temporary_model;
-    RDF::Trine::Parser::Turtle->parse_file_into_model(
-        $base_uri,
-        't/data/toby_inkster.ttl',
-        $test_model,
-    );
-    my $person = MooseX::Semantic::Test::Person->new_from_model( $test_model, $base_uri );
-    ok (! $person->is_blank, "Toby isn't a blank node");
-    # warn Dumper $person;
-    ok(! ref $person->name, 'Single Value -> Str');
-    ok($person->name eq 'Toby Inkster', 'name attribute is set ');
-
-    is(ref $person->topic_interest, 'ARRAY', 'Multiple Values -> ArrayRef');
-    is(scalar(@{$person->topic_interest}), 2, 'All values are imported');
-
-    ok(! ref $person->country, 'Multiple values -> Str');
-    is($person->country, 'USA', 'country set to last value in Turtle syntax (weakly defined behaviour here)');
-
-    ok( ref $person->subjects eq 'ARRAY', 'Single Value -> ArrayRef');
-    is( $person->subjects->[0], 'homepage', 'subjects imported');
-
-    is( ref $person->friends,  'ARRAY', 'Single URI -> ArrayRef' );
-    is( $person->get_friend(0)->rdf_about->value, 'http://kasei.us/about/foaf.xrdf#greg', 'friends correctly detected');
-    ok( $person->get_friend(0)->is_resource, "Greg isn't a blank node");
-
-    isa_ok( ref $person->generic_one_to_one_relation,  'MooseX::Semantic::Test::Person', 'Single URI -> Resource Object' );
-    is( $person->generic_one_to_one_relation->rdf_about->uri, 'http://kasei.us/about/foaf.xrdf#greg', 'Object created');
-    ok( !  $person->generic_one_to_one_relation->is_blank,, "Greg isn't a blank node");
-
-    ok(my $got_model = $person->export_to_model);
-
-    my $test_model_str = ser_dump($test_model);
-    # my $got_model_str = ser->serialize_model_to_string($got_model);
-    # warn Dumper [$test_model_str, $got_model_str];
-    diff_models($test_model, $got_model);
-    my $old_size = $test_model->size;
-    my $new_size = $got_model;
-    TODO: {
-        cmp_ok($new_size, '>=', $old_size, 'Same number of statements after round-trip (sans information lost on multiple values)');
-    }
-}
-
-sub import_from_web {
-    my $base_uri = 'http://kasei.us/about/foaf.xrdf#greg';
-    my $model = MooseX::Semantic::Test::Person->new_from_web( $base_uri );
-}
-
-sub symmetrical_property {
-    my $base_uri = 'http://example.org/';
-    my $test_model = RDF::Trine::Model->temporary_model;
-    RDF::Trine::Parser::Turtle->parse_file_into_model(
-        $base_uri,
-        't/data/symmetrical_property.ttl',
-        $test_model,
-    );
-    ok( my $alice = MooseX::Semantic::Test::Person->new_from_model( $test_model, $base_uri . 'F' )
-        , 'Alice can be loaded from RDF');
-    ok( my $alice_model_str = $alice->export_to_string(format=>'ntriples') );
-    # warn Dumper $alice_model_str;
-}
-
-&import_from_ttl;
-&symmetrical_property;
-# &import_from_web;
-done_testing;

File t/role_rdfimport_blank_node.t

-use Test::More tests=>4;
-use RDF::Trine;
-use Data::Dumper;
-use MooseX::Semantic::Test::Person;
-
-my $model = RDF::Trine::Model->new;
-RDF::Trine::Parser::Turtle
-	->new
-	->parse_file_into_model('http://example.com/', 't/data/blank_node_01.ttl', $model);
-
-# warn Dumper $model;
-# my $serializer = RDF::Trine::Serializer->new('turtle');
-# warn Dumper $serializer->serialize_model_to_string($model);
-ok( my $alice = MooseX::Semantic::Test::Person->new_from_model($model, 'http://example.com/alice'), 'Alice is detected');
-ok( $alice->has_friends, 'Alice has a friend' );
-TODO: {
-    local $TODO = "recursive import NIH";
-    is( $alice->friends->[0]->name, Bob, "Alice's friend's name is Bob" );
-}
-ok( $alice->friends->[0]->is_blank, "Bob is a blank node" );
-# warn Dumper $alice;

File t/role_rdfimportall.t

-use Test::More tests => 5;
-use RDF::Trine;
-use MooseX::Semantic::Test::StrictPerson;
-
-my $model = RDF::Trine::Model->new;
-RDF::Trine::Parser::Turtle
-	->new
-	->parse_file_into_model('http://example.com/', 't/data/multiple_persons.ttl', $model);
-
-my @people = 
-	sort { $a->name cmp $b->name }
-	MooseX::Semantic::Test::StrictPerson->import_all_from_model($model);
-
-is(scalar @people, 4, "Correct number of people found.");
-is($people[0]->name, "Alice");
-is($people[1]->name, "Bob");
-is($people[2]->name, "Carol");
-is($people[3]->name, "Dave");
-

File t/trait.t

-#=======================================================================
-#         FILE:  trait.t
-#  DESCRIPTION:  
-#       AUTHOR:  Konstantin Baierer (kba), konstantin.baierer@gmail.com
-#      CREATED:  11/22/2011 11:38:36 PM
-#=======================================================================
-use strict;
-use warnings;
-use Test::More; 
-use Test::Moose;
-use Data::Dumper;
-use Scalar::Util qw(blessed);
-use MooseX::Semantic::Test::Person;
-use URI;
-
-sub person_with_rdfabout {
-    my $person = MooseX::Semantic::Test::Person->new(
-        rdf_about => 'http://some/person'
-    );
-    my $person_attr_name =  $person->meta->get_attribute('name');
-    does_ok( $person_attr_name, 'MooseX::Semantic::Meta::Attribute::Trait' );
-    can_ok( $person_attr_name, 'has_uri' );
-    ok( $person_attr_name->uri->uri eq 'http://xmlns.com/foaf/0.1/name', 'uri attribute matches');
-}
-sub person_blank {
-    my $person = MooseX::Semantic::Test::Person->new;
-    my $person_attr_name =  $person->meta->get_attribute('name');
-    does_ok( $person_attr_name, 'MooseX::Semantic::Meta::Attribute::Trait' );
-    can_ok( $person_attr_name, 'has_uri' );
-    is( $person_attr_name->uri->uri, 'http://xmlns.com/foaf/0.1/name', 'uri attribute matches');
-    # warn Dumper $person;
-    # warn Dumper $person->rdf_about;
-    # warn Dumper $person;
-}
-# warn Dumper  $person->meta->get_attribute('friends')->type_constraint;
-# warn Dumper  $person->meta->get_attribute('name')->type_constraint;
-# warn Dumper blessed( 1);
-# warn Dumper( URI->new('bla')
-# );
-
-&person_with_rdfabout;
-&person_blank;
-
-
-
-done_testing;

File t/trait_semantic/trait.t

+#=======================================================================
+#         FILE:  trait.t
+#  DESCRIPTION:  
+#       AUTHOR:  Konstantin Baierer (kba), konstantin.baierer@gmail.com
+#      CREATED:  11/22/2011 11:38:36 PM
+#=======================================================================
+use strict;
+use warnings;
+use Test::More; 
+use Test::Moose;
+use Data::Dumper;
+use Scalar::Util qw(blessed);
+use MooseX::Semantic::Test::Person;
+use URI;
+
+sub person_with_rdfabout {
+    my $person = MooseX::Semantic::Test::Person->new(
+        rdf_about => 'http://some/person'
+    );
+    my $person_attr_name =  $person->meta->get_attribute('name');
+    does_ok( $person_attr_name, 'MooseX::Semantic::Meta::Attribute::Trait' );
+    can_ok( $person_attr_name, 'has_uri' );
+    ok( $person_attr_name->uri->uri eq 'http://xmlns.com/foaf/0.1/name', 'uri attribute matches');
+}
+sub person_blank {
+    my $person = MooseX::Semantic::Test::Person->new;
+    my $person_attr_name =  $person->meta->get_attribute('name');
+    does_ok( $person_attr_name, 'MooseX::Semantic::Meta::Attribute::Trait' );
+    can_ok( $person_attr_name, 'has_uri' );
+    is( $person_attr_name->uri->uri, 'http://xmlns.com/foaf/0.1/name', 'uri attribute matches');
+    # warn Dumper $person;
+    # warn Dumper $person->rdf_about;
+    # warn Dumper $person;
+}
+# warn Dumper  $person->meta->get_attribute('friends')->type_constraint;
+# warn Dumper  $person->meta->get_attribute('name')->type_constraint;
+# warn Dumper blessed( 1);
+# warn Dumper( URI->new('bla')
+# );
+
+&person_with_rdfabout;
+&person_blank;
+
+
+
+done_testing;

File t/types_uri.t

-use Test::More tests => 12;
-use Test::Moose;
-use RDF::Trine;
-use Data::Dumper;
-use MooseX::Semantic::Test::Person;
-
-sub round_trip {
-my $tbl_uri = 'http://www.w3.org/People/Berners-Lee/card#i';
-my $pers_cls = 'MooseX::Semantic::Test::Person';
-my $some_data = "SOME_DATA";
-my %tbl = (
-    from_default => $pers_cls->new,
-    from_string => $pers_cls->new( rdf_about => $tbl_uri ),
-    from_uri => $pers_cls->new( rdf_about => URI->new($tbl_uri) ),
-    from_node => $pers_cls->new( rdf_about => RDF::Trine::Node::Resource->new($tbl_uri)),
-    from_scalarref => $pers_cls->new( rdf_about => \$some_data ),
-    from_hash => $pers_cls->new( rdf_about => {
-            path => '/People/Berners-Lee/card',
-            host => 'www.w3.org',
-            scheme => 'http',
-            fragment => 'i',
-    }),
-);
-for (qw(from_string from_uri from_node from_hash)) {
-    isa_ok($tbl{$_}->rdf_about, RDF::Trine::Node::Resource);
-    is($tbl{$_}->rdf_about->uri, $tbl_uri, "URI $_ can be round-tripped");
-}
-for (qw(from_scalarref)) {
-    isa_ok($tbl{$_}->rdf_about, RDF::Trine::Node::Resource);
-    is($tbl{$_}->rdf_about->uri, "data:,SOME_DATA", "URI $_ can be round-tripped");
-}
-for (qw(from_default)) {
-    isa_ok($tbl{$_}->rdf_about, RDF::Trine::Node::Resource);
-    like($tbl{$_}->rdf_about->uri, qr/^urn:uuid:/, "URN::UUID is URL ");
-}
-}
-
-sub dynamic_has {
-    {
-        package Foaf;
-        use Moose;
-        my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
-        has $_ => (
-            traits => ['Semantic'],
-            is => 'rw',
-            uri => $foaf->$_
-        ) foreach (qw/name homepage mbox phone/);
-    }
-    my $f = Foaf->new(
-        name => 'Foo Bar',
-        homepage => 'http://foo.bar',
-        mbox => 'foo@bar',
-        phone => '555-FOOBAR'
-    );
-    my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
-    is($f->meta->get_attribute('name')->uri, $foaf->name->uri_value, 'Foaf->name has uri foaf:name');
-    # warn Dumper 
-}
-
-# sub round_trip_blank_node {
-#     my $tbl_uri = 'http://www.w3.org/People/Berners-Lee/card#i';
-#     my $pers_cls = 'MooseX::Semantic::Test::Person';
-#     my $some_data = "SOME_DATA";
-#     my %tbl = (
-#         from_default => $pers_cls->new,
-#         from_string => $pers_cls->new( rdf_about => blank),
-#     );
-#     for (qw(from_string from_uri from_node from_hash)) {
-#         ok($tbl{$_}->is_blank_node, "$_ is blank node");
-#         isnt($tbl{$_}->rdf_about, $tbl_uri, "URI has been replaced with UUID since it's a blank node");
-#         # is($tbl{$_}->rdf_about->as_string, $tbl_uri, "URI $_ can be round-tripped");
-#     }
-#     for (qw(from_scalarref)) {
-#         # isa_ok($tbl{$_}->rdf_about, URI);
-#         # is($tbl{$_}->rdf_about->as_string, "data:,SOME_DATA", "URI $_ can be round-tripped");
-#     }
-#     for (qw(from_default)) {
-#         # isa_ok($tbl{$_}->rdf_about, URI);
-#         # like($tbl{$_}->rdf_about->as_string, qr/^urn:uuid:/, "URN::UUID is URL ");
-#     }
-# }
-
-&round_trip;
-# &round_trip_blank_node;
-# &dynamic_has;
-
-# $tbl= 
-# isa_ok($tbl->rdf_about, URI);
-# $tbl= MooseX::Semantic::Test::Person->new( rdf_about => URI->new('http://www.w3.org/People/Berners-Lee/card#i') );
-# isa_ok($tbl->rdf_about, URI);
-# warn Dumper $tbl->rdf_about->isa('URI');
-# &basic_export;
-# done_testing;

File t/util/coercions.t

+use Test::More tests => 12;
+use Test::Moose;
+use RDF::Trine;
+use Data::Dumper;
+use MooseX::Semantic::Test::Person;
+
+sub round_trip {
+my $tbl_uri = 'http://www.w3.org/People/Berners-Lee/card#i';
+my $pers_cls = 'MooseX::Semantic::Test::Person';
+my $some_data = "SOME_DATA";
+my %tbl = (
+    from_default => $pers_cls->new,
+    from_string => $pers_cls->new( rdf_about => $tbl_uri ),
+    from_uri => $pers_cls->new( rdf_about => URI->new($tbl_uri) ),
+    from_node => $pers_cls->new( rdf_about => RDF::Trine::Node::Resource->new($tbl_uri)),
+    from_scalarref => $pers_cls->new( rdf_about => \$some_data ),
+    from_hash => $pers_cls->new( rdf_about => {
+            path => '/People/Berners-Lee/card',
+            host => 'www.w3.org',
+            scheme => 'http',
+            fragment => 'i',
+    }),
+);
+for (qw(from_string from_uri from_node from_hash)) {
+    isa_ok($tbl{$_}->rdf_about, RDF::Trine::Node::Resource);
+    is($tbl{$_}->rdf_about->uri, $tbl_uri, "URI $_ can be round-tripped");
+}
+for (qw(from_scalarref)) {
+    isa_ok($tbl{$_}->rdf_about, RDF::Trine::Node::Resource);
+    is($tbl{$_}->rdf_about->uri, "data:,SOME_DATA", "URI $_ can be round-tripped");
+}
+for (qw(from_default)) {
+    isa_ok($tbl{$_}->rdf_about, RDF::Trine::Node::Resource);
+    like($tbl{$_}->rdf_about->uri, qr/^urn:uuid:/, "URN::UUID is URL ");
+}
+}
+
+sub dynamic_has {
+    {
+        package Foaf;
+        use Moose;
+        my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
+        has $_ => (
+            traits => ['Semantic'],
+            is => 'rw',
+            uri => $foaf->$_
+        ) foreach (qw/name homepage mbox phone/);
+    }
+    my $f = Foaf->new(
+        name => 'Foo Bar',
+        homepage => 'http://foo.bar',
+        mbox => 'foo@bar',
+        phone => '555-FOOBAR'
+    );
+    my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/');
+    is($f->meta->get_attribute('name')->uri, $foaf->name->uri_value, 'Foaf->name has uri foaf:name');
+    # warn Dumper 
+}
+
+# sub round_trip_blank_node {
+#     my $tbl_uri = 'http://www.w3.org/People/Berners-Lee/card#i';
+#     my $pers_cls = 'MooseX::Semantic::Test::Person';
+#     my $some_data = "SOME_DATA";
+#     my %tbl = (
+#         from_default => $pers_cls->new,
+#         from_string => $pers_cls->new( rdf_about => blank),
+#     );
+#     for (qw(from_string from_uri from_node from_hash)) {
+#         ok($tbl{$_}->is_blank_node, "$_ is blank node");
+#         isnt($tbl{$_}->rdf_about, $tbl_uri, "URI has been replaced with UUID since it's a blank node");
+#         # is($tbl{$_}->rdf_about->as_string, $tbl_uri, "URI $_ can be round-tripped");
+#     }
+#     for (qw(from_scalarref)) {
+#         # isa_ok($tbl{$_}->rdf_about, URI);
+#         # is($tbl{$_}->rdf_about->as_string, "data:,SOME_DATA", "URI $_ can be round-tripped");
+#     }
+#     for (qw(from_default)) {
+#         # isa_ok($tbl{$_}->rdf_about, URI);
+#         # like($tbl{$_}->rdf_about->as_string, qr/^urn:uuid:/, "URN::UUID is URL ");
+#     }
+# }
+
+&round_trip;
+# &round_trip_blank_node;
+# &dynamic_has;
+
+# $tbl= 
+# isa_ok($tbl->rdf_about, URI);
+# $tbl= MooseX::Semantic::Test::Person->new( rdf_about => URI->new('http://www.w3.org/People/Berners-Lee/card#i') );
+# isa_ok($tbl->rdf_about, URI);
+# warn Dumper $tbl->rdf_about->isa('URI');
+# &basic_export;
+# done_testing;

File t/util/util_walker.t

+use Test::More tests => 5;
+use Data::Dumper;
+use RDF::Trine qw(iri);
+use MooseX::Semantic::Test::Person;
+use MooseX::Semantic::Util::TypeConstraintWalker;
+
+sub simple_type_walker {
+    {
+        package Foo;
+        use Moose;
+        with 'MooseX::Semantic::Util::TypeConstraintWalker';
+        has val => (
+            is => 'rw',
+            isa => 'ArrayRef[HashRef[Str]]',
+        );
+        1;
+    }
+    my $f = Foo->new;
+    # by attr
+    ok( ! $f->_find_parent_type( $f->meta->get_attribute('val'), 'RefXYZ' ), 'Invalid Type') ;
+    ok( $f->_find_parent_type( $f->meta->get_attribute('val'), 'Ref' ), 'Reference') ;
+    # by type_constraint
+    ok( $f->_find_parent_type( $f->meta->get_attribute('val')->type_constraint, 'Ref' ), 'Reference') ;
+    # by object and attr_name
+    ok( $f->_find_parent_type( 'val', 'Ref' ), 'Reference') ;
+    # warn Dumper $f->_find_parent_type( $f->meta->get_attribute('val'), 'RefZ' );
+}
+
+sub class_name_finder {
+    {
+        package Bar;
+        use Moose;
+        use Moose::Util::TypeConstraints;
+        
+        subtype 'SpecialResource',
+            as 'MooseX::Semantic::Test::Person';
+        subtype 'ArrayOfSpecialResources',
+
+            as 'ArrayRef[SpecialResource]';
+
+        with 'MooseX::Semantic::Util::TypeConstraintWalker';
+        has val => (
+            is => 'rw',
+            isa => 'ArrayOfSpecialResources',
+        );
+        1;
+    }
+
+    my $b = Bar->new( val => [MooseX::Semantic::Test::Person->new] );
+    my $does_resource = sub {my $a= shift;$a->can('does') && $a->does('MooseX::Semantic::Role::Resource'); };
+
+    is ($b->_find_parent_type('val', $does_resource, look_vertically => 1), 'MooseX::Semantic::Test::Person');
+    # warn Dumper $does_resource->("MooseX::Semantic::Test::Person");
+    # warn Dumper "MooseX::Semantic::Test::Person"->does('MooseX::Semantic::Role::Resource');
+    # warn Dumper $b;
+    # warn Dumper keys %{$b->meta->get_attribute('val')->type_constraint};
+}
+
+
+&simple_type_walker
+&class_name_finder;

File t/util_walker.t

-use Test::More tests => 5;
-use Data::Dumper;
-use RDF::Trine qw(iri);
-use MooseX::Semantic::Test::Person;
-use MooseX::Semantic::Util::TypeConstraintWalker;
-
-sub simple_type_walker {
-    {
-        package Foo;
-        use Moose;
-        with 'MooseX::Semantic::Util::TypeConstraintWalker';
-        has val => (
-            is => 'rw',
-            isa => 'ArrayRef[HashRef[Str]]',
-        );
-        1;
-    }
-    my $f = Foo->new;
-    # by attr
-    ok( ! $f->_find_parent_type( $f->meta->get_attribute('val'), 'RefXYZ' ), 'Invalid Type') ;
-    ok( $f->_find_parent_type( $f->meta->get_attribute('val'), 'Ref' ), 'Reference') ;
-    # by type_constraint
-    ok( $f->_find_parent_type( $f->meta->get_attribute('val')->type_constraint, 'Ref' ), 'Reference') ;
-    # by object and attr_name
-    ok( $f->_find_parent_type( 'val', 'Ref' ), 'Reference') ;
-    # warn Dumper $f->_find_parent_type( $f->meta->get_attribute('val'), 'RefZ' );
-}
-
-sub class_name_finder {
-    {
-        package Bar;
-        use Moose;
-        use Moose::Util::TypeConstraints;
-        
-        subtype 'SpecialResource',
-            as 'MooseX::Semantic::Test::Person';
-        subtype 'ArrayOfSpecialResources',
-
-            as 'ArrayRef[SpecialResource]';
-
-        with 'MooseX::Semantic::Util::TypeConstraintWalker';
-        has val => (
-            is => 'rw',
-            isa => 'ArrayOfSpecialResources',
-        );
-        1;
-    }
-
-    my $b = Bar->new( val => [MooseX::Semantic::Test::Person->new] );
-    my $does_resource = sub {my $a= shift;$a->can('does') && $a->does('MooseX::Semantic::Role::Resource'); };
-
-    is ($b->_find_parent_type('val', $does_resource, look_vertically => 1), 'MooseX::Semantic::Test::Person');
-    # warn Dumper $does_resource->("MooseX::Semantic::Test::Person");
-    # warn Dumper "MooseX::Semantic::Test::Person"->does('MooseX::Semantic::Role::Resource');
-    # warn Dumper $b;
-    # warn Dumper keys %{$b->meta->get_attribute('val')->type_constraint};
-}
-
-
-&simple_type_walker
-&class_name_finder;