| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# @File Predicate.pm |
|
4
|
|
|
|
|
|
|
# @Author Andriy Mulyar |
|
5
|
|
|
|
|
|
|
# @Created Jun 27, 2016 1:17:38 PM |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
191
|
|
|
10
|
|
|
|
|
|
|
package Predicate; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#A predicate will be treated as an edge on the graph. This object takes 4 |
|
13
|
|
|
|
|
|
|
# paramters |
|
14
|
|
|
|
|
|
|
#Source CUI |
|
15
|
|
|
|
|
|
|
#Predicate Type (ie. ISA, TREATS, CAUSES, etc) |
|
16
|
|
|
|
|
|
|
#Destination CUI |
|
17
|
|
|
|
|
|
|
#Edge Weight |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
sub new { |
|
20
|
0
|
|
|
0
|
|
|
my $class = shift; |
|
21
|
0
|
|
|
|
|
|
my $self = { |
|
22
|
|
|
|
|
|
|
_source => shift, |
|
23
|
|
|
|
|
|
|
_predicate => shift, |
|
24
|
|
|
|
|
|
|
_destination => shift, |
|
25
|
|
|
|
|
|
|
_weight => shift, |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
}; |
|
28
|
0
|
|
|
|
|
|
bless $self, $class; |
|
29
|
0
|
|
|
|
|
|
return $self; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#returns source vertex |
|
33
|
|
|
|
|
|
|
sub getSource{ |
|
34
|
|
|
|
|
|
|
return shift->{_source} |
|
35
|
0
|
|
|
0
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#returns predicate name |
|
38
|
|
|
|
|
|
|
sub getPredicate{ |
|
39
|
0
|
|
|
0
|
|
|
return shift->{_predicate}; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#returns destination vertex |
|
43
|
|
|
|
|
|
|
sub getDestination{ |
|
44
|
|
|
|
|
|
|
return shift->{_destination} |
|
45
|
0
|
|
|
0
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#returns weight associated with the edge |
|
48
|
|
|
|
|
|
|
sub getWeight{ |
|
49
|
0
|
|
|
0
|
|
|
return shift->{_weight}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#test print |
|
53
|
|
|
|
|
|
|
sub _print{ |
|
54
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
55
|
0
|
|
|
|
|
|
print $self->{_source}->getPreferredName()." ". $self->{_predicate} ." ".$self->{_destination}->getPreferredName()." ".$self->{_weight}."\n"; |
|
56
|
|
|
|
|
|
|
#print "$self->{_source} $self->{_predicate} $self->{_destination}"; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
1; |