20
20
21
21
function addCondition()
22
22
{
23
+
23
24
animals=" $animals \" sex\" : { \" type\" : \" VocabProperty\" , \" vocab\" : \" $1 \" },"
24
- if [ " $1 " == " male" ]; then
25
+ if [ " $1 " == " Male" ]; then
26
+ weight=$(( RANDOM * ( 850 - 650 ) / 32767 + 650 ))
25
27
animals=" $animals \" phenologicalCondition\" : { \" type\" : \" VocabProperty\" , \" vocab\" : \" maleAdult\" }," ;
26
28
animals=" $animals \" reproductiveCondition\" : { \" type\" : \" VocabProperty\" , \" vocab\" : \" active\" }," ;
29
+ animals=" $animals \" weight\" : { \" type\" : \" Property\" , \" value\" : $weight , \" unitCode\" : \" KGM\" }," ;
27
30
else
28
31
animals=" $animals \" phenologicalCondition\" : { \" type\" : \" VocabProperty\" , \" vocab\" : \" femaleAdult\" }," ;
29
-
32
+ weight=$(( RANDOM * ( 500 - 300 ) / 32767 + 300 ))
33
+ animals=" $animals \" weight\" : { \" type\" : \" Property\" , \" value\" : $weight , \" unitCode\" : \" KGM\" }," ;
30
34
if [ $(( count% 11 )) -eq 0 ]; then
31
35
animals=" $animals \" reproductiveCondition\" : { \" type\" : \" VocabProperty\" , \" vocab\" : \" inactive\" }," ;
32
36
elif [ $(( count% 7 )) -eq 0 ]; then
@@ -40,7 +44,7 @@ function addCondition()
40
44
}
41
45
42
46
count=0;
43
- for cowNames in Beany Trotter Petal River Sun Twilight Diamond Pollen Juicey Tulip Oats Rain Silver Stamps Button Lacey Fisher Rice Eenie Chalky Joy Feather Happy Fluffy Bug Opal Fresian Star Bumble Blossom Buttercup Clover Flower Grape Citrus Hero Cloud Jersey Cream Marble Sugar Pepsi Spots Milky Blue Dales Gorgeous Pitta Harvest Arnie Ermantrude Clarabelle Annabelle Elsie Elmer Ferdinand Laughing Cow Milky White Otis Toro Kai Heffer Wolfe Benny Betsy Taurus Bulba Clemantine Clovis Zippy Harley Oakley Bead Bree Astro Galaxy Drone Fig Reef Palm Ursula Wazowski Dumpling Imp Tinker Titch Clifford Wade Hulk Moose Sherman Nemo Zorro Vache Mucca Speedy Zoomer Cleopatra Diablo Hiccup Viper Smithy Lolly Popsicle Summer Trident Horniman Moses Flynn Cinders Mouse Ego Slapper Flipper Denim Boyce Loops Racer Axe Blade Spice Fury Tyson Diesel Axel Chopper Viking Mystery Buzz Stark Brute Sabre Reaper Rebel Psycho Tank Gunner Bolt Bullet Shot Titan Sumo Kong Bruiser Ursula Drone Cracker Arrow Warrior Major Razor Spud Trip Slicer Charcoal Grill Gangster Boss Brute Don Danger Pepper Ton Python Poison Ace Woody Blade Hero Oreo Checkers Chess Dalmatian Soccer Puzzle Dice Orca Piano Penguin Panda Skunk Vintage Domino Yin Yang Badger Butler Patches Snoopy Pongo Perdita Freckles Tuxedo Cruella Keys Harlequin Banksy Coca-Cola Dot Lemur Sushi Shadow Silhouette Doodle Retro Polka Paisley Blackberry Pepper Zebra Magpie Newt Swan Pebble Storm Chocolate Coco Hershey Dairymilk Oak Wicker Bear Teddy Pine Conker Mushroom Coffee Toffee Fudge Mocha Peanut Gingerbread Walnut Cookie Acorn Cello Camel Fawn Chestnut Pheasant Muddy Toast Tea Biscuit Monkey Coconut Beaver Tawny Espresso Umber Brunette Cinnamon Cedar Penny Goomba Malteaser Brownie Pretzel Brunette Tanner Auburn Copper Bronze Liver Hazel
47
+ for cowNames in Beany Trotter Petal River Sun Twilight Diamond Pollen Juicey Tulip Oats Rain Silver Stamps Button Lacey Fisher Rice Eenie Chalky Ferdinand Feather Happy Fluffy Bug Opal Fresian Star Clover Flower Grape Citrus Hero Cloud Jersey Cream Marble Sugar Pepsi Spots Milky Blue Dales Gorgeous Pitta Harvest Arnie Ermantrude Clarabelle Annabelle Elsie Elmer Ferdinand Laughing Cow Milky White Otis Toro Kai Heffer Wolfe Benny Betsy Taurus Bulba Clemantine Clovis Zippy Harley Oakley Bead Bree Astro Galaxy Drone Fig Reef Palm Ursula Wazowski Dumpling Imp Tinker Titch Clifford Wade Hulk Moose Sherman Nemo Zorro Vache Mucca Speedy Zoomer Cleopatra Diablo Hiccup Viper Smithy Lolly Popsicle Summer Trident Horniman Moses Flynn Cinders Mouse Ego Slapper Flipper Denim Boyce Loops Racer Axe Blade Spice Fury Tyson Diesel Axel Chopper Viking Mystery Buzz Stark Brute Sabre Reaper Rebel Psycho Tank Gunner Bolt Bullet Shot Titan Sumo Kong Bruiser Ursula Drone Cracker Arrow Warrior Major Razor Spud Trip Slicer Charcoal Grill Gangster Boss Brute Don Danger Pepper Ton Python Poison Ace Woody Blade Hero Oreo Checkers Chess Dalmatian Soccer Puzzle Dice Orca Piano Penguin Panda Skunk Vintage Domino Yin Yang Badger Butler Patches Snoopy Pongo Perdita Freckles Tuxedo Cruella Keys Harlequin Banksy Coca-Cola Dot Lemur Sushi Shadow Silhouette Doodle Retro Polka Paisley Blackberry Pepper Zebra Magpie Newt Swan Pebble Storm Chocolate Coco Hershey Dairymilk Oak Wicker Bear Teddy Pine Conker Mushroom Coffee Toffee Fudge Mocha Peanut Gingerbread Walnut Cookie Acorn Cello Camel Fawn Chestnut Pheasant Muddy Toast Tea Biscuit Monkey Coconut Beaver Tawny Espresso Umber Brunette Cinnamon Cedar Penny Goomba Malteaser Brownie Pretzel Brunette Tanner Auburn Copper Bronze Liver Hazel
44
48
do
45
49
eval cowName$count =" $cowNames " ;
46
50
count=$(( count + 1 )) ;
@@ -57,16 +61,42 @@ animals="[";
57
61
for number in 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100
58
62
do
59
63
60
- if [ $count -lt ${COW_COUNT:- 4} ]; then
64
+
65
+
66
+ heartRate=$(( RANDOM * ( 56 - 50 ) / 32767 + 50 ))
67
+
68
+ lat=$(( RANDOM * ( 300 - 100 ) / 32767 + 100 ))
69
+ lng=$(( RANDOM * ( 300 - 100 ) / 32767 + 100 ))
70
+ field=$(( RANDOM * ( 7 - 3 ) / 32767 + 3 ))
71
+ owner=$(( RANDOM * ( 3 - 1 ) / 32767 + 1 ))
72
+
73
+ year=$(( RANDOM * ( 2022 - 2018 ) / 32767 + 2018 ))
74
+ month=$(( RANDOM * ( 10 - 1 ) / 32767 + 1 ))
75
+ day=$(( RANDOM * ( 28 - 1 ) / 32767 + 1 ))
76
+ padDay=$( echo 00000${day} | tail -c 3)
77
+
78
+ if [ $count -eq 4 ]; then
79
+ heartRate=70
80
+ fi
81
+
82
+ if [ $count -lt ${COW_COUNT:- 4} ]; then
61
83
eval cowName=" \$ cowName$count " ;
62
84
animals=" $animals {\" id\" :\" urn:ngsi-ld:Animal:cow$number \" , \" type\" : \" Animal\" ," ;
63
85
animals=" $animals \" species\" : { \" type\" : \" Property\" , \" value\" : \" dairy cattle\" }," ;
64
86
animals=" $animals \" name\" : { \" type\" : \" Property\" , \" value\" : \" $cowName \" }," ;
87
+
88
+ animals=" $animals \" heartRate\" : { \" type\" : \" Property\" , \" value\" : $heartRate , \" unitCode\" : \" 5K\" }," ;
89
+ animals=" $animals \" location\" : {\" type\" : \" GeoProperty\" ,\" value\" : {\" type\" : \" Point\" ,\" coordinates\" : [13.$lat ,52.$lng ]}, \" observedAt\" : \" 2024-02-02T15:00:00.000Z\" }," ;
90
+ animals=" $animals \" locatedAt\" : { \" type\" : \" Relationship\" , \" object\" : \" urn:ngsi-ld:AgriParcel:00$field \" }," ;
91
+ animals=" $animals \" ownedBy\" : { \" type\" : \" Relationship\" , \" object\" : \" urn:ngsi-ld:Person:person00$owner \" }," ;
92
+
93
+ animals=" $animals \" birthdate\" : { \" type\" : \" Property\" , \" value\" : \" ${year} -0${month} -${padDay} T00:00:00.000Z\" }," ;
94
+
65
95
if [ $(( count% 20 )) -eq 0 ]; then
66
- addCondition " male " " bull" ;
96
+ addCondition " Male " " bull" ;
67
97
animals=" $animals \" legalId\" : { \" type\" : \" Property\" , \" value\" : \" M-bull$number -$cowName \" }"
68
98
else
69
- addCondition " female " " cow" ;
99
+ addCondition " Female " " cow" ;
70
100
animals=" $animals \" legalId\" : { \" type\" : \" Property\" , \" value\" : \" F-cow$number -$cowName \" }"
71
101
fi
72
102
animals=" $animals },"
79
109
animals=" $animals \" name\" : { \" type\" : \" Property\" , \" value\" : \" $pigName \" }," ;
80
110
81
111
if [ $(( count% 2 )) -eq 0 ]; then
82
- addCondition " male " " boar" ;
112
+ addCondition " Male " " boar" ;
83
113
animals=" $animals \" legalId\" : { \" type\" : \" Property\" , \" value\" : \" M-boar$number -$pigName \" }"
84
114
else
85
- addCondition " female " " sow" ;
115
+ addCondition " Female " " sow" ;
86
116
animals=" $animals \" legalId\" : { \" type\" : \" Property\" , \" value\" : \" M-sow$number -$pigName \" }"
87
117
fi
88
118
animals=" $animals },"
@@ -114,7 +144,7 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper
114
144
-H ' Link: <' " ${TUTORIAL_DATA_MODELS_CONTEXT} " ' >; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
115
145
-H ' Accept: application/ld+json' \
116
146
--data-raw ' [
117
- {
147
+ {
118
148
"id": "urn:ngsi-ld:Building:farm001",
119
149
"type": "Building",
120
150
"category": {"type": "VocabProperty", "vocab": ["farm"]},
0 commit comments