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.pm,v $ |
10
|
|
|
|
|
|
|
# Created by: Stephen Evanchik( evanchik@us.ibm.com ) |
11
|
|
|
|
|
|
|
# Created on: 10/05/2004 |
12
|
|
|
|
|
|
|
# Revision: $Id: ODO.pm,v 1.7 2010-05-20 17:34:48 ubuntu Exp $ |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# Contributors: |
15
|
|
|
|
|
|
|
# IBM Corporation - initial API and implementation |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
package ODO; |
18
|
|
|
|
|
|
|
|
19
|
19
|
|
|
19
|
|
51296
|
use strict; |
|
19
|
|
|
|
|
36
|
|
|
19
|
|
|
|
|
1199
|
|
20
|
19
|
|
|
19
|
|
104
|
use warnings; |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
892
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.27'; |
23
|
|
|
|
|
|
|
|
24
|
19
|
|
|
19
|
|
130
|
use base qw/Exporter Class::Base Class::Accessor::Fast Class::ParamParser/; |
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
22923
|
|
25
|
|
|
|
|
|
|
|
26
|
19
|
|
|
19
|
|
240165
|
use Time::HiRes qw/gettimeofday tv_interval/; |
|
19
|
|
|
|
|
54084
|
|
|
19
|
|
|
|
|
129
|
|
27
|
19
|
|
|
19
|
|
5467
|
use Digest::MD5 qw/md5_hex/; |
|
19
|
|
|
|
|
57
|
|
|
19
|
|
|
|
|
3081
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT = qw//; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=pod |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
ODO - Ontologies, Databases and, Optimization |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use ODO::Parser::XML; |
40
|
|
|
|
|
|
|
use ODO::Graph::Simple; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
print "Parsing RDF/XML file: 'some/path/to/data.rdfxml'\n"n |
43
|
|
|
|
|
|
|
my $statements = ODO::Parser::XML->parse_file('some/path/to/data.rdfxml'); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
print "Creating in memory graph named: 'http://testuri.org/graphs/#name1'\n"; |
46
|
|
|
|
|
|
|
my $graph = ODO::Graph::Simple->Memory(name=> 'http://testuri.org/graphs/#name1'); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
print "Adding parsed statements to the graph\n"; |
49
|
|
|
|
|
|
|
$graph->add($statements); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
print 'The graph contains ', $graph->size(), " statements\n"; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# or $graph->add(@{ $statements }); if you are just adding a couple statements |
54
|
|
|
|
|
|
|
# and then... |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
print "Querying for all statements in the graph\n"; |
57
|
|
|
|
|
|
|
my $result_set = $graph->query($ODO::Query::Simple::ALL_STATEMENTS); |
58
|
|
|
|
|
|
|
my $result_statements = $result_set->results(); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
print "Removing statements found in previous query from the graph\n"; |
61
|
|
|
|
|
|
|
$graph->remove($result_statements); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
print "The graph's size should be 0. Its size is: ", $graph->size(), "\n"; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
ODO is a framework for processing RDF data. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 CAVEATS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This package contains relatively experimental code and should be treated appropriately. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
IBM Corporation |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SEE ALSO |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L, L, L, L, L, L, L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Copyright (c) 2004-2006 IBM Corporation. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
All rights reserved. This program and the accompanying materials |
86
|
|
|
|
|
|
|
are made available under the terms of the Eclipse Public License v1.0 |
87
|
|
|
|
|
|
|
which accompanies this distribution, and is available at |
88
|
|
|
|
|
|
|
http://www.eclipse.org/legal/epl-v10.html |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |