-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinserts.js
161 lines (135 loc) · 5.01 KB
/
inserts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
const schema = require('./schemas')
const Rate = schema.Rate;
const User = schema.User;
const Device = schema.Device;
const Measure = schema.Measure;
const Recommendation = schema.Recommendation;
// var rate = new Rate({
// "@id": "http://our_own_schema.org/rate/1",
// "identifier": 1,
// "name": "Basica",
// "price" : 50,
// "description" : "BASICA"
// });
// var rate2 = new Rate({
// "@id": "http://our_own_schema.org/rate/2",
// "identifier": 2,
// "name": "Avanzada",
// "price" : 30,
// "description" : "YE"
// });
// rate.save().then(() => rate2.save())
// .catch(err => console.log('Error!', err))
// var user = new User({
// "@id":"http://our_own_schema.org/user/1",
// "identifier": 1,
// "name":"Carlos",
// "address":"Castellon",
// "email":"carlos@gmail.com",
// "accessCode":"patata",
// "oos:rate":"http://our_own_schema.org/rate/2"
// });
// var user2 = new User({
// "@id":"http://our_own_schema.org/user/2",
// "identifier": 2,
// "name":"Juan",
// "address":"Morella",
// "email":"juan@gmail.com",
// "accessCode":"patata",
// "oos:rate":"http://our_own_schema.org/rate/1"
// });user2.save()
// user.save().then(() => user2.save())
// .catch(err => console.log('Error!', err))
// states: ["Activo", "Pausado", "Desconectado"],
// locations: ["Cocina", "Comedor", "Baño", "Dormitorio"],
// deviceTypes: ["Electrodomestico", "Dispositivo electrónico", "Calefacción", "Refrigeración", "Iluminación"],
// var device = new Device({
// "@id": "http://our_own_schema.org/device/tv",
// "oos:owner" : "http://our_own_schema.org/user/1",
// "identifier": "tv",
// "itemCondition": "Activo",
// "location": "Comedor",
// "category": "Dispositivo electrónico",
// "description":"Televisión"
// });
// var device2 = new Device({
// "@id": "http://our_own_schema.org/device/nev",
// "oos:owner" : "http://our_own_schema.org/user/1",
// "identifier": "nev",
// "itemCondition": "Pausado",
// "location": "Comedor",
// "category": "Refrigeración",
// "description":"Nevera"
// });
var device3 = new Device({
"@id": "http://our_own_schema.org/device/tv_coc",
"oos:owner" : "http://our_own_schema.org/user/1",
"identifier": "tv_coc",
"itemCondition": "Desconectado",
"location": "Cocina",
"category": "Dispositivo electrónico",
"description":"Televisión"
});
device3.save()
// device.save().then(() => device2.save().then(() => device3.save()))
// .catch(err => console.log('Error!', err))
// var measure = new Measure({
// "@id": "http://our_own_schema.org/device/lav/measure/1",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "identifier": 1,
// "observationDate": "2020-04-07:17:00",
// "measuredValue": 200
// });
// var measure2 = new Measure({
// "@id": "http://our_own_schema.org/device/lav/measure/2",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "identifier": 2,
// "observationDate": "2020-04-07:18:00",
// "measuredValue": 900
// });
// var measure3 = new Measure({
// "@id": "http://our_own_schema.org/device/lav/measure/3",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "identifier": 3,
// "observationDate": "2020-04-07:19:00",
// "measuredValue": 400
// });
// var measure4 = new Measure({
// "@id": "http://our_own_schema.org/device/lav/measure/4",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "identifier": 4,
// "observationDate": "2020-04-07:20:00",
// "measuredValue": 500
// });
// var measure5 = new Measure({
// "@id": "http://our_own_schema.org/device/lav/measure/5",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "identifier": 5,
// "observationDate": "2020-04-07:21:00",
// "measuredValue": 800
// });
// measure.save().catch(err => console.log('Error!', err))
// measure2.save().catch(err => console.log('Error!', err))
// measure3.save().catch(err => console.log('Error!', err))
// measure4.save().catch(err => console.log('Error!', err))
// measure5.save().catch(err => console.log('Error!', err))
// var recommendation = new Recommendation({
// "@id": "http://our_own_schema.org/device/lav/recommendation/1",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "oos:owner" : "http://our_own_schema.org/user/1",
// "identifier": 1,
// "dateCreated":"2020-03-31",
// "description":"Apaga la luz",
// "category": "Uso"
// });
// var recommendation2 = new Recommendation({
// "@id": "http://our_own_schema.org/device/lav/recommendation/2",
// "oos:device" : "http://our_own_schema.org/device/lav",
// "oos:owner" : "http://our_own_schema.org/user/1",
// "identifier": 2,
// "dateCreated":"2020-04-05",
// "description":"Pon la lavadora por la noche",
// "category": "Consumo"
// });
// recommendation.save().catch(err => console.log('Error!', err))
// recommendation2.save().catch(err => console.log('Error!', err))