sos-core 0.1.3
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 +7 -0
- data/lib/board_of_directors/boss.rb +66 -0
- data/lib/board_of_directors/factory/factory.rb +70 -0
- data/lib/board_of_directors/factory/hashMerge.rb +71 -0
- data/lib/employees/fes.rb +7 -0
- data/lib/employees/fes/comparisonOps/propertyIsBetween.rb +32 -0
- data/lib/employees/fes/comparisonOps/propertyIsEqualTo.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsGreaterThan.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsGreaterThanOrEqualTo.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsLessThan.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsLessThanOrEqualTo.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsLike.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsNil.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsNotEqualTo.rb +10 -0
- data/lib/employees/fes/comparisonOps/propertyIsNull.rb +10 -0
- data/lib/employees/fes/expression/function.rb +9 -0
- data/lib/employees/fes/expression/literal.rb +7 -0
- data/lib/employees/fes/expression/valueReference.rb +9 -0
- data/lib/employees/fes/extensionOps/extensionOps.rb +6 -0
- data/lib/employees/fes/logicOps/and.rb +9 -0
- data/lib/employees/fes/logicOps/not.rb +10 -0
- data/lib/employees/fes/logicOps/or.rb +9 -0
- data/lib/employees/fes/spatialOps/bbox.rb +10 -0
- data/lib/employees/fes/spatialOps/beyond.rb +10 -0
- data/lib/employees/fes/spatialOps/contains.rb +10 -0
- data/lib/employees/fes/spatialOps/crosses.rb +10 -0
- data/lib/employees/fes/spatialOps/dWithin.rb +10 -0
- data/lib/employees/fes/spatialOps/disjoint.rb +10 -0
- data/lib/employees/fes/spatialOps/equals.rb +9 -0
- data/lib/employees/fes/spatialOps/intersects.rb +10 -0
- data/lib/employees/fes/spatialOps/touches.rb +10 -0
- data/lib/employees/fes/spatialOps/withIn.rb +9 -0
- data/lib/employees/fes/temporalOps/after.rb +9 -0
- data/lib/employees/fes/temporalOps/anyInteracts.rb +10 -0
- data/lib/employees/fes/temporalOps/before.rb +9 -0
- data/lib/employees/fes/temporalOps/begins.rb +9 -0
- data/lib/employees/fes/temporalOps/begunBy.rb +9 -0
- data/lib/employees/fes/temporalOps/during.rb +9 -0
- data/lib/employees/fes/temporalOps/endedBy.rb +9 -0
- data/lib/employees/fes/temporalOps/ends.rb +9 -0
- data/lib/employees/fes/temporalOps/meets.rb +9 -0
- data/lib/employees/fes/temporalOps/metBy.rb +9 -0
- data/lib/employees/fes/temporalOps/overlappedBy.rb +10 -0
- data/lib/employees/fes/temporalOps/tContains.rb +9 -0
- data/lib/employees/fes/temporalOps/tOverlaps.rb +10 -0
- data/lib/employees/fes/temporalOps/tequals.rb +9 -0
- data/lib/employees/gml.rb +2 -0
- data/lib/employees/gml/begin.rb +5 -0
- data/lib/employees/gml/end.rb +5 -0
- data/lib/employees/gml/envelope.rb +9 -0
- data/lib/employees/gml/exterior.rb +5 -0
- data/lib/employees/gml/linearRing.rb +9 -0
- data/lib/employees/gml/lowerCorner.rb +5 -0
- data/lib/employees/gml/polygon.rb +9 -0
- data/lib/employees/gml/posList.rb +5 -0
- data/lib/employees/gml/timeInstant.rb +9 -0
- data/lib/employees/gml/timePeriod.rb +33 -0
- data/lib/employees/gml/timePosition.rb +6 -0
- data/lib/employees/gml/upperCorner.rb +5 -0
- data/lib/employees/man.rb +1 -0
- data/lib/employees/mankind/complicated.rb +55 -0
- data/lib/employees/mankind/people.rb +58 -0
- data/lib/employees/mankind/simple.rb +16 -0
- data/lib/employees/sos.rb +2 -0
- data/lib/employees/sos/offering.rb +22 -0
- data/lib/employees/sos/temporalFilter.rb +5 -0
- data/lib/sos-core.rb +35 -0
- data/lib/sos-helper.rb +21 -0
- data/lib/sos_helper/capability.rb +65 -0
- data/lib/sos_helper/getObservation.xml +11 -0
- data/lib/sos_helper/node.rb +30 -0
- data/lib/sos_helper/observation.rb +77 -0
- data/lib/sos_helper/offering.rb +49 -0
- data/lib/sos_helper/xmlRequest.rb +54 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 85ae9bdcf11f275345ab0febe9babc2fc6e1ee4d
|
4
|
+
data.tar.gz: 14b9535b4163e422ca2d8cc925edfcb4aac61733
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6452ef5ed1118a368e190bf6910d92585e5360b42e9d641a017ef2391f122d5c07d53c327b15f4b4d70d38f4e2ebedd589336daefeb17caa2e2128ac5565df17
|
7
|
+
data.tar.gz: ccda52c496fff348755b52cb6c0ab659b6783ce43e6697907535b4a9a8b499ecb394f6de2e1f2432de80fcf1e6ac68034ce8908ab765143bb58fc216f48a2962
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module SOSHelper
|
2
|
+
|
3
|
+
# Boss Assign the tasks
|
4
|
+
# Assign class check each task is done by a correct employee
|
5
|
+
# Assign workflow:
|
6
|
+
# 1. recognize key as a employee
|
7
|
+
# 2. assign tasks to him
|
8
|
+
# 3. Boss summerize the base and results
|
9
|
+
|
10
|
+
class Boss
|
11
|
+
def initialize(base, projects)
|
12
|
+
@base = base
|
13
|
+
@projects = projects
|
14
|
+
end
|
15
|
+
|
16
|
+
def assign
|
17
|
+
@projects.each do |employee, task|
|
18
|
+
pm = ProjectManager.new(employee, task)
|
19
|
+
results = pm.done
|
20
|
+
summarize @base, results.dup
|
21
|
+
end
|
22
|
+
|
23
|
+
@base
|
24
|
+
end
|
25
|
+
|
26
|
+
def summarize(base=nil, bonus="")
|
27
|
+
base.root.add_child bonus
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class ProjectManager
|
33
|
+
def initialize(key, value)
|
34
|
+
@employee = key
|
35
|
+
@tasks = check value
|
36
|
+
@results = nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def done
|
40
|
+
name = recognize_employee
|
41
|
+
@results = assign_tasks_to name
|
42
|
+
end
|
43
|
+
|
44
|
+
def recognize_employee
|
45
|
+
Object.const_get(capitalize @employee).new
|
46
|
+
end
|
47
|
+
|
48
|
+
def capitalize(employee)
|
49
|
+
employee = employee.to_s
|
50
|
+
employee[0] = employee[0].capitalize
|
51
|
+
employee
|
52
|
+
end
|
53
|
+
|
54
|
+
def check(value)
|
55
|
+
return value.to_a if value.is_a? Set
|
56
|
+
value
|
57
|
+
end
|
58
|
+
|
59
|
+
def assign_tasks_to(you)
|
60
|
+
you.do @tasks
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# a = SOSHelper::Boss.new(:procedure, ["1", "2"])
|
66
|
+
# p a.done
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative 'hashMerge.rb'
|
2
|
+
require 'set'
|
3
|
+
|
4
|
+
# a = Factory.new
|
5
|
+
# a.merge!({offering: "1"})
|
6
|
+
# a.merge!({offering: "2"})
|
7
|
+
# a.merge!({offering: "3"})
|
8
|
+
# p a.merge!({offering: "4"})
|
9
|
+
# p a.transform SOSHelper::ObservationRequest.dup
|
10
|
+
|
11
|
+
|
12
|
+
# Factory focus on three things:
|
13
|
+
# 1. uniform the hash
|
14
|
+
# 2. extend condition
|
15
|
+
# 3. transform the condition
|
16
|
+
class Factory < Hash
|
17
|
+
def initialize(custom={})
|
18
|
+
@condition = uniform custom
|
19
|
+
end
|
20
|
+
|
21
|
+
# uniform any hash
|
22
|
+
def uniform(custom)
|
23
|
+
custom.each do |k, v|
|
24
|
+
next if v.is_a? Set
|
25
|
+
next (custom[k] = uniform v) if v.is_a? Hash
|
26
|
+
next (custom[k] = magic v) if v.is_a? Array
|
27
|
+
custom[k] = [v].to_set unless v.is_a? Array
|
28
|
+
custom[k] = custom[k].to_set unless v.is_a? Set
|
29
|
+
end
|
30
|
+
# p "extend filter with: " + custom.to_s
|
31
|
+
custom
|
32
|
+
end
|
33
|
+
|
34
|
+
# notify boss we have new tasks
|
35
|
+
# and send our base to him
|
36
|
+
def transform(base, obj=nil)
|
37
|
+
conditions = obj || condition
|
38
|
+
projects = checkOf conditions
|
39
|
+
jobs = SOSHelper::Boss.new base, projects
|
40
|
+
achievements = jobs.assign
|
41
|
+
|
42
|
+
achievements.to_xml
|
43
|
+
end
|
44
|
+
|
45
|
+
def magic(paragraph)
|
46
|
+
paragraph.each { |too_detail| DontWantToRefactorThisBecauseItIs too_detail }.to_set
|
47
|
+
end
|
48
|
+
|
49
|
+
def DontWantToRefactorThisBecauseItIs(too_detail)
|
50
|
+
uniform too_detail if not too_detail.is_a? String
|
51
|
+
end
|
52
|
+
|
53
|
+
def checkOf(obj)
|
54
|
+
return condition.dup if obj.respond_to? :condition
|
55
|
+
uniform(obj)
|
56
|
+
end
|
57
|
+
|
58
|
+
def merge! custom
|
59
|
+
uniform custom
|
60
|
+
dough = HashMerge.new(self.condition, custom)
|
61
|
+
dough.baked!
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
65
|
+
def to_s
|
66
|
+
@condition
|
67
|
+
end
|
68
|
+
|
69
|
+
alias :condition :to_s
|
70
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class HashMerge < Hash
|
2
|
+
def initialize(origin, custom)
|
3
|
+
@dough = origin
|
4
|
+
@materials = custom
|
5
|
+
end
|
6
|
+
|
7
|
+
def baked!
|
8
|
+
merge @dough, @materials
|
9
|
+
end
|
10
|
+
|
11
|
+
def merge(dough, materials)
|
12
|
+
mergeForHash(dough, materials) if dough.respond_to? :merge!
|
13
|
+
dough + materials if not dough.respond_to? :merge!
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def mergeForHash(dough, material)
|
19
|
+
dough.merge! (material) do |key, dough, material|
|
20
|
+
dough, material = setify dough, material
|
21
|
+
next categorized dough, material
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def categorized(dough, material)
|
26
|
+
hash_dough, string_dough = split dough
|
27
|
+
material_hash, material_string = split material
|
28
|
+
|
29
|
+
hash = combineHash(hash_dough, material_hash)
|
30
|
+
summary = string_dough + material_string + hash
|
31
|
+
end
|
32
|
+
|
33
|
+
def combineHash(*parts)
|
34
|
+
(combine parts[0], parts[1]).to_set
|
35
|
+
end
|
36
|
+
|
37
|
+
def combine(dough, materials)
|
38
|
+
materials.each { |part| blend dough, part }
|
39
|
+
dough
|
40
|
+
end
|
41
|
+
|
42
|
+
def blend(dough, part)
|
43
|
+
flag = true
|
44
|
+
dough.each do |hash|
|
45
|
+
if hash.keys == part.keys
|
46
|
+
flag = false
|
47
|
+
next recursiveMerge(hash, part)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
dough << part if flag
|
51
|
+
end
|
52
|
+
|
53
|
+
def recursiveMerge(origin, custom)
|
54
|
+
origin.merge! custom do |key, origin, custom|
|
55
|
+
merge origin, custom
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def setify(*list)
|
60
|
+
list.map do |obj|
|
61
|
+
obj = [obj].to_set if not obj.is_a? Set
|
62
|
+
obj
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def split(set)
|
67
|
+
hash = set.to_a.keep_if { |value| value.is_a? Hash }
|
68
|
+
string = set - hash
|
69
|
+
return hash, string.to_set
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require_relative 'man.rb'
|
2
|
+
Dir[ File.dirname(__FILE__) + "/fes/expression/*.rb"].each {|file| require file }
|
3
|
+
Dir[ File.dirname(__FILE__) + "/fes/comparisonOps/*.rb"].each {|file| require file }
|
4
|
+
Dir[ File.dirname(__FILE__) + "/fes/extensionOps/*.rb"].each {|file| require file }
|
5
|
+
Dir[ File.dirname(__FILE__) + "/fes/logicOps/*.rb"].each {|file| require file }
|
6
|
+
Dir[ File.dirname(__FILE__) + "/fes/spatialOps/*.rb"].each {|file| require file }
|
7
|
+
Dir[ File.dirname(__FILE__) + "/fes/temporalOps/*.rb"].each {|file| require file }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class PropertyIsBetween < Complicated
|
2
|
+
|
3
|
+
def tag_name
|
4
|
+
class_name
|
5
|
+
end
|
6
|
+
|
7
|
+
def namespace
|
8
|
+
"fes:"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class LowerBoundary < Complicated
|
13
|
+
|
14
|
+
def tag_name
|
15
|
+
class_name
|
16
|
+
end
|
17
|
+
|
18
|
+
def namespace
|
19
|
+
"fes:"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class UpperBoundary < Complicated
|
24
|
+
|
25
|
+
def tag_name
|
26
|
+
class_name
|
27
|
+
end
|
28
|
+
|
29
|
+
def namespace
|
30
|
+
"fes:"
|
31
|
+
end
|
32
|
+
end
|