Skip to content

Commit 7327d79

Browse files
committed
Add data
1 parent 9fe7d70 commit 7327d79

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

import-data

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ EOF
2020

2121
function addCondition()
2222
{
23+
2324
animals="$animals \"sex\": { \"type\": \"VocabProperty\", \"vocab\": \"$1\"},"
24-
if [ "$1" == "male" ]; then
25+
if [ "$1" == "Male" ]; then
26+
weight=$(( RANDOM * ( 850 - 650) / 32767 + 650 ))
2527
animals="$animals \"phenologicalCondition\": { \"type\": \"VocabProperty\", \"vocab\": \"maleAdult\"},";
2628
animals="$animals \"reproductiveCondition\": { \"type\": \"VocabProperty\", \"vocab\": \"active\"},";
29+
animals="$animals \"weight\": { \"type\": \"Property\", \"value\": $weight, \"unitCode\": \"KGM\"},";
2730
else
2831
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\"},";
3034
if [ $((count%11)) -eq 0 ]; then
3135
animals="$animals \"reproductiveCondition\": { \"type\": \"VocabProperty\", \"vocab\": \"inactive\"},";
3236
elif [ $((count%7)) -eq 0 ]; then
@@ -40,7 +44,7 @@ function addCondition()
4044
}
4145

4246
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
4448
do
4549
eval cowName$count="$cowNames";
4650
count=$((count + 1));
@@ -57,16 +61,42 @@ animals="[";
5761
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
5862
do
5963

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
6183
eval cowName="\$cowName$count";
6284
animals="$animals {\"id\":\"urn:ngsi-ld:Animal:cow$number\", \"type\": \"Animal\",";
6385
animals="$animals \"species\": { \"type\": \"Property\", \"value\": \"dairy cattle\"},";
6486
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+
6595
if [ $((count%20)) -eq 0 ]; then
66-
addCondition "male" "bull";
96+
addCondition "Male" "bull";
6797
animals="$animals \"legalId\": { \"type\": \"Property\", \"value\": \"M-bull$number-$cowName\" }"
6898
else
69-
addCondition "female" "cow";
99+
addCondition "Female" "cow";
70100
animals="$animals \"legalId\": { \"type\": \"Property\", \"value\": \"F-cow$number-$cowName\" }"
71101
fi
72102
animals="$animals },"
@@ -79,10 +109,10 @@ do
79109
animals="$animals \"name\": { \"type\": \"Property\", \"value\": \"$pigName\"},";
80110

81111
if [ $((count%2)) -eq 0 ]; then
82-
addCondition "male" "boar";
112+
addCondition "Male" "boar";
83113
animals="$animals \"legalId\": { \"type\": \"Property\", \"value\": \"M-boar$number-$pigName\" }"
84114
else
85-
addCondition "female" "sow";
115+
addCondition "Female" "sow";
86116
animals="$animals \"legalId\": { \"type\": \"Property\", \"value\": \"M-sow$number-$pigName\" }"
87117
fi
88118
animals="$animals },"
@@ -114,7 +144,7 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper
114144
-H 'Link: <'"${TUTORIAL_DATA_MODELS_CONTEXT}"'>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
115145
-H 'Accept: application/ld+json' \
116146
--data-raw '[
117-
{
147+
{
118148
"id": "urn:ngsi-ld:Building:farm001",
119149
"type": "Building",
120150
"category": {"type": "VocabProperty", "vocab": ["farm"]},

0 commit comments

Comments
 (0)