| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# Copyright (c) 2004-2006 IBM Corporation. |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# All rights reserved. This program and the accompanying materials |
|
5
|
|
|
|
|
|
|
# are made available under the terms of the Eclipse Public License v1.0 |
|
6
|
|
|
|
|
|
|
# which accompanies this distribution, and is available at |
|
7
|
|
|
|
|
|
|
# http://www.eclipse.org/legal/epl-v10.html |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# File: $Source: /var/lib/cvs/ODO/lib/ODO/Parser.pm,v $ |
|
10
|
|
|
|
|
|
|
# Created by: Stephen Evanchik( evanchik@us.ibm.com ) |
|
11
|
|
|
|
|
|
|
# Created on: 10/05/2004 |
|
12
|
|
|
|
|
|
|
# Revision: $Id: Parser.pm,v 1.7 2009-11-25 17:46:52 ubuntu Exp $ |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# Contributors: |
|
15
|
|
|
|
|
|
|
# IBM Corporation - initial API and implementation |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
package ODO::Parser; |
|
18
|
|
|
|
|
|
|
|
|
19
|
7
|
|
|
7
|
|
34086
|
use strict; |
|
|
7
|
|
|
|
|
13
|
|
|
|
7
|
|
|
|
|
277
|
|
|
20
|
7
|
|
|
7
|
|
38
|
use warnings; |
|
|
7
|
|
|
|
|
12
|
|
|
|
7
|
|
|
|
|
204
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
7
|
|
|
7
|
|
548
|
use ODO::Exception; |
|
|
7
|
|
|
|
|
12
|
|
|
|
7
|
|
|
|
|
379
|
|
|
23
|
7
|
|
|
7
|
|
2442
|
use ODO::Node; |
|
|
7
|
|
|
|
|
21
|
|
|
|
7
|
|
|
|
|
356
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
7
|
|
|
7
|
|
35
|
use vars qw /$VERSION/; |
|
|
7
|
|
|
|
|
20
|
|
|
|
7
|
|
|
|
|
581
|
|
|
26
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /: (\d+)\.(\d+)/; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use XML::Namespace |
|
29
|
7
|
|
|
7
|
|
7628
|
rdf=> 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; |
|
|
7
|
|
|
|
|
5091
|
|
|
|
7
|
|
|
|
|
39
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
7
|
|
|
7
|
|
1278
|
use base qw/ODO/; |
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
1137
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our @__EXPORTED_RDF_NODES = qw/$REIFY_SUBJECT $REIFY_PREDICATE $REIFY_OBJECT $REIFY_STATEMENT $RDF_TYPE $RDF_NIL $RDF_FIRST $RDF_REST $RDF_LIST/; |
|
34
|
|
|
|
|
|
|
our @EXPORT_OK = @__EXPORTED_RDF_NODES; |
|
35
|
|
|
|
|
|
|
our %EXPORT_TAGS = (RDF_NODES => [ @__EXPORTED_RDF_NODES ] ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
ODO::Parser - Generic parser interface for ODO RDF Parsers |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
44
|
|
|
|
|
|
|
use ODO::Parser::XML; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $statements = ODO::Parser::XML->parse_file('some/path/to/data.rdfxml'); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $rdf = ' ... rdf xml here ... '; |
|
49
|
|
|
|
|
|
|
my $other_statements = ODO::Parser::XML->parse(\$rdf); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This specifies the base interface for parsing RDF in ODO. RDF parsers must support the two |
|
54
|
|
|
|
|
|
|
functions defined here: parse and parse_file. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=over |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item parse( $rdf_text | \$rdf_text ) |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Parse RDF from the scalar or scalarref parameter. An arrayref of L objects |
|
63
|
|
|
|
|
|
|
will be returned. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item parse_file( $filename ) |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Parse RDF from the file parameter. An arrayref of L objects |
|
68
|
|
|
|
|
|
|
will be returned. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
7
|
|
|
|
|
79
|
use Class::Interfaces('ODO::Parser'=> |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
|
|
|
|
|
|
'isa'=> 'ODO', |
|
75
|
|
|
|
|
|
|
'methods'=> [ 'parse', 'parse_file' ], |
|
76
|
|
|
|
|
|
|
} |
|
77
|
7
|
|
|
7
|
|
3810
|
); |
|
|
7
|
|
|
|
|
3043
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw//); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
our $REIFY_SUBJECT = ODO::Node::Resource->new(rdf->uri('subject')); |
|
82
|
|
|
|
|
|
|
our $REIFY_PREDICATE = ODO::Node::Resource->new(rdf->uri('predicate')); |
|
83
|
|
|
|
|
|
|
our $REIFY_OBJECT = ODO::Node::Resource->new(rdf->uri('object')); |
|
84
|
|
|
|
|
|
|
our $REIFY_STATEMENT = ODO::Node::Resource->new(rdf->uri('statement')); |
|
85
|
|
|
|
|
|
|
our $RDF_TYPE = ODO::Node::Resource->new(rdf->uri('type')); |
|
86
|
|
|
|
|
|
|
our $RDF_NIL = ODO::Node::Resource->new(rdf->uri('nil')); |
|
87
|
|
|
|
|
|
|
our $RDF_FIRST = ODO::Node::Resource->new(rdf->uri('first')); |
|
88
|
|
|
|
|
|
|
our $RDF_REST = ODO::Node::Resource->new(rdf->uri('rest')); |
|
89
|
|
|
|
|
|
|
our $RDF_LIST = ODO::Node::Resource->new(rdf->uri('List')); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Copyright (c) 2006 IBM Corporation. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
All rights reserved. This program and the accompanying materials |
|
98
|
|
|
|
|
|
|
are made available under the terms of the Eclipse Public License v1.0 |
|
99
|
|
|
|
|
|
|
which accompanies this distribution, and is available at |
|
100
|
|
|
|
|
|
|
http://www.eclipse.org/legal/epl-v10.html |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |