File Coverage

blib/lib/ODO/Ontology/RDFS/Vocabulary.pm
Criterion Covered Total %
statement 39 54 72.2
branch n/a
condition n/a
subroutine 10 11 90.9
pod 1 1 100.0
total 50 66 75.7


line stmt bran cond sub pod time code
1             #
2             # Copyright (c) 2005-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/Ontology/RDFS/Vocabulary.pm,v $
10             # Created by: Stephen Evanchik( evanchik@us.ibm.com )
11             # Created on: 03/02/2005
12             # Revision: $Id: Vocabulary.pm,v 1.7 2009-11-25 17:58:26 ubuntu Exp $
13             #
14             # Contributors:
15             # IBM Corporation - initial API and implementation
16             #
17             package ODO::Ontology::RDFS::Vocabulary;
18              
19 3     3   16 use strict;
  3         6  
  3         103  
20 3     3   16 use warnings;
  3         5  
  3         95  
21              
22 3     3   15 use ODO::Node;
  3         6  
  3         110  
23              
24 3     3   15 use base qw/ODO::Ontology::Vocabulary/;
  3         4  
  3         1403  
25              
26 3     3   18 use vars qw /$VERSION/;
  3         5  
  3         184  
27             $VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /: (\d+)\.(\d+)/;
28              
29             use XML::Namespace
30 3         25 rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
31 3     3   696 rdfs => 'http://www.w3.org/2000/01/rdf-schema#';
  3         563  
32              
33             our $RDF = rdf->uri();
34             our $RDFS = rdfs->uri();
35              
36             our $RDF_METHODS;
37             our $RDFS_METHODS;
38              
39             our $RDFS_SCHEMA_DATA=<
40            
53            
54             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
55             xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
56             xmlns:owl="http://www.w3.org/2002/07/owl#">
57              
58            
59              
60            
61            
62             Resource
63             The class resource, everything.
64            
65              
66            
67            
68             type
69             The subject is an instance of a class.
70            
71            
72            
73              
74            
75            
76             Class
77             The class of classes.
78            
79            
80              
81            
82            
83             subClassOf
84             The subject is a subclass of a class.
85            
86            
87            
88              
89            
90            
91             subPropertyOf
92             The subject is a subproperty of a property.
93            
94            
95            
96              
97            
98            
99             Property
100             The class of RDF properties.
101            
102            
103              
104            
105            
106             comment
107             A description of the subject resource.
108            
109            
110            
111              
112            
113            
114             label
115             A human-readable name for the subject.
116            
117            
118            
119              
120            
121            
122             domain
123             A domain of the subject property.
124            
125            
126            
127              
128            
129            
130             range
131             A range of the subject property.
132            
133            
134            
135              
136            
137            
138             seeAlso
139             Further information about the subject resource.
140            
141            
142            
143              
144            
145            
146            
147             isDefinedBy
148             The defininition of the subject resource.
149            
150            
151            
152              
153            
154            
155             Literal
156             The class of literal values, eg. textual strings and integers.
157            
158            
159              
160            
161            
162             Statement
163            
164             The class of RDF statements.
165            
166              
167            
168            
169             subject
170             The subject of the subject RDF statement.
171            
172            
173            
174              
175            
176            
177             predicate
178             The predicate of the subject RDF statement.
179            
180            
181            
182              
183            
184            
185             object
186             The object of the subject RDF statement.
187            
188            
189            
190              
191            
192            
193             Container
194            
195             The class of RDF containers.
196            
197              
198            
199            
200             Bag
201             The class of unordered containers.
202            
203            
204              
205            
206            
207             Seq
208             The class of ordered containers.
209            
210            
211              
212            
213            
214             Alt
215             The class of containers of alternatives.
216            
217            
218              
219            
220            
221             ContainerMembershipProperty
222             The class of container membership properties, rdf:_1, rdf:_2, ...,
223             all of which are sub-properties of 'member'.
224            
225            
226              
227            
228            
229             member
230             A member of the subject resource.
231            
232            
233            
234              
235            
236            
237             value
238             Idiomatic property used for structured values.
239            
240            
241            
242              
243            
244              
245            
246            
247             List
248             The class of RDF Lists.
249            
250              
251            
252            
253             nil
254             The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it.
255            
256              
257            
258            
259             first
260             The first item in the subject RDF list.
261            
262            
263            
264              
265            
266            
267             rest
268             The rest of the subject RDF list after the first item.
269            
270            
271            
272              
273            
274            
275             Datatype
276             The class of RDF datatypes.
277            
278            
279            
280            
281            
282            
283             XMLLiteral
284             The class of XML literal values.
285            
286              
287            
288            
289            
290              
291            
292            
293             EOT
294              
295             sub BEGIN {
296            
297 3     3   21 $RDF_METHODS = [
298             # Classes
299             'XMLLiteral',
300             'Property',
301             'Statement',
302             'Bag',
303             'Seq',
304             'Alt',
305             'List',
306            
307             # Properties
308             'type',
309             'first',
310             'rest',
311             'nil',
312             'value',
313             'statement',
314             'subject',
315             'predicate',
316             'object',
317             ];
318              
319 3         18 $RDFS_METHODS = [
320             # Classes
321             'Resource',
322             'Literal',
323             'Class',
324             'Datatype',
325             'Container',
326            
327             # Properties
328             'subClassOf',
329             'subPropertyOf',
330             'domain',
331             'range',
332             'label',
333             'comment',
334             'member',
335             'seeAlso',
336             'isDefinedBy',
337             'ContainerMembershipProperty',
338             ];
339              
340 3     3   2573 no strict;
  3         111  
  3         101  
341 3     3   16 no warnings;
  3         808  
  3         1470  
342            
343             # RDF URIs
344 3         4 for my $field (@{ $RDF_METHODS }) {
  3         9  
345 48         95 my $name = __PACKAGE__ . "::$field";
346 48         100 ${ *$name } = ODO::Node::Resource->new(rdf->uri($field));
  48         477  
347             }
348            
349             # RDFS URIs
350 3         5 for my $field (@{ $RDFS_METHODS }) {
  3         7  
351 45         95 my $name = __PACKAGE__ . "::$field";
352 45         238 ${ *$name } = ODO::Node::Resource->new(rdfs->uri($field));
  45         672  
353             }
354             }
355              
356              
357             sub init {
358 0     0 1   my ($self, $config) = @_;
359 0           $self = $self->SUPER::init($config);
360            
361 3     3   30 no strict "refs";
  3         6  
  3         914  
362            
363 0           for my $field (@{ $RDF_METHODS }) {
  0            
364 0           $self->{'uri_map_table'}->{'names'}->{ rdf->uri($field) } = $field;
365 0           my $name = __PACKAGE__ . "::$field";
366 0           $self->{'uri_map_table'}->{'nodes'}->{ rdf->uri($field) } = ${ *$name };
  0            
367             }
368            
369 0           for my $field (@{ $RDFS_METHODS }) {
  0            
370 0           $self->{'uri_map_table'}->{'names'}->{ rdfs->uri($field) } = $field;
371 0           my $name = __PACKAGE__ . "::$field";
372 0           $self->{'uri_map_table'}->{'nodes'}->{ rdfs->uri($field) } = ${ *$name };
  0            
373             }
374            
375 0           return $self;
376             }
377              
378             1;
379              
380             __END__