labimotion 1.5.0.rc5 → 1.5.0.rc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a8123a3e71db321a6b3efef15ecce3cca9e287bce32a268b5447c25dd6ed55d
|
4
|
+
data.tar.gz: 36b88fb09d16d5ac4bc2a8eeae2775d20c9197d871e48df5e6dacc34b2934e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7695e71a516c3fba35fdae8cdb4d4b0081d4ca4da3802eb8703e43189a2dbbdbbe85413650a4d3699f262d9eeb92e6199f87a10a97a52aa7eb0927fab688e536
|
7
|
+
data.tar.gz: cb9a7de785d9ddecd6d69d0be45b9323a08c5227cdf7c0e4ed1db2063aaa47b306045534d30a9c5daa5d8c83624b642418badea4810cc9e9fd49a35f6700a753
|
@@ -12,5 +12,55 @@ module Labimotion
|
|
12
12
|
def klass_label
|
13
13
|
object&.dataset_klass&.label
|
14
14
|
end
|
15
|
+
|
16
|
+
|
17
|
+
def root_element
|
18
|
+
object&.element&.root_element
|
19
|
+
end
|
20
|
+
|
21
|
+
def properties
|
22
|
+
properties = object&.properties || {}
|
23
|
+
properties[Labimotion::Prop::LAYERS].keys.each do |key|
|
24
|
+
layer = properties[Labimotion::Prop::LAYERS][key] || {}
|
25
|
+
return properties if layer.empty? || layer[Labimotion::Prop::FIELDS].nil?
|
26
|
+
|
27
|
+
field_vocs = layer[Labimotion::Prop::FIELDS].select { |ss| ss['is_voc'] == true }
|
28
|
+
field_vocs.each do |field|
|
29
|
+
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
30
|
+
next if idx.nil?
|
31
|
+
|
32
|
+
case field['source']
|
33
|
+
when Labimotion::Prop::ELEMENT
|
34
|
+
if field['identifier'] == 'element.name'
|
35
|
+
byebug
|
36
|
+
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = root_element&.name
|
37
|
+
# dic[field.identifier] = currentElement.name
|
38
|
+
|
39
|
+
end
|
40
|
+
when Labimotion::Prop::SEGMENT
|
41
|
+
segs = root_element&.segments&.select { |ss| field['source_id'] == ss.segment_klass&.identifier }
|
42
|
+
next if segs.empty? || field['layer_id'].blank? || field['field_id'].blank?
|
43
|
+
|
44
|
+
seg = segs&.first
|
45
|
+
seg_fields = seg.properties.dig(Labimotion::Prop::LAYERS, field['layer_id'], Labimotion::Prop::FIELDS).select { |ff| ff['field'] == field['field_id'] }
|
46
|
+
seg_field = seg_fields&.first
|
47
|
+
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = seg_field['value']
|
48
|
+
when Labimotion::Prop::DATASET
|
49
|
+
byebug
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# layer[Labimotion::Prop::FIELDS].each do |field|
|
54
|
+
# end
|
55
|
+
end
|
56
|
+
|
57
|
+
# byebug
|
58
|
+
# layers = properties['layers']
|
59
|
+
|
60
|
+
# properties['vocabularies'].each_with_object({}) do |v, h|
|
61
|
+
# h[v['name']] = v['value']
|
62
|
+
# end
|
63
|
+
properties
|
64
|
+
end
|
15
65
|
end
|
16
66
|
end
|
@@ -17,7 +17,21 @@ module Labimotion
|
|
17
17
|
# end
|
18
18
|
|
19
19
|
expose :voc do |obj|
|
20
|
-
|
20
|
+
## byebug
|
21
|
+
voc = (obj[:properties] && obj[:properties]['voc']) || {}
|
22
|
+
|
23
|
+
case voc['source']
|
24
|
+
when Labimotion::Prop::ELEMENT
|
25
|
+
if voc['identifier'] == 'element.name'
|
26
|
+
# byebug
|
27
|
+
# voc['source_name'] = ElementKlass.find_by(identifier: voc['source_id'])&.name
|
28
|
+
end
|
29
|
+
when Labimotion::Prop::SEGMENT
|
30
|
+
voc['source_name'] = SegmentKlass.find_by(identifier: voc['source_id'])&.label
|
31
|
+
when Labimotion::Prop::DATASET
|
32
|
+
voc['source_name'] = DatasetKlass.find_by(identifier: voc['source_id'])&.label
|
33
|
+
end
|
34
|
+
voc
|
21
35
|
end
|
22
36
|
expose :ontology do |obj|
|
23
37
|
(obj[:properties] && obj[:properties]['ontology']) || {}
|
data/lib/labimotion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labimotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.
|
4
|
+
version: 1.5.0.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chia-Lin Lin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-10-
|
12
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|