datafoodconsortium-connector 1.0.0 → 1.2.0

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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/datafoodconsortium/connector/connector.rb +8 -8
  3. data/lib/datafoodconsortium/connector/context.rb +17 -45
  4. data/lib/datafoodconsortium/connector/context_1.16.0.json +492 -0
  5. data/lib/datafoodconsortium/connector/delivery_option.rb +67 -0
  6. data/lib/datafoodconsortium/connector/importer.rb +1 -1
  7. data/lib/datafoodconsortium/connector/localized_product.rb +105 -0
  8. data/lib/datafoodconsortium/connector/payment_method.rb +70 -0
  9. data/lib/datafoodconsortium/connector/physical_place.rb +94 -0
  10. data/lib/datafoodconsortium/connector/physical_product.rb +104 -0
  11. data/lib/datafoodconsortium/connector/pickup_option.rb +55 -0
  12. data/lib/datafoodconsortium/connector/planned_local_consumption_flow.rb +56 -0
  13. data/lib/datafoodconsortium/connector/planned_local_production_flow.rb +56 -0
  14. data/lib/datafoodconsortium/connector/planned_local_transformation.rb +79 -0
  15. data/lib/datafoodconsortium/connector/planned_transformation.rb +1 -0
  16. data/lib/datafoodconsortium/connector/product_batch.rb +90 -0
  17. data/lib/datafoodconsortium/connector/real_stock.rb +74 -0
  18. data/lib/datafoodconsortium/connector/realized_consumption_flow.rb +56 -0
  19. data/lib/datafoodconsortium/connector/realized_production_flow.rb +56 -0
  20. data/lib/datafoodconsortium/connector/realized_transformation.rb +73 -0
  21. data/lib/datafoodconsortium/connector/shipping_option.rb +91 -0
  22. data/lib/datafoodconsortium/connector/theoretical_stock.rb +67 -0
  23. data/lib/datafoodconsortium/connector/virtual_place.rb +64 -0
  24. data/lib/datafoodconsortium/connector.rb +17 -0
  25. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 653a023fe7b9c3e2f59a738b31a8713745e4c106650ec743529397c0f817b331
4
- data.tar.gz: 588951db4b8311fd71350b8668089958f5983e36712f50f458f3d00860c37230
3
+ metadata.gz: 8c8a65b126a0a4837acd570ccc5fe0057fb49ab6440958bed35cfec693944e2d
4
+ data.tar.gz: cd7f2ed362d8a06a7d9605b1dcfa1e3591cb903b7319b6b0297a9c9e3f1fb9be
5
5
  SHA512:
6
- metadata.gz: 666e12a902979c275b10a883861759a781e9bffbb8c9e58de95f72d74cd33d79d3e6060917ab4c8c2417c22d525097c218b56bc7482b087a8f8f186d3e8f466e
7
- data.tar.gz: 2533e80077e344ed2c54b0466ce0347dd91267f45c42a5f779b0545154788d2296875d387671550e17427ab73ecd289ade1a0bc846a0163b28fa40cdbf1036c1
6
+ metadata.gz: aa01d91de19e4282f94c4ae4e7c09fa5e2bde5a8f29b5b166ffb530502ef86455ee8011ee69590d2656042ca1373914e93ca7433829fa7233f3570d377390288
7
+ data.tar.gz: 5b60adf9c9825f3ae395290749bd545b866d9a1daa4c3090c715af1102f656c75293f473408879fbe2a6ace73819b7a4fa3cefb64bfb28837e82079270b9a4f5
@@ -25,8 +25,8 @@ require 'datafoodconsortium/connector/context'
25
25
  require 'datafoodconsortium/connector/importer'
26
26
  require 'datafoodconsortium/connector/json_ld_serializer'
27
27
 
28
- class DataFoodConsortium::Connector::Connector
29
-
28
+ module DataFoodConsortium::Connector
29
+ class Connector
30
30
  include Singleton
31
31
 
32
32
  attr_accessor :context
@@ -40,7 +40,7 @@ class DataFoodConsortium::Connector::Connector
40
40
  end
41
41
 
42
42
  def import(json_string_or_io)
43
- DataFoodConsortium::Connector::Importer.new.import(json_string_or_io)
43
+ Importer.new.import(json_string_or_io)
44
44
  end
45
45
 
46
46
  def loadFacets(data)
@@ -63,12 +63,12 @@ class DataFoodConsortium::Connector::Connector
63
63
  # used to prefix properties
64
64
  # so the DFC's context can be used.
65
65
  # See https://github.com/datafoodconsortium/connector-ruby/issues/11.
66
- inputContext = DataFoodConsortium::Connector::Context.inputContext
66
+ inputContext = Context.inputContext
67
67
 
68
- @context = "https://www.datafoodconsortium.org"
68
+ @context = Context::URL
69
69
 
70
- @exporter = DataFoodConsortium::Connector::JsonLdSerializer.new(@context, inputContext)
71
- @parser = DataFoodConsortium::Connector::SKOSParser.new
70
+ @exporter = JsonLdSerializer.new(@context, inputContext)
71
+ @parser = SKOSParser.new
72
72
 
73
73
  @FACETS = []
74
74
  @MEASURES = []
@@ -80,5 +80,5 @@ class DataFoodConsortium::Connector::Connector
80
80
  data = data[0] if data.is_a?(Array)
81
81
  @parser.parse(data["@graph"])
82
82
  end
83
-
83
+ end
84
84
  end
@@ -2,55 +2,23 @@
2
2
 
3
3
  require 'json/ld'
4
4
 
5
- # Preload the DFC context.
6
- #
7
- # Similar to: https://github.com/ruby-rdf/json-ld-preloaded/
8
5
  module DataFoodConsortium
9
6
  module Connector
7
+ # Preload the DFC context.
8
+ #
9
+ # Similar to: https://github.com/ruby-rdf/json-ld-preloaded/
10
10
  class Context < JSON::LD::Context
11
- VERSION_1_8 = JSON.parse <<~JSON
12
- {
13
- "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
14
- "skos" : "http://www.w3.org/2004/02/skos/core#",
15
- "dfc": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#",
16
- "dc": "http://purl.org/dc/elements/1.1/#",
17
- "dfc-b": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
18
- "dfc-p": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_ProductGlossary.owl#",
19
- "dfc-t": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_TechnicalOntology.owl#",
20
- "dfc-m": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/measures.rdf#",
21
- "dfc-pt": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/productTypes.rdf#",
22
- "dfc-f": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#",
23
- "ontosec": "http://www.semanticweb.org/ontologies/2008/11/OntologySecurity.owl#",
24
- "dfc-p:hasUnit":{ "@type":"@id" },
25
- "dfc-b:hasUnit":{ "@type":"@id" },
26
- "dfc-b:hasQuantity":{ "@type":"@id" },
27
- "dfc-p:hasType":{ "@type":"@id" },
28
- "dfc-b:hasType":{ "@type":"@id" },
29
- "dfc-b:references":{ "@type":"@id" },
30
- "dfc-b:referencedBy":{ "@type":"@id" },
31
- "dfc-b:offeres":{ "@type":"@id" },
32
- "dfc-b:supplies":{ "@type":"@id" },
33
- "dfc-b:defines":{ "@type":"@id" },
34
- "dfc-b:affiliates":{ "@type":"@id" },
35
- "dfc-b:hasCertification":{ "@type":"@id" },
36
- "dfc-b:manages":{ "@type":"@id" },
37
- "dfc-b:offeredThrough":{ "@type":"@id" },
38
- "dfc-b:hasBrand":{ "@type":"@id" },
39
- "dfc-b:hasGeographicalOrigin":{ "@type":"@id" },
40
- "dfc-b:hasClaim":{ "@type":"@id" },
41
- "dfc-b:hasAllergenDimension":{ "@type":"@id" },
42
- "dfc-b:hasNutrientDimension":{ "@type":"@id" },
43
- "dfc-b:hasPhysicalDimension":{ "@type":"@id" },
44
- "dfc:owner":{ "@type":"@id" },
45
- "dfc-t:hostedBy":{ "@type":"@id" },
46
- "dfc-t:hasPivot":{ "@type":"@id" },
47
- "dfc-t:represent":{ "@type":"@id" }
48
- }
49
- JSON
11
+ URL = "https://www.datafoodconsortium.org"
50
12
 
51
- add_preloaded("http://www.datafoodconsortium.org/") { parse(VERSION_1_8) }
13
+ add_preloaded("http://www.datafoodconsortium.org/") { parse(json) }
52
14
 
53
- # This is the actual file the DFC website refers to in a link header.
15
+ # This is the current file the DFC website refers to in a link header.
16
+ alias_preloaded(
17
+ "https://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_1.16.0.jsonld",
18
+ "http://www.datafoodconsortium.org/"
19
+ )
20
+
21
+ # This was the file the DFC website refers to in a link header.
54
22
  alias_preloaded(
55
23
  "https://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context.jsonld",
56
24
  "http://www.datafoodconsortium.org/"
@@ -65,7 +33,11 @@ module DataFoodConsortium
65
33
 
66
34
  # The hash serializer expects only string values in the context.
67
35
  def self.inputContext
68
- @inputContext = VERSION_1_8.select { |key, value| value.is_a? String }
36
+ @inputContext = json.select { |key, value| value.is_a? String }
37
+ end
38
+
39
+ def self.json
40
+ @json ||= JSON.parse(File.read("#{__dir__}/context_1.16.0.json"))["@context"]
69
41
  end
70
42
  end
71
43
  end
@@ -0,0 +1,492 @@
1
+ {
2
+ "@context": {
3
+ "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
4
+ "skos" : "http://www.w3.org/2004/02/skos/core#",
5
+ "dfc": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#",
6
+ "dc": "http://purl.org/dc/elements/1.1/#",
7
+ "dfc-b": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
8
+ "dfc-t": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_TechnicalOntology.owl#",
9
+ "dfc-m": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/measures.rdf#",
10
+ "dfc-pt": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/productTypes.rdf#",
11
+ "dfc-f": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#",
12
+ "dfc-v": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/vocabulary.rdf#",
13
+ "ontosec": "http://www.semanticweb.org/ontologies/2008/11/OntologySecurity.owl#",
14
+ "dfc-b:DFC_BusinessOntology_ObjectProperty": {
15
+ "@type": "@id"
16
+ },
17
+ "dfc-b:DFC_Interface_Property": {
18
+ "@type": "@id"
19
+ },
20
+ "dfc-b:addressOf": {
21
+ "@type": "@id"
22
+ },
23
+ "dfc-b:affiliatedTo": {
24
+ "@type": "@id"
25
+ },
26
+ "dfc-b:affiliates": {
27
+ "@type": "@id"
28
+ },
29
+ "dfc-b:allergenCharacteristicOf": {
30
+ "@type": "@id"
31
+ },
32
+ "dfc-b:basedAt": {
33
+ "@type": "@id"
34
+ },
35
+ "dfc-b:belongsTo": {
36
+ "@type": "@id"
37
+ },
38
+ "dfc-b:brandOf": {
39
+ "@type": "@id"
40
+ },
41
+ "dfc-b:certificateOf": {
42
+ "@type": "@id"
43
+ },
44
+ "dfc-b:characteristicOf": {
45
+ "@type": "@id"
46
+ },
47
+ "dfc-b:claimOf": {
48
+ "@type": "@id"
49
+ },
50
+ "dfc-b:composedOf": {
51
+ "@type": "@id"
52
+ },
53
+ "dfc-b:composes": {
54
+ "@type": "@id"
55
+ },
56
+ "dfc-b:concernedBy": {
57
+ "@type": "@id"
58
+ },
59
+ "dfc-b:concerns": {
60
+ "@type": "@id"
61
+ },
62
+ "dfc-b:constituedBy": {
63
+ "@type": "@id"
64
+ },
65
+ "dfc-b:constitutes": {
66
+ "@type": "@id"
67
+ },
68
+ "dfc-b:consumedBy": {
69
+ "@type": "@id"
70
+ },
71
+ "dfc-b:consumes": {
72
+ "@type": "@id"
73
+ },
74
+ "dfc-b:containerInformationOf": {
75
+ "@type": "@id"
76
+ },
77
+ "dfc-b:coordinatedBy": {
78
+ "@type": "@id"
79
+ },
80
+ "dfc-b:coordinates": {
81
+ "@type": "@id"
82
+ },
83
+ "dfc-b:definedBy": {
84
+ "@type": "@id"
85
+ },
86
+ "dfc-b:defines": {
87
+ "@type": "@id"
88
+ },
89
+ "dfc-b:deliveredAt": {
90
+ "@type": "@id"
91
+ },
92
+ "dfc-b:endsAt": {
93
+ "@type": "@id"
94
+ },
95
+ "dfc-b:facetOf": {
96
+ "@type": "@id"
97
+ },
98
+ "dfc-b:from": {
99
+ "@type": "@id"
100
+ },
101
+ "dfc-b:fulfills": {
102
+ "@type": "@id"
103
+ },
104
+ "dfc-b:geographicalOriginOf": {
105
+ "@type": "@id"
106
+ },
107
+ "dfc-b:hasAddress": {
108
+ "@type": "@id"
109
+ },
110
+ "dfc-b:hasAllergenCharacteristic": {
111
+ "@type": "@id"
112
+ },
113
+ "dfc-b:hasAllergenDimension": {
114
+ "@type": "@id"
115
+ },
116
+ "dfc-b:hasBrand": {
117
+ "@type": "@id"
118
+ },
119
+ "dfc-b:hasCertification": {
120
+ "@type": "@id"
121
+ },
122
+ "dfc-b:hasCharacteristic": {
123
+ "@type": "@id"
124
+ },
125
+ "dfc-b:hasClaim": {
126
+ "@type": "@id"
127
+ },
128
+ "dfc-b:hasContainerInformation": {
129
+ "@type": "@id"
130
+ },
131
+ "dfc-b:hasCountry": {
132
+ "@type": "@id"
133
+ },
134
+ "dfc-b:hasDimension": {
135
+ "@type": "@id"
136
+ },
137
+ "dfc-b:hasFacet": {
138
+ "@type": "@id"
139
+ },
140
+ "dfc-b:hasFulfilmentStatus": {
141
+ "@type": "@id"
142
+ },
143
+ "dfc-b:hasGeographicalOrigin": {
144
+ "@type": "@id"
145
+ },
146
+ "dfc-b:hasIngredient": {
147
+ "@type": "@id"
148
+ },
149
+ "dfc-b:hasInput": {
150
+ "@type": "@id"
151
+ },
152
+ "dfc-b:hasLabellingCharacteristic": {
153
+ "@type": "@id"
154
+ },
155
+ "dfc-b:hasLabellingDimension": {
156
+ "@type": "@id"
157
+ },
158
+ "dfc-b:hasMainContact": {
159
+ "@type": "@id"
160
+ },
161
+ "dfc-b:hasNatureOrigin": {
162
+ "@type": "@id"
163
+ },
164
+ "dfc-b:hasNutrientCharacteristic": {
165
+ "@type": "@id"
166
+ },
167
+ "dfc-b:hasNutrientDimension": {
168
+ "@type": "@id"
169
+ },
170
+ "dfc-b:hasObject": {
171
+ "@type": "@id"
172
+ },
173
+ "dfc-b:hasOffer": {
174
+ "@type": "@id"
175
+ },
176
+ "dfc-b:hasOption": {
177
+ "@type": "@id"
178
+ },
179
+ "dfc-b:hasOrderStatus": {
180
+ "@type": "@id"
181
+ },
182
+ "dfc-b:hasOutput": {
183
+ "@type": "@id"
184
+ },
185
+ "dfc-b:hasPart": {
186
+ "@type": "@id"
187
+ },
188
+ "dfc-b:hasPartOrigin": {
189
+ "@type": "@id"
190
+ },
191
+ "dfc-b:hasPaymentMethod": {
192
+ "@type": "@id"
193
+ },
194
+ "dfc-b:hasPaymentStatus": {
195
+ "@type": "@id"
196
+ },
197
+ "dfc-b:hasPhoneNumber": {
198
+ "@type": "@id"
199
+ },
200
+ "dfc-b:hasPhysicalCharacteristic": {
201
+ "@type": "@id"
202
+ },
203
+ "dfc-b:hasPhysicalDimension": {
204
+ "@type": "@id"
205
+ },
206
+ "dfc-b:hasPrice": {
207
+ "@type": "@id"
208
+ },
209
+ "dfc-b:hasProcess": {
210
+ "@type": "@id"
211
+ },
212
+ "dfc-b:hasQuantity": {
213
+ "@type": "@id"
214
+ },
215
+ "dfc-b:hasReference": {
216
+ "@type": "@id"
217
+ },
218
+ "dfc-b:hasSocialMedia": {
219
+ "@type": "@id"
220
+ },
221
+ "dfc-b:hasStatus": {
222
+ "@type": "@id"
223
+ },
224
+ "dfc-b:hasTemperature": {
225
+ "@type": "@id"
226
+ },
227
+ "dfc-b:hasTransformationType": {
228
+ "@type": "@id"
229
+ },
230
+ "dfc-b:hasType": {
231
+ "@type": "@id"
232
+ },
233
+ "dfc-b:hasUnit": {
234
+ "@type": "@id"
235
+ },
236
+ "dfc-b:hasVariant": {
237
+ "@type": "@id"
238
+ },
239
+ "dfc-b:holds": {
240
+ "@type": "@id"
241
+ },
242
+ "dfc-b:hostedAt": {
243
+ "@type": "@id"
244
+ },
245
+ "dfc-b:hosts": {
246
+ "@type": "@id"
247
+ },
248
+ "dfc-b:identifiedBy": {
249
+ "@type": "@id"
250
+ },
251
+ "dfc-b:identifies": {
252
+ "@type": "@id"
253
+ },
254
+ "dfc-b:industrializedBy": {
255
+ "@type": "@id"
256
+ },
257
+ "dfc-b:industrializes": {
258
+ "@type": "@id"
259
+ },
260
+ "dfc-b:inputOf": {
261
+ "@type": "@id"
262
+ },
263
+ "dfc-b:isAvailableDuring": {
264
+ "@type": "@id"
265
+ },
266
+ "dfc-b:isFulfilledBy": {
267
+ "@type": "@id"
268
+ },
269
+ "dfc-b:isIngredientOf": {
270
+ "@type": "@id"
271
+ },
272
+ "dfc-b:isOpenDuring": {
273
+ "@type": "@id"
274
+ },
275
+ "dfc-b:isPriceOf": {
276
+ "@type": "@id"
277
+ },
278
+ "dfc-b:isShippedIn": {
279
+ "@type": "@id"
280
+ },
281
+ "dfc-b:isTemperatureOf": {
282
+ "@type": "@id"
283
+ },
284
+ "dfc-b:isVariantOf": {
285
+ "@type": "@id"
286
+ },
287
+ "dfc-b:labellingCharacteristicOf": {
288
+ "@type": "@id"
289
+ },
290
+ "dfc-b:listedIn": {
291
+ "@type": "@id"
292
+ },
293
+ "dfc-b:lists": {
294
+ "@type": "@id"
295
+ },
296
+ "dfc-b:localizedBy": {
297
+ "@type": "@id"
298
+ },
299
+ "dfc-b:localizes": {
300
+ "@type": "@id"
301
+ },
302
+ "dfc-b:mainContactOf": {
303
+ "@type": "@id"
304
+ },
305
+ "dfc-b:maintainedBy": {
306
+ "@type": "@id"
307
+ },
308
+ "dfc-b:maintains": {
309
+ "@type": "@id"
310
+ },
311
+ "dfc-b:managedBy": {
312
+ "@type": "@id"
313
+ },
314
+ "dfc-b:manages": {
315
+ "@type": "@id"
316
+ },
317
+ "dfc-b:natureOriginOf": {
318
+ "@type": "@id"
319
+ },
320
+ "dfc-b:nutrientCharacteristicOf": {
321
+ "@type": "@id"
322
+ },
323
+ "dfc-b:objectOf": {
324
+ "@type": "@id"
325
+ },
326
+ "dfc-b:offeredThrough": {
327
+ "@type": "@id"
328
+ },
329
+ "dfc-b:offers": {
330
+ "@type": "@id"
331
+ },
332
+ "dfc-b:offersTo": {
333
+ "@type": "@id"
334
+ },
335
+ "dfc-b:optionOf": {
336
+ "@type": "@id"
337
+ },
338
+ "dfc-b:orderedBy": {
339
+ "@type": "@id"
340
+ },
341
+ "dfc-b:orders": {
342
+ "@type": "@id"
343
+ },
344
+ "dfc-b:outputOf": {
345
+ "@type": "@id"
346
+ },
347
+ "dfc-b:ownedBy": {
348
+ "@type": "@id"
349
+ },
350
+ "dfc-b:owns": {
351
+ "@type": "@id"
352
+ },
353
+ "dfc-b:paidWith": {
354
+ "@type": "@id"
355
+ },
356
+ "dfc-b:partOf": {
357
+ "@type": "@id"
358
+ },
359
+ "dfc-b:partOriginOf": {
360
+ "@type": "@id"
361
+ },
362
+ "dfc-b:phoneNumberOf": {
363
+ "@type": "@id"
364
+ },
365
+ "dfc-b:physicalCharacteristicOf": {
366
+ "@type": "@id"
367
+ },
368
+ "dfc-b:pickedUpAt": {
369
+ "@type": "@id"
370
+ },
371
+ "dfc-b:processOf": {
372
+ "@type": "@id"
373
+ },
374
+ "dfc-b:producedBy": {
375
+ "@type": "@id"
376
+ },
377
+ "dfc-b:produces": {
378
+ "@type": "@id"
379
+ },
380
+ "dfc-b:proposedBy": {
381
+ "@type": "@id"
382
+ },
383
+ "dfc-b:proposes": {
384
+ "@type": "@id"
385
+ },
386
+ "dfc-b:referenceOf": {
387
+ "@type": "@id"
388
+ },
389
+ "dfc-b:referencedBy": {
390
+ "@type": "@id"
391
+ },
392
+ "dfc-b:references": {
393
+ "@type": "@id"
394
+ },
395
+ "dfc-b:refersTo": {
396
+ "@type": "@id"
397
+ },
398
+ "dfc-b:representedBy": {
399
+ "@type": "@id"
400
+ },
401
+ "dfc-b:represents": {
402
+ "@type": "@id"
403
+ },
404
+ "dfc-b:requestedBy": {
405
+ "@type": "@id"
406
+ },
407
+ "dfc-b:requests": {
408
+ "@type": "@id"
409
+ },
410
+ "dfc-b:satisfiedBy": {
411
+ "@type": "@id"
412
+ },
413
+ "dfc-b:satisfies": {
414
+ "@type": "@id"
415
+ },
416
+ "dfc-b:selectedBy": {
417
+ "@type": "@id"
418
+ },
419
+ "dfc-b:selects": {
420
+ "@type": "@id"
421
+ },
422
+ "dfc-b:sells": {
423
+ "@type": "@id"
424
+ },
425
+ "dfc-b:ships": {
426
+ "@type": "@id"
427
+ },
428
+ "dfc-b:socialMediaOf": {
429
+ "@type": "@id"
430
+ },
431
+ "dfc-b:soldBy": {
432
+ "@type": "@id"
433
+ },
434
+ "dfc-b:startsAt": {
435
+ "@type": "@id"
436
+ },
437
+ "dfc-b:storedIn": {
438
+ "@type": "@id"
439
+ },
440
+ "dfc-b:stores": {
441
+ "@type": "@id"
442
+ },
443
+ "dfc-b:suppliedBy": {
444
+ "@type": "@id"
445
+ },
446
+ "dfc-b:supplies": {
447
+ "@type": "@id"
448
+ },
449
+ "dfc-b:suppliesTo": {
450
+ "@type": "@id"
451
+ },
452
+ "dfc-b:to": {
453
+ "@type": "@id"
454
+ },
455
+ "dfc-b:tracedBy": {
456
+ "@type": "@id"
457
+ },
458
+ "dfc-b:traces": {
459
+ "@type": "@id"
460
+ },
461
+ "dfc-b:transformedBy": {
462
+ "@type": "@id"
463
+ },
464
+ "dfc-b:transforms": {
465
+ "@type": "@id"
466
+ },
467
+ "dfc-b:transportedBy": {
468
+ "@type": "@id"
469
+ },
470
+ "dfc-b:transports": {
471
+ "@type": "@id"
472
+ },
473
+ "dfc-b:typeOf": {
474
+ "@type": "@id"
475
+ },
476
+ "dfc-b:uses": {
477
+ "@type": "@id"
478
+ },
479
+ "dfc-t:represent": {
480
+ "@type": "@id"
481
+ },
482
+ "dfc-t:hasPivot": {
483
+ "@type": "@id"
484
+ },
485
+ "dfc-t:hostedBy": {
486
+ "@type": "@id"
487
+ },
488
+ "dfc-t:owner": {
489
+ "@type": "@id"
490
+ }
491
+ }
492
+ }
@@ -0,0 +1,67 @@
1
+ # MIT License
2
+ #
3
+ # Copyright (c) 2023 Maxime Lecoq <maxime@lecoqlibre.fr>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+
24
+
25
+
26
+ require "datafoodconsortium/connector/shipping_option"
27
+ require "virtual_assembly/semantizer"
28
+
29
+ class DataFoodConsortium::Connector::DeliveryOption < DataFoodConsortium::Connector::ShippingOption
30
+
31
+ SEMANTIC_TYPE = "dfc-b:DeliveryOption".freeze
32
+
33
+ # @return [IPhysicalPlace]
34
+ attr_accessor :deliveredPlace
35
+
36
+ # @return [String]
37
+ attr_accessor :deliveryConstraint
38
+
39
+ # @return [String]
40
+ attr_accessor :accessibilityInformation
41
+
42
+ # @param semanticId [String]
43
+ # @param deliveredPlace [IPhysicalPlace]
44
+ # @param deliveryConstraint [String]
45
+ # @param accessibilityInformation [String]
46
+ # @param name [String]
47
+ # @param description [String]
48
+ # @param fee [Real]
49
+ # @param quantity [IQuantity]
50
+ # @param order [IOrder]
51
+ # @param saleSession [ISaleSession]
52
+ # @param beginDate [DateTime]
53
+ # @param endDate [DateTime]
54
+ def initialize(semanticId, deliveredPlace: nil, deliveryConstraint: nil, accessibilityInformation: nil, name: nil, description: nil, fee: nil, quantity: nil, order: nil, saleSession: nil, beginDate: nil, endDate: nil)
55
+ super(semanticId, name: name, description: description, fee: fee, quantity: quantity, order: order, saleSession: saleSession, beginDate: beginDate, endDate: endDate)
56
+ @deliveredPlace = deliveredPlace
57
+ @deliveryConstraint = deliveryConstraint
58
+ @accessibilityInformation = accessibilityInformation
59
+ self.semanticType = "dfc-b:DeliveryOption"
60
+ registerSemanticProperty("dfc-b:deliveredAt", &method("deliveredPlace")).valueSetter = method("deliveredPlace=")
61
+ registerSemanticProperty("dfc-b:deliveryConstraint", &method("deliveryConstraint")).valueSetter = method("deliveryConstraint=")
62
+ registerSemanticProperty("dfc-b:accessibilityInfo", &method("accessibilityInformation")).valueSetter = method("accessibilityInformation=")
63
+ end
64
+
65
+
66
+
67
+ end