This file is indexed.

/usr/share/perl5/GO/Handlers/owl.pm is in libgo-perl 0.13-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# stag-handle.pl -p GO::Parsers::GoOntParser -m <THIS> function/function.ontology

# $Id: owl.pm,v 1.5 2004/07/08 04:08:42 cmungall Exp $
#
# This GO module is maintained by Chris Mungall <cjm@fruitfly.org>
#
# see also - http://www.geneontology.org
#          - http://www.godatabase.org/dev
#
# You may distribute this module under the same terms as perl itself

=head1 NAME

  GO::Handlers::owl     - writes OWL 

=head1 SYNOPSIS

  use GO::Parser;
  my $p = GO::Parser->new({handler=>'owl'});
  $p->parse("function.ontology");

=head1 DESCRIPTION

Consumes an OBO-XML event stream and generates OWL XML

See the file

  go-dev/doc/mapping-obo-to-owl.txt

For more details

=head1 COMMAND LINE

go2fmt.pl -w owl function.obo

=cut


package GO::Handlers::owl;
use base qw(Data::Stag::Writer Exporter);
use XML::Writer;
use strict;

sub is_transform { 0 }

sub init {
    my $self = shift;
    $self->SUPER::init(@_);
    my $gen = XML::Writer->new(OUTPUT=>$self->safe_fh);
    $self->{writer} = $gen;

    $gen->setDataMode(1);
    $gen->setDataIndent(4);
}

sub s_obo {
    my $self = shift;

    $self->{writer}->xmlDecl("UTF-8");
#    $self->{writer}->doctype("owl:RDF", 
#			     '-//Gene Ontology//Custom XML/RDF Version 2.0//EN',
#			     'http://www.godatabase.org/dtd/go.dtd');
    $self->{writer}->startTag('rdf:RDF', 
			      'xmlns:rdf'=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
			      'xmlns:rdfs'=>"http://www.w3.org/2000/01/rdf-schema#",
			      'xmlns:owl'=>"http://www.w3.org/2002/07/owl#",

			      'xmlns'=>"http://www.geneontology.org/owl/obo/#",
			      'xmlns:obo'=>"http://www.geneontology.org/owl/obo/#",
			      'xml:base'=>"http://www.geneontology.org/owl/obo/",
			      'xmlns:dc'=>"http://purl.org/dc/elements/1.1/",
			     );
}

sub e_obo {
    my $self = shift;

    $self->{writer}->endTag('rdf:RDF');
}

sub w {
    shift->{writer}
}

sub e_term {
    my ($self, $term) = @_;
    my $id = $term->get_id || $self->throw($term->sxpr);
    my $w = $self->w;
    $id = rdfsafe($id);
    my $name_h = $self->{name_h};
    my $name = $term->get_name;
    $w->startTag('owl:Class', 'rdf:ID'=>$id);
    if ($name) {
	if (!$name_h) {
	    $name_h = {};
	    $self->{name_h} = $name_h;
	}
	$name_h->{$id} = $name;
	$self->cmt("-- $name --\n");
	$w->dataElement('rdfs:label', $name);
    }
    my $def = $term->get_definition;
    if ($def) {
	$w->dataElement('dc:description',
			$def->get_definition_text);
    }
    my $ont = $term->get_ontology;
#    if ($ont) {
#	$self->fact('belongs', [$id, $ont]);
#    }
    my @is_as = $term->get_is_a;
    $w->dataElement('rdfs:subClassOf',
		       '',
		       'rdf:resource'=>rdfres($_)) foreach @is_as;
    my @rels = $term->get_relationship;
    foreach (@rels) {
	$w->startTag('rdfs:subClassOf');
	$w->startTag('owl:Restriction');
	$w->dataElement('owl:onProperty', '',
			   'rdf:resource'=>rdfres($_->get_type));
	$w->dataElement('owl:someValuesFrom', '',
			   'rdf:resource'=>rdfres($_->get_to));
	$w->endTag('owl:Restriction');
	$w->endTag('rdfs:subClassOf');
    }
    $w->endTag('owl:Class');
    return;
}

sub e_typedef {
    my ($self, $typedef) = @_;
    my $id = $typedef->get_id || $self->throw($typedef->sxpr);
    my $w = $self->w;
    $id = rdfsafe($id);
    my $name = $typedef->get_name;
    $w->startTag('owl:ObjectProperty', 'rdf:ID'=>$id);
    if ($name) {
#	$w->dataElement('rdfs:label', $name);
    }
    my $def = $typedef->get_definition;
    if ($def) {
	$w->dataElement('dc:description',
			$def->get_definition_text);
    }
    my @is_as = $typedef->get_is_a;
    $w->dataElement('rdfs:subPropertyOf',
		       '',
		       'rdf:resource'=>rdfres($_)) foreach @is_as;
    my $domain = $typedef->get_domain;
    my $range = $typedef->get_range;
    $w->dataElement('rdfs:domain','','rdf:resource'=>rdfres($domain)) if $domain;
    $w->dataElement('rdfs:range','','rdf:resource'=>rdfres($range)) if $range;
    $w->endTag('owl:ObjectProperty');
    return;
}

sub out {
    my $self = shift;
    print "@_";
}

sub cmt {
    my $self = shift;
    my $cmt = shift;
#    $self->out(" % $cmt") if $cmt;
    return;
}

sub rdfres {
    my $w = rdfsafe(shift);
    return "#$w";
}

sub rdfsafe {
    my $w = shift;
    $w =~ s/:/_/g;
    $w;
}

1;