| 24 |
my %opt = @_; |
my %opt = @_; |
| 25 |
my $dump_resource = sub { |
my $dump_resource = sub { |
| 26 |
my $resource = shift; |
my $resource = shift; |
| 27 |
if ($resource->{uri}) { |
if (defined $resource->{uri}) { |
| 28 |
return '<' . $resource->{uri} . '>'; |
return '<' . $resource->{uri} . '>'; |
| 29 |
} elsif ($resource->{bnodeid}) { |
} elsif (defined $resource->{bnodeid}) { |
| 30 |
return '_:' . $resource->{bnodeid}; |
return '_:' . $resource->{bnodeid}; |
| 31 |
} elsif ($resource->{nodes}) { |
} elsif ($resource->{nodes}) { |
| 32 |
return '"' . join ('', map {$_->inner_html} @{$resource->{nodes}}) . |
return '"' . join ('', map {$_->inner_html} @{$resource->{nodes}}) . |
| 43 |
print STDERR $dump_resource->($opt{subject}) . ' '; |
print STDERR $dump_resource->($opt{subject}) . ' '; |
| 44 |
print STDERR $dump_resource->($opt{predicate}) . ' '; |
print STDERR $dump_resource->($opt{predicate}) . ' '; |
| 45 |
print STDERR $dump_resource->($opt{object}) . "\n"; |
print STDERR $dump_resource->($opt{object}) . "\n"; |
| 46 |
|
if ($dump_resource->{id}) { |
| 47 |
|
print STDERR $dump_resource->($dump_resource->{id}) . ' '; |
| 48 |
|
print STDERR $dump_resource->({uri => $RDF_URI . 'subject'}) . ' '; |
| 49 |
|
print STDERR $dump_resource->($opt{subject}) . "\n"; |
| 50 |
|
print STDERR $dump_resource->($dump_resource->{id}) . ' '; |
| 51 |
|
print STDERR $dump_resource->({uri => $RDF_URI . 'predicate'}) . ' '; |
| 52 |
|
print STDERR $dump_resource->($opt{predicate}) . "\n"; |
| 53 |
|
print STDERR $dump_resource->($dump_resource->{id}) . ' '; |
| 54 |
|
print STDERR $dump_resource->({uri => $RDF_URI . 'object'}) . ' '; |
| 55 |
|
print STDERR $dump_resource->($opt{object}) . "\n"; |
| 56 |
|
print STDERR $dump_resource->($dump_resource->{id}) . ' '; |
| 57 |
|
print STDERR $dump_resource->({uri => $RDF_URI . 'type'}) . ' '; |
| 58 |
|
print STDERR $dump_resource->({uri => $RDF_URI . 'Statement'}) . "\n"; |
| 59 |
|
} |
| 60 |
}; |
}; |
| 61 |
return $self; |
return $self; |
| 62 |
} # new |
} # new |
| 360 |
$self->{ontriple}->(subject => $opt{subject}, |
$self->{ontriple}->(subject => $opt{subject}, |
| 361 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 362 |
object => $object, |
object => $object, |
| 363 |
node => $node); |
node => $node, |
| 364 |
## TODO: reification |
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
| 365 |
|
|
| 366 |
## As if nodeElement |
## As if nodeElement |
| 367 |
|
|
| 419 |
$self->{ontriple}->(subject => $opt{subject}, |
$self->{ontriple}->(subject => $opt{subject}, |
| 420 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 421 |
object => {uri => $RDF_URI . 'nil'}, |
object => {uri => $RDF_URI . 'nil'}, |
| 422 |
node => $node); |
node => $node, |
| 423 |
|
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
| 424 |
} |
} |
| 425 |
## TODO: reification |
|
|
|
|
| 426 |
while (@resource) { |
while (@resource) { |
| 427 |
my $resource = shift @resource; |
my $resource = shift @resource; |
| 428 |
$self->{ontriple}->(subject => $resource->[1], |
$self->{ontriple}->(subject => $resource->[1], |
| 461 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 462 |
object => {nodes => $value, |
object => {nodes => $value, |
| 463 |
datatype => $RDF_URI . 'XMLLiteral'}, |
datatype => $RDF_URI . 'XMLLiteral'}, |
| 464 |
node => $node); |
node => $node, |
| 465 |
## TODO: reification |
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
| 466 |
} else { |
} else { |
| 467 |
my $mode = 'unknown'; |
my $mode = 'unknown'; |
| 468 |
|
|
| 536 |
$self->{ontriple}->(subject => $opt{subject}, |
$self->{ontriple}->(subject => $opt{subject}, |
| 537 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 538 |
object => $object, |
object => $object, |
| 539 |
node => $node); |
node => $node, |
| 540 |
|
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
|
## TODO: reification |
|
| 541 |
} elsif ($mode eq 'literal' or $mode eq 'literal-or-resource') { |
} elsif ($mode eq 'literal' or $mode eq 'literal-or-resource') { |
| 542 |
# |literalPropertyElt| |
# |literalPropertyElt| |
| 543 |
|
|
| 556 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 557 |
object => {value => $text, |
object => {value => $text, |
| 558 |
datatype => $dt_attr->value}, |
datatype => $dt_attr->value}, |
| 559 |
node => $node); |
node => $node, |
| 560 |
|
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
| 561 |
} else { |
} else { |
| 562 |
$self->{ontriple}->(subject => $opt{subject}, |
$self->{ontriple}->(subject => $opt{subject}, |
| 563 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 564 |
object => {value => $text, |
object => {value => $text, |
| 565 |
## TODO: language |
## TODO: language |
| 566 |
}, |
}, |
| 567 |
node => $node); |
node => $node, |
| 568 |
|
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
| 569 |
} |
} |
|
|
|
|
## TODO: reification |
|
| 570 |
} else { |
} else { |
| 571 |
## |emptyPropertyElt| |
## |emptyPropertyElt| |
| 572 |
|
|
| 584 |
object => {value => '', |
object => {value => '', |
| 585 |
## TODO: language |
## TODO: language |
| 586 |
}, |
}, |
| 587 |
node => $node); |
node => $node, |
| 588 |
|
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
|
## TODO: reification |
|
| 589 |
} else { |
} else { |
| 590 |
my $object; |
my $object; |
| 591 |
if ($resource_attr) { |
if ($resource_attr) { |
| 617 |
$self->{ontriple}->(subject => $opt{subject}, |
$self->{ontriple}->(subject => $opt{subject}, |
| 618 |
predicate => {uri => $xuri}, |
predicate => {uri => $xuri}, |
| 619 |
object => $object, |
object => $object, |
| 620 |
node => $node); |
node => $node, |
| 621 |
|
id => $id_attr ? {uri => '#' . $id_attr->value} : undef); ## TODO: resolve |
|
## TODO: reification |
|
| 622 |
} |
} |
| 623 |
} |
} |
| 624 |
} |
} |