Commits

Konstantin Baierer  committed 6867d3f

fixed that stupid cls/self bug (was in TypeConstraintWalker)

  • Participants
  • Parent commits 412d116

Comments (0)

Files changed (4)

File lib/MooseX/Semantic/Role/Graph.pm

 
 sub add_statement_smartly {
     my $self = shift;
-    # warn Dumper [$_[1]];
     my @args = @_;
-    # $args[1] = $ns->uri($args[1]) unless blessed $args[1];
-    # $args[0] = iri $args[0] unless blessed $args[0];
-    # $args[1] = iri $args[1] unless blessed $args[1];
-    # $args[2] = literal($args[2]) unless blessed $args[2];
+
     $args[0] = TrineResource->coerce($args[0]);
     $args[1] = TrineResource->coerce($args[1]);
     $args[2] = TrineLiteral->coerce($args[2]);

File lib/MooseX/Semantic/Role/RdfImport.pm

             # warn Dumper "I LIVE";
             my $graph_model = TrineModel->coerce;
             # while (my $stmt = $model->get_statements(undef,undef,undef)) {
-            warn Dumper $stash;
+            # warn Dumper $stash;
             while (my $stmt = $stash->{statement_iterator}->next){
                 # warn Dumper $stmt;
-                # $graph_model->add_statement(statement( $stmt->[0], $stmt->[1], $stmt->[2] ));
+                $graph_model->add_statement(statement( $stmt->[0], $stmt->[1], $stmt->[2] ));
             }
-            warn Dumper $inst_hash;
+            # warn Dumper $inst_hash;
             $inst_hash->{$attr->name} = $graph_model;
         },
         resource => sub {

File lib/MooseX/Semantic/Util/TypeConstraintWalker.pm

         {
             $callback_name = 'resource';
             # warn Dumper keys(%{ $attr->type_constraint->{__type_constraint} });
-            if ( $self->$attr_name->isa('RDF::Trine::Model')
-                || $self->_find_parent_type( $attr, 'RDF::Trine::Model' 
+            if ( 
+                # $self->$attr_name->isa('RDF::Trine::Model')
+                $self->_find_parent_type( $attr, 'RDF::Trine::Model' 
                 # || $attr->uri->as_string eq '<http://moosex-semantic.org/onto#rdf_graph>'
                 )
                 # || $self->uri eq 'http:
             ) {
-                warn "It's amodel";
+                # warn "It's amodel";
                 $callback_name = 'model';
             }
         }

File t/rdf_export/graph.t

 use Test::Most tests => 3;
 use RDF::Trine qw(iri statement);
 use Data::Dumper;
+use Scalar::Util qw(refaddr);
 
 {
     package GraphPackage;
 my $g_model = $g->export_to_model;
 my $g2 = GraphPackage->new_from_model($g_model, $g->rdf_about);
 # warn Dumper $g2->rdf_graph->get_statements->next;
-# ok($g2->get_statements->next);
+ok($g2->get_statements->next);
+
+# warn Dumper $g->export_to_string(format=>'nquads');
+# warn Dumper $g2->export_to_string(format=>'nquads');
+is($g->export_to_string(format=>'nquads'), $g2->export_to_string(format=>'nquads') );
+isnt(refaddr $g, refaddr $g2);
+isnt(refaddr $g->rdf_graph, refaddr $g2->rdf_graph);