rbbt-util 5.14.9 → 5.14.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/association/item.rb +10 -0
- data/share/rbbt_commands/association/subset +15 -8
- data/share/rbbt_commands/workflow/knowledge_base +15 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb5293895c8a68f418b08234e239bacadd00d4eb
|
4
|
+
data.tar.gz: 7e70f082d70d3ae7b878be2df3be9c36c50c33a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96960fe35a0668ece8cd3186d76c16ee0b8e05075d8b84be2d7b5bb32e4019d2b9040cb81fdd85934677394576cff10f62f7c4995a93d26e7f9ebebe2eeb90e5
|
7
|
+
data.tar.gz: 75814ae86c6824bd184e095c3322bd87c87e5cc67370a41d50cfce97755ad1b7895678c1d5ec38f6d0a3573dc2b6dffb253f689b35e35f90d8522dcd126f96e2
|
@@ -61,6 +61,16 @@ module AssociationItem
|
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
64
|
+
property :tsv => :array do
|
65
|
+
fields = self.info_fields
|
66
|
+
type = [self.source_type, self.target_type] * "~"
|
67
|
+
tsv = TSV.setup({}, :key_field => type, :fields => fields, :type => :list, :namespace => self.namespace)
|
68
|
+
self.each do |match|
|
69
|
+
tsv[match] = match.info.values_at *fields
|
70
|
+
end
|
71
|
+
tsv
|
72
|
+
end
|
73
|
+
|
64
74
|
def self.incidence(pairs, key_field = nil)
|
65
75
|
matrix = {}
|
66
76
|
targets = []
|
@@ -17,6 +17,7 @@ Indicate the index file (TokyoCabinet BDB with source~target keys) as the <filen
|
|
17
17
|
-h--help Print this help
|
18
18
|
-s--source* Source entities
|
19
19
|
-t--target* Target entities
|
20
|
+
-tsv--tsv* Output tsv
|
20
21
|
EOF
|
21
22
|
rbbt_usage and exit 0 if options[:help]
|
22
23
|
filename = ARGV.shift
|
@@ -29,13 +30,19 @@ file.extend Association::Index
|
|
29
30
|
source = options[:source] ? options[:source].split(/,\|/) : :all
|
30
31
|
target = options[:target] ? options[:target].split(/,\|/) : :all
|
31
32
|
|
32
|
-
file.subset(source, target)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
matches = file.subset(source, target)
|
34
|
+
|
35
|
+
if options[:tsv]
|
36
|
+
puts matches.tsv.to_s
|
37
|
+
else
|
38
|
+
matches.each do |item|
|
39
|
+
puts Log.color(:magenta, item)
|
40
|
+
info = file.fields.zip(file[item])
|
41
|
+
source,_sep, target = item.partition "~"
|
42
|
+
puts " " << Misc.format_definition_list_item("source", source)
|
43
|
+
puts " " << Misc.format_definition_list_item("target", target)
|
44
|
+
info.each do |key,value|
|
45
|
+
puts " " << Misc.format_definition_list_item(key, value)
|
46
|
+
end
|
40
47
|
end
|
41
48
|
end
|
@@ -20,6 +20,7 @@ Access workflow knowledge base
|
|
20
20
|
-tf--target_format* Target format
|
21
21
|
-d--details Print details on matches
|
22
22
|
-i--identify Attempt to identify entities by identifier translation
|
23
|
+
-tsv--tsv Output TSV
|
23
24
|
EOF
|
24
25
|
|
25
26
|
workflow = ARGV.shift
|
@@ -60,16 +61,20 @@ when :subset
|
|
60
61
|
entities = {source_format => source_entities, target_format => target_entities}
|
61
62
|
|
62
63
|
matches = knowledge_base.subset(database, entities)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
puts Misc.
|
64
|
+
|
65
|
+
|
66
|
+
if options[:tsv]
|
67
|
+
puts matches.tsv.to_s
|
68
|
+
else
|
69
|
+
matches.each do |item|
|
70
|
+
puts Log.color(:magenta, item)
|
71
|
+
info = file.fields.zip(file[item])
|
72
|
+
source,_sep, target = item.partition "~"
|
73
|
+
puts " " << Misc.format_definition_list_item("source", source)
|
74
|
+
puts " " << Misc.format_definition_list_item("target", target)
|
75
|
+
info.each do |key,value|
|
76
|
+
puts " " << Misc.format_definition_list_item(key, value)
|
77
|
+
end
|
73
78
|
end
|
74
79
|
end
|
75
80
|
end
|