File Coverage

blib/lib/ODO/Query/RDQL.pm
Criterion Covered Total %
statement 25 31 80.6
branch 0 2 0.0
condition n/a
subroutine 6 7 85.7
pod 2 2 100.0
total 33 42 78.5


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/Query/RDQL.pm,v $
10             # Created by: Stephen Evanchik( evanchik@us.ibm.com )
11             # Created on: 12/01/2004
12             # Revision: $Id: RDQL.pm,v 1.2 2009-11-25 17:53:53 ubuntu Exp $
13             #
14             # Contributors:
15             # IBM Corporation - initial API and implementation
16             #
17             package ODO::Query::RDQL;
18              
19 1     1   1766 use strict;
  1         2  
  1         44  
20 1     1   7 use warnings;
  1         2  
  1         33  
21              
22 1     1   6 use ODO::Exception;
  1         3  
  1         54  
23 1     1   7 use vars qw /$VERSION/;
  1         3  
  1         104  
24             $VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /: (\d+)\.(\d+)/;
25              
26 1     1   14 use base qw/ODO/;
  1         2  
  1         442  
27              
28             __PACKAGE__->mk_accessors(qw/constraints/);
29             __PACKAGE__->mk_ro_accessors(qw/result_vars prefixes statement_patterns/);
30              
31              
32             =head1 NAME
33              
34             ODO::Query::RDQL - RDQL Query object
35              
36             =head1 SYNOPSIS
37              
38             Synopsis.
39              
40             =head1 DESCRIPTION
41              
42             Description.
43              
44             =head1 METHODS
45              
46             =over
47              
48             =item add_result_var( $variable )
49              
50             =cut
51              
52             sub add_result_var {
53 0     0 1 0 my ($self, $var) = @_;
54              
55 0 0       0 throw ODO::Exception::Parameter::Invalid(error=> 'Parameter must be an ODO::Node::Variable')
56             unless(UNIVERSAL::isa($var, 'ODO::Node::Variable'));
57            
58 0         0 $self->{'result_vars'}->{ $var->hash() } = $var;
59 0         0 push @{ $self->{'result_vars'}->{'#variables'} }, $var;
  0         0  
60            
61 0         0 return $self;
62             }
63              
64              
65             sub init {
66 2     2 1 718 my ($self, $config) = @_;
67            
68 2         25 $self->{'statement_patterns'} = {'#patterns'=> []};
69            
70 2         8 $self->{'constraints'} = [];
71 2         8 $self->{'result_vars'} = {'#variables'=> []};
72            
73 2         11 $self->{'prefixes'} = {};
74            
75             # Default prefixes
76 2         7 $self->{'prefixes'}->{'rdf'} = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
77 2         6 $self->{'prefixes'}->{'rdfs'} = 'http://www.w3.org/2000/01/rdf-schema#';
78 2         6 $self->{'prefixes'}->{'xsd'} = 'http://www.w3.org/2001/XMLSchema#';
79 2         6 $self->{'prefixes'}->{'owl'} = 'http://www.w3.org/2002/07/owl#';
80            
81 2         6 return $self;
82             }
83              
84              
85             =back
86              
87             =head1 AUTHOR
88              
89             IBM Corporation
90              
91             =head1 COPYRIGHT
92              
93             Copyright (c) 2004-2006 IBM Corporation.
94              
95             All rights reserved. This program and the accompanying materials
96             are made available under the terms of the Eclipse Public License v1.0
97             which accompanies this distribution, and is available at
98             http://www.eclipse.org/legal/epl-v10.html
99              
100             =cut
101              
102             1;
103              
104             __END__