datafoodconsortium-connector 1.3.0 → 2.0.0.pre.beta1

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/datafoodconsortium/connector/agent.rb +7 -1
  3. data/lib/datafoodconsortium/connector/catalog.rb +14 -1
  4. data/lib/datafoodconsortium/connector/certification.rb +75 -0
  5. data/lib/datafoodconsortium/connector/connector.rb +2 -2
  6. data/lib/datafoodconsortium/connector/context.rb +8 -15
  7. data/lib/datafoodconsortium/connector/{context_1.16.0.json → context_2.0.0.json} +59 -8
  8. data/lib/datafoodconsortium/connector/customer_category.rb +8 -1
  9. data/lib/datafoodconsortium/connector/defined_product.rb +7 -6
  10. data/lib/datafoodconsortium/connector/delivery_step.rb +51 -0
  11. data/lib/datafoodconsortium/connector/enterprise.rb +3 -2
  12. data/lib/datafoodconsortium/connector/json_ld_serializer.rb +2 -0
  13. data/lib/datafoodconsortium/connector/organization.rb +123 -0
  14. data/lib/datafoodconsortium/connector/person.rb +4 -2
  15. data/lib/datafoodconsortium/connector/physical_place.rb +8 -1
  16. data/lib/datafoodconsortium/connector/pickup_step.rb +51 -0
  17. data/lib/datafoodconsortium/connector/planned_flow.rb +42 -0
  18. data/lib/datafoodconsortium/connector/product_option.rb +64 -0
  19. data/lib/datafoodconsortium/connector/product_option_value.rb +57 -0
  20. data/lib/datafoodconsortium/connector/route.rb +65 -0
  21. data/lib/datafoodconsortium/connector/sale_session.rb +13 -5
  22. data/lib/datafoodconsortium/connector/step.rb +83 -0
  23. data/lib/datafoodconsortium/connector/supplied_product.rb +5 -3
  24. data/lib/datafoodconsortium/connector/technical_product.rb +6 -3
  25. data/lib/datafoodconsortium/connector/template_sale_session.rb +53 -0
  26. data/lib/datafoodconsortium/connector/value_recur.rb +79 -0
  27. data/lib/datafoodconsortium/connector/variant.rb +79 -0
  28. data/lib/datafoodconsortium/connector/variant_characteristic.rb +71 -0
  29. data/lib/datafoodconsortium/connector/vevent.rb +69 -0
  30. data/lib/datafoodconsortium/connector.rb +13 -0
  31. metadata +18 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53c5f255a48f339e30ae7ab2745a661f5989c6e91fd81ec639fa179ef82e7111
4
- data.tar.gz: 1b5f034696fb9540252bcb3f4431e0fe404a331c9c228098a2ab73c3c01b3532
3
+ metadata.gz: e0e356ba982a9fff2482bb21802f6d899d851224c451212a8d95db595139f7be
4
+ data.tar.gz: 33e1c188c09cd6b7c859d04ca72f35163020d7ea63768a06acc4a067d06dbe70
5
5
  SHA512:
6
- metadata.gz: a3d9907d5f5b7b7529b464cde69eccc6e0c6de00a45097b58f79369d933c5cc08195f61716d4d9108e51b53c9a134b4312c8529ad8131d6e6e59aac13dca6400
7
- data.tar.gz: 97aa860ebfb2b1fd8ccd32c85c55a01e3f6ce2973856dd51df1a92621bcf523fdcdaf51d314caa7f605ebda2f933267e6e689b2d7d37e17bcefcf12241328d43
6
+ metadata.gz: b1556596e524f6f8dd613142c91f5ec9416de7465f331be9588ee15b9aebb181fd9540d4fd78344133968b72bdc9307664a5759a65b0184949a098ee8a9795d5
7
+ data.tar.gz: 164ee84cd9f475081b94768da6321cb563b5e1ddf596ab84885dfa48adffa405caa1e45020b063fc290084acb3dff79e70b9612a8caf36c336ff34371a64bf46
@@ -47,6 +47,9 @@ class DataFoodConsortium::Connector::Agent
47
47
  # @return [String]
48
48
  attr_accessor :logo
49
49
 
50
+ # @return [ICustomerCategory]
51
+ attr_accessor :customerCategoriesMembership
52
+
50
53
  # @param semanticId [String]
51
54
  # @param localizations [IAddress]
52
55
  # @param phoneNumbers [IPhoneNumber]
@@ -54,7 +57,8 @@ class DataFoodConsortium::Connector::Agent
54
57
  # @param websites [String]
55
58
  # @param socialMedias [ISocialMedia]
56
59
  # @param logo [String]
57
- def initialize(semanticId, localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [], logo: nil)
60
+ # @param customerCategoriesMembership [ICustomerCategory]
61
+ def initialize(semanticId, localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [], logo: nil, customerCategoriesMembership: [])
58
62
  super(semanticId)
59
63
  @localizations = localizations
60
64
  @phoneNumbers = phoneNumbers
@@ -62,6 +66,7 @@ class DataFoodConsortium::Connector::Agent
62
66
  @websites = websites
63
67
  @socialMedias = socialMedias
64
68
  @logo = logo
69
+ @customerCategoriesMembership = customerCategoriesMembership
65
70
  self.semanticType = "dfc-b:Agent"
66
71
  registerSemanticProperty("dfc-b:hasAddress", &method("localizations")).valueSetter = method("localizations=")
67
72
  registerSemanticProperty("dfc-b:hasPhoneNumber", &method("phoneNumbers")).valueSetter = method("phoneNumbers=")
@@ -69,6 +74,7 @@ class DataFoodConsortium::Connector::Agent
69
74
  registerSemanticProperty("dfc-b:websitePage", &method("websites")).valueSetter = method("websites=")
70
75
  registerSemanticProperty("dfc-b:hasSocialMedia", &method("socialMedias")).valueSetter = method("socialMedias=")
71
76
  registerSemanticProperty("dfc-b:logo", &method("logo")).valueSetter = method("logo=")
77
+ registerSemanticProperty("dfc-b:isMemberOf", &method("customerCategoriesMembership")).valueSetter = method("customerCategoriesMembership=")
72
78
  end
73
79
 
74
80
 
@@ -24,6 +24,7 @@
24
24
 
25
25
 
26
26
 
27
+
27
28
  require "virtual_assembly/semantizer"
28
29
 
29
30
  class DataFoodConsortium::Connector::Catalog
@@ -37,16 +38,28 @@ class DataFoodConsortium::Connector::Catalog
37
38
  # @return [IEnterprise]
38
39
  attr_accessor :maintainers
39
40
 
41
+ # @return [DateTime]
42
+ attr_accessor :beginDate
43
+
44
+ # @return [DateTime]
45
+ attr_accessor :endDate
46
+
40
47
  # @param semanticId [String]
41
48
  # @param items [ICatalogItem]
42
49
  # @param maintainers [IEnterprise]
43
- def initialize(semanticId, items: [], maintainers: [])
50
+ # @param beginDate [DateTime]
51
+ # @param endDate [DateTime]
52
+ def initialize(semanticId, items: [], maintainers: [], beginDate: nil, endDate: nil)
44
53
  super(semanticId)
45
54
  @items = items
46
55
  @maintainers = maintainers
56
+ @beginDate = beginDate
57
+ @endDate = endDate
47
58
  self.semanticType = "dfc-b:Catalog"
48
59
  registerSemanticProperty("dfc-b:lists", &method("items")).valueSetter = method("items=")
49
60
  registerSemanticProperty("dfc-b:maintainedBy", &method("maintainers")).valueSetter = method("maintainers=")
61
+ registerSemanticProperty("dfc-b:beginDate", &method("beginDate")).valueSetter = method("beginDate=")
62
+ registerSemanticProperty("dfc-b:endDate", &method("endDate")).valueSetter = method("endDate=")
50
63
  end
51
64
 
52
65
 
@@ -0,0 +1,75 @@
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
+ require "virtual_assembly/semantizer"
25
+
26
+ class DataFoodConsortium::Connector::Certification
27
+ include VirtualAssembly::Semantizer::SemanticObject
28
+
29
+ SEMANTIC_TYPE = "dfc-b:Certfication".freeze
30
+
31
+ # @return [String]
32
+ attr_accessor :certificationReferences
33
+
34
+ # @return [String]
35
+ attr_accessor :certificationScores
36
+
37
+ # @return [String]
38
+ attr_accessor :operatorIds
39
+
40
+ # @return [IOrganization]
41
+ attr_accessor :certifiedOrganizations
42
+
43
+ # @return [String]
44
+ attr_accessor :name
45
+
46
+ # @return [String]
47
+ attr_accessor :description
48
+
49
+ # @param semanticId [String]
50
+ # @param certificationReferences [String]
51
+ # @param certificationScores [String]
52
+ # @param operatorIds [String]
53
+ # @param certifiedOrganizations [IOrganization]
54
+ # @param name [String]
55
+ # @param description [String]
56
+ def initialize(semanticId, certificationReferences: [], certificationScores: [], operatorIds: [], certifiedOrganizations: [], name: nil, description: nil)
57
+ super(semanticId)
58
+ @certificationReferences = certificationReferences
59
+ @certificationScores = certificationScores
60
+ @operatorIds = operatorIds
61
+ @certifiedOrganizations = certifiedOrganizations
62
+ @name = name
63
+ @description = description
64
+ self.semanticType = "dfc-b:Certfication"
65
+ registerSemanticProperty("dfc-b:certiferReference", &method("certificationReferences")).valueSetter = method("certificationReferences=")
66
+ registerSemanticProperty("dfc-b:certificationScore", &method("certificationScores")).valueSetter = method("certificationScores=")
67
+ registerSemanticProperty("dfc-b:operatorId", &method("operatorIds")).valueSetter = method("operatorIds=")
68
+ registerSemanticProperty("dfc-b:certifies", &method("certifiedOrganizations")).valueSetter = method("certifiedOrganizations=")
69
+ registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
70
+ registerSemanticProperty("dfc-b:hasDescription", &method("description")).valueSetter = method("description=")
71
+ end
72
+
73
+
74
+
75
+ end
@@ -35,8 +35,8 @@ module DataFoodConsortium::Connector
35
35
  attr_reader :MEASURES
36
36
  attr_reader :PRODUCT_TYPES
37
37
 
38
- def export(*subjects)
39
- @exporter.process(*subjects)
38
+ def export(subject, *subjects)
39
+ return @exporter.process(subject, *subjects)
40
40
  end
41
41
 
42
42
  def import(json_string_or_io)
@@ -8,34 +8,27 @@ module DataFoodConsortium
8
8
  #
9
9
  # Similar to: https://github.com/ruby-rdf/json-ld-preloaded/
10
10
  class Context < JSON::LD::Context
11
- URL = "https://w3id.org/dfc/ontology/context/context_1.16.0.json"
12
- URL_NORMALISED = "http://w3id.org/dfc/ontology/context/context_1.16.0.json"
11
+ URL = "https://www.datafoodconsortium.org"
13
12
 
14
- # All context URIs have to use http because https is normalised to http
15
- # during the lookup of preloaded contexts.
16
- # And if the URI doesn't have a path, it must end with `/`.
17
- add_preloaded(URL_NORMALISED) { parse(json) }
18
-
19
- # The default context always pointing to the latest version:
20
- alias_preloaded("http://www.datafoodconsortium.org/", URL_NORMALISED)
13
+ add_preloaded("http://www.datafoodconsortium.org/") { parse(json) }
21
14
 
22
15
  # This is the current file the DFC website refers to in a link header.
23
16
  alias_preloaded(
24
- "http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_1.16.0.jsonld",
25
- URL_NORMALISED
17
+ "https://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_2.0.0.jsonld",
18
+ "http://www.datafoodconsortium.org/"
26
19
  )
27
20
 
28
21
  # This was the file the DFC website refers to in a link header.
29
22
  alias_preloaded(
30
- "http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context.jsonld",
31
- URL_NORMALISED
23
+ "https://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context.jsonld",
24
+ "http://www.datafoodconsortium.org/"
32
25
  )
33
26
 
34
27
  # This is the old URL that's not online anymore.
35
28
  # Keep it for compatiblity with all versions before 1.8.
36
29
  alias_preloaded(
37
30
  "http://static.datafoodconsortium.org/ontologies/context.json",
38
- URL_NORMALISED
31
+ "http://www.datafoodconsortium.org/"
39
32
  )
40
33
 
41
34
  # The hash serializer expects only string values in the context.
@@ -44,7 +37,7 @@ module DataFoodConsortium
44
37
  end
45
38
 
46
39
  def self.json
47
- @json ||= JSON.parse(File.read("#{__dir__}/context_1.16.0.json"))["@context"]
40
+ @json ||= JSON.parse(File.read("#{__dir__}/context_2.0.0.json"))["@context"]
48
41
  end
49
42
  end
50
43
  end
@@ -2,14 +2,14 @@
2
2
  "@context": {
3
3
  "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
4
4
  "skos" : "http://www.w3.org/2004/02/skos/core#",
5
- "dfc": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#",
5
+ "dfc": "http://w3id.org/dfc/ontology/DFC_FullModel.owl#",
6
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#",
7
+ "dfc-b": "http://w3id.org/dfc/ontology/v2.0.0/src/DFC_BusinessOntology.owl#",
8
+ "dfc-t": "http://w3id.org/dfc/ontology/v2.0.0/src/DFC_TechnicalOntology.owl#",
9
+ "dfc-m": "http://w3id.org/dfc/taxonomies/v2.0.0/measures.rdf#",
10
+ "dfc-pt": "http://w3id.org/dfc/taxonomies/v2.0.0/productTypes.rdf#",
11
+ "dfc-f": "http://w3id.org/dfc/taxonomies/v2.0.0/facets.rdf#",
12
+ "dfc-v": "http://w3id.org/dfc/taxonomies/v2.0.0/vocabulary.rdf#",
13
13
  "ontosec": "http://www.semanticweb.org/ontologies/2008/11/OntologySecurity.owl#",
14
14
  "dfc-b:DFC_BusinessOntology_ObjectProperty": {
15
15
  "@type": "@id"
@@ -41,6 +41,9 @@
41
41
  "dfc-b:certificateOf": {
42
42
  "@type": "@id"
43
43
  },
44
+ "dfc-b:certifies": {
45
+ "@type": "@id"
46
+ },
44
47
  "dfc-b:characteristicOf": {
45
48
  "@type": "@id"
46
49
  },
@@ -89,6 +92,9 @@
89
92
  "dfc-b:deliveredAt": {
90
93
  "@type": "@id"
91
94
  },
95
+ "dfc-b:delivery": {
96
+ "@type": "@id"
97
+ },
92
98
  "dfc-b:endsAt": {
93
99
  "@type": "@id"
94
100
  },
@@ -140,6 +146,9 @@
140
146
  "dfc-b:hasFulfilmentStatus": {
141
147
  "@type": "@id"
142
148
  },
149
+ "dfc-b:hasGeoJsonFeature": {
150
+ "@type": "@id"
151
+ },
143
152
  "dfc-b:hasGeographicalOrigin": {
144
153
  "@type": "@id"
145
154
  },
@@ -158,6 +167,9 @@
158
167
  "dfc-b:hasMainContact": {
159
168
  "@type": "@id"
160
169
  },
170
+ "dfc-b:hasMember": {
171
+ "@type": "@id"
172
+ },
161
173
  "dfc-b:hasNatureOrigin": {
162
174
  "@type": "@id"
163
175
  },
@@ -206,7 +218,10 @@
206
218
  "dfc-b:hasPrice": {
207
219
  "@type": "@id"
208
220
  },
209
- "dfc-b:hasProcess": {
221
+ "dfc-b:hasProductOption": {
222
+ "@type": "@id"
223
+ },
224
+ "dfc-b:hasProductOptionValue": {
210
225
  "@type": "@id"
211
226
  },
212
227
  "dfc-b:hasQuantity": {
@@ -215,15 +230,27 @@
215
230
  "dfc-b:hasReference": {
216
231
  "@type": "@id"
217
232
  },
233
+ "dfc-b:hasReferenceProductOption": {
234
+ "@type": "@id"
235
+ },
236
+ "dfc-b:hasReferenceProductOptionValue": {
237
+ "@type": "@id"
238
+ },
218
239
  "dfc-b:hasSocialMedia": {
219
240
  "@type": "@id"
220
241
  },
221
242
  "dfc-b:hasStatus": {
222
243
  "@type": "@id"
223
244
  },
245
+ "dfc-b:hasStep": {
246
+ "@type": "@id"
247
+ },
224
248
  "dfc-b:hasTemperature": {
225
249
  "@type": "@id"
226
250
  },
251
+ "dfc-b:hasTemplateSaleSession": {
252
+ "@type": "@id"
253
+ },
227
254
  "dfc-b:hasTransformationType": {
228
255
  "@type": "@id"
229
256
  },
@@ -236,6 +263,9 @@
236
263
  "dfc-b:hasVariant": {
237
264
  "@type": "@id"
238
265
  },
266
+ "dfc-b:hasVariantCaracteristic": {
267
+ "@type": "@id"
268
+ },
239
269
  "dfc-b:holds": {
240
270
  "@type": "@id"
241
271
  },
@@ -263,12 +293,18 @@
263
293
  "dfc-b:isAvailableDuring": {
264
294
  "@type": "@id"
265
295
  },
296
+ "dfc-b:isCertifiedBy": {
297
+ "@type": "@id"
298
+ },
266
299
  "dfc-b:isFulfilledBy": {
267
300
  "@type": "@id"
268
301
  },
269
302
  "dfc-b:isIngredientOf": {
270
303
  "@type": "@id"
271
304
  },
305
+ "dfc-b:isMemberOf": {
306
+ "@type": "@id"
307
+ },
272
308
  "dfc-b:isOpenDuring": {
273
309
  "@type": "@id"
274
310
  },
@@ -278,9 +314,15 @@
278
314
  "dfc-b:isShippedIn": {
279
315
  "@type": "@id"
280
316
  },
317
+ "dfc-b:isStepOf": {
318
+ "@type": "@id"
319
+ },
281
320
  "dfc-b:isTemperatureOf": {
282
321
  "@type": "@id"
283
322
  },
323
+ "dfc-b:isTemplateSaleSessionOf": {
324
+ "@type": "@id"
325
+ },
284
326
  "dfc-b:isVariantOf": {
285
327
  "@type": "@id"
286
328
  },
@@ -365,6 +407,9 @@
365
407
  "dfc-b:physicalCharacteristicOf": {
366
408
  "@type": "@id"
367
409
  },
410
+ "dfc-b:pickUp": {
411
+ "@type": "@id"
412
+ },
368
413
  "dfc-b:pickedUpAt": {
369
414
  "@type": "@id"
370
415
  },
@@ -473,6 +518,12 @@
473
518
  "dfc-b:typeOf": {
474
519
  "@type": "@id"
475
520
  },
521
+ "dfc-b:useVehicle": {
522
+ "@type": "@id"
523
+ },
524
+ "dfc-b:usedInRoute": {
525
+ "@type": "@id"
526
+ },
476
527
  "dfc-b:uses": {
477
528
  "@type": "@id"
478
529
  },
@@ -21,6 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
 
24
+
24
25
  require "virtual_assembly/semantizer"
25
26
 
26
27
  class DataFoodConsortium::Connector::CustomerCategory
@@ -31,13 +32,19 @@ class DataFoodConsortium::Connector::CustomerCategory
31
32
  # @return [String]
32
33
  attr_accessor :description
33
34
 
35
+ # @return [IAgent]
36
+ attr_accessor :members
37
+
34
38
  # @param semanticId [String]
35
39
  # @param description [String]
36
- def initialize(semanticId, description: nil)
40
+ # @param members [IAgent]
41
+ def initialize(semanticId, description: nil, members: [])
37
42
  super(semanticId)
38
43
  @description = description
44
+ @members = members
39
45
  self.semanticType = "dfc-b:CustomerCategory"
40
46
  registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
47
+ registerSemanticProperty("dfc-b:isMemberOf", &method("members")).valueSetter = method("members=")
41
48
  end
42
49
 
43
50
 
@@ -27,6 +27,7 @@
27
27
 
28
28
 
29
29
 
30
+
30
31
  require "virtual_assembly/semantizer"
31
32
 
32
33
  class DataFoodConsortium::Connector::DefinedProduct
@@ -88,8 +89,8 @@ class DataFoodConsortium::Connector::DefinedProduct
88
89
  # @return [IDefinedProduct]
89
90
  attr_accessor :variants
90
91
 
91
- # @return [IDefinedProduct]
92
- attr_accessor :isVariantOf
92
+ # @return [IProductOption]
93
+ attr_accessor :referenceProductOptions
93
94
 
94
95
  # @param semanticId [String]
95
96
  # @param name [String]
@@ -110,8 +111,8 @@ class DataFoodConsortium::Connector::DefinedProduct
110
111
  # @param partOrigin [ISKOSConcept]
111
112
  # @param images [String]
112
113
  # @param variants [IDefinedProduct]
113
- # @param isVariantOf [IDefinedProduct]
114
- def initialize(semanticId, name: nil, description: nil, productType: nil, quantity: nil, alcoholPercentage: nil, lifetime: nil, claims: [], usageOrStorageConditions: nil, allergenCharacteristics: [], nutrientCharacteristics: [], physicalCharacteristics: [], geographicalOrigin: nil, catalogItems: [], certifications: [], natureOrigin: [], partOrigin: [], images: [], variants: [], isVariantOf: [])
114
+ # @param referenceProductOptions [IProductOption]
115
+ def initialize(semanticId, name: nil, description: nil, productType: nil, quantity: nil, alcoholPercentage: nil, lifetime: nil, claims: [], usageOrStorageConditions: nil, allergenCharacteristics: [], nutrientCharacteristics: [], physicalCharacteristics: [], geographicalOrigin: nil, catalogItems: [], certifications: [], natureOrigin: [], partOrigin: [], images: [], variants: [], referenceProductOptions: [])
115
116
  super(semanticId)
116
117
  @name = name
117
118
  @description = description
@@ -131,7 +132,7 @@ class DataFoodConsortium::Connector::DefinedProduct
131
132
  @partOrigin = partOrigin
132
133
  @images = images
133
134
  @variants = variants
134
- @isVariantOf = isVariantOf
135
+ @referenceProductOptions = referenceProductOptions
135
136
  self.semanticType = "dfc-b:DefinedProduct"
136
137
  registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
137
138
  registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
@@ -151,7 +152,7 @@ class DataFoodConsortium::Connector::DefinedProduct
151
152
  registerSemanticProperty("dfc-b:hasPartOrigin", &method("partOrigin")).valueSetter = method("partOrigin=")
152
153
  registerSemanticProperty("dfc-b:image", &method("images")).valueSetter = method("images=")
153
154
  registerSemanticProperty("dfc-b:hasVariant", &method("variants")).valueSetter = method("variants=")
154
- registerSemanticProperty("dfc-b:isVariantOf", &method("isVariantOf")).valueSetter = method("isVariantOf=")
155
+ registerSemanticProperty("dfc-b:hasReferenceProductOption", &method("referenceProductOptions")).valueSetter = method("referenceProductOptions=")
155
156
  end
156
157
 
157
158
 
@@ -0,0 +1,51 @@
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/step"
27
+ require "virtual_assembly/semantizer"
28
+
29
+ class DataFoodConsortium::Connector::DeliveryStep < DataFoodConsortium::Connector::Step
30
+
31
+ SEMANTIC_TYPE = "dfc-b:DeliveryStep".freeze
32
+
33
+
34
+ # @param semanticId [String]
35
+ # @param name [String]
36
+ # @param description [String]
37
+ # @param routes [IRoute]
38
+ # @param deliveredShipments [IShipment]
39
+ # @param pickedUpShipments [IShipment]
40
+ # @param duration [String]
41
+ # @param arrivalDate [DateTime]
42
+ def initialize(semanticId, name: nil, description: nil, routes: [], deliveredShipments: [], pickedUpShipments: [], duration: nil, arrivalDate: nil)
43
+ super(semanticId, name: name, description: description, routes: routes, deliveredShipments: deliveredShipments, pickedUpShipments: pickedUpShipments, duration: duration, arrivalDate: arrivalDate)
44
+
45
+ self.semanticType = "dfc-b:DeliveryStep"
46
+
47
+ end
48
+
49
+
50
+
51
+ end
@@ -80,8 +80,9 @@ class DataFoodConsortium::Connector::Enterprise < DataFoodConsortium::Connector:
80
80
  # @param websites [String]
81
81
  # @param socialMedias [ISocialMedia]
82
82
  # @param logo [String]
83
- def initialize(semanticId, name: nil, description: nil, vatNumber: nil, customerCategories: [], catalogs: [], catalogItems: [], suppliedProducts: [], technicalProducts: [], mainContact: nil, localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [], logo: nil)
84
- super(semanticId, localizations: localizations, phoneNumbers: phoneNumbers, emails: emails, websites: websites, socialMedias: socialMedias, logo: logo)
83
+ # @param customerCategoriesMembership [ICustomerCategory]
84
+ def initialize(semanticId, name: nil, description: nil, vatNumber: nil, customerCategories: [], catalogs: [], catalogItems: [], suppliedProducts: [], technicalProducts: [], mainContact: nil, localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [], logo: nil, customerCategoriesMembership: [])
85
+ super(semanticId, localizations: localizations, phoneNumbers: phoneNumbers, emails: emails, websites: websites, socialMedias: socialMedias, logo: logo, customerCategoriesMembership: customerCategoriesMembership)
85
86
  @name = name
86
87
  @description = description
87
88
  @vatNumber = vatNumber
@@ -31,6 +31,8 @@ class DataFoodConsortium::Connector::JsonLdSerializer
31
31
  end
32
32
 
33
33
  def process(*subjects)
34
+ return "" if subjects.empty?
35
+
34
36
  # Insert an input context on each subject so the properties could be prefixed. This way,
35
37
  # the DFC's context can be used.
36
38
  # See https://github.com/datafoodconsortium/connector-ruby/issues/11.
@@ -0,0 +1,123 @@
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
+ require "datafoodconsortium/connector/agent"
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ require "virtual_assembly/semantizer"
37
+
38
+ class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connector::Agent
39
+
40
+ SEMANTIC_TYPE = "dfc-b:Organization".freeze
41
+
42
+ # @return [String]
43
+ attr_accessor :name
44
+
45
+ # @return [String]
46
+ attr_accessor :description
47
+
48
+ # @return [String]
49
+ attr_accessor :vatNumber
50
+
51
+ # @return [ICustomerCategory]
52
+ attr_accessor :customerCategories
53
+
54
+ # @return [ICatalog]
55
+ attr_accessor :catalogs
56
+
57
+ # @return [ICatalogItem]
58
+ attr_accessor :catalogItems
59
+
60
+ # @return [ISuppliedProduct]
61
+ attr_accessor :suppliedProducts
62
+
63
+ # @return [ITechnicalProduct]
64
+ attr_accessor :technicalProducts
65
+
66
+ # @return [IPerson]
67
+ attr_accessor :mainContact
68
+
69
+ # @return [ITemplateSaleSession]
70
+ attr_accessor :templateSaleSessions
71
+
72
+ # @return [ICertification]
73
+ attr_accessor :certifications
74
+
75
+ # @param semanticId [String]
76
+ # @param name [String]
77
+ # @param description [String]
78
+ # @param vatNumber [String]
79
+ # @param customerCategories [ICustomerCategory]
80
+ # @param catalogs [ICatalog]
81
+ # @param catalogItems [ICatalogItem]
82
+ # @param suppliedProducts [ISuppliedProduct]
83
+ # @param technicalProducts [ITechnicalProduct]
84
+ # @param mainContact [IPerson]
85
+ # @param templateSaleSessions [ITemplateSaleSession]
86
+ # @param certifications [ICertification]
87
+ # @param localizations [IAddress]
88
+ # @param phoneNumbers [IPhoneNumber]
89
+ # @param emails [String]
90
+ # @param websites [String]
91
+ # @param socialMedias [ISocialMedia]
92
+ # @param logo [String]
93
+ # @param customerCategoriesMembership [ICustomerCategory]
94
+ def initialize(semanticId, name: nil, description: nil, vatNumber: nil, customerCategories: [], catalogs: [], catalogItems: [], suppliedProducts: [], technicalProducts: [], mainContact: nil, templateSaleSessions: [], certifications: [], localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [], logo: nil, customerCategoriesMembership: [])
95
+ super(semanticId, localizations: localizations, phoneNumbers: phoneNumbers, emails: emails, websites: websites, socialMedias: socialMedias, logo: logo, customerCategoriesMembership: customerCategoriesMembership)
96
+ @name = name
97
+ @description = description
98
+ @vatNumber = vatNumber
99
+ @customerCategories = customerCategories
100
+ @catalogs = catalogs
101
+ @catalogItems = catalogItems
102
+ @suppliedProducts = suppliedProducts
103
+ @technicalProducts = technicalProducts
104
+ @mainContact = mainContact
105
+ @templateSaleSessions = templateSaleSessions
106
+ @certifications = certifications
107
+ self.semanticType = "dfc-b:Organization"
108
+ registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
109
+ registerSemanticProperty("dfc-b:hasDescription", &method("description")).valueSetter = method("description=")
110
+ registerSemanticProperty("dfc-b:VATnumber", &method("vatNumber")).valueSetter = method("vatNumber=")
111
+ registerSemanticProperty("dfc-b:defines", &method("customerCategories")).valueSetter = method("customerCategories=")
112
+ registerSemanticProperty("dfc-b:maintains", &method("catalogs")).valueSetter = method("catalogs=")
113
+ registerSemanticProperty("dfc-b:manages", &method("catalogItems")).valueSetter = method("catalogItems=")
114
+ registerSemanticProperty("dfc-b:supplies", &method("suppliedProducts")).valueSetter = method("suppliedProducts=")
115
+ registerSemanticProperty("dfc-b:proposes", &method("technicalProducts")).valueSetter = method("technicalProducts=")
116
+ registerSemanticProperty("dfc-b:hasMainContact", &method("mainContact")).valueSetter = method("mainContact=")
117
+ registerSemanticProperty("dfc-b:hasTemplateSaleSession", &method("templateSaleSessions")).valueSetter = method("templateSaleSessions=")
118
+ registerSemanticProperty("dfc-b:isCertifiedBy", &method("certifications")).valueSetter = method("certifications=")
119
+ end
120
+
121
+
122
+
123
+ end