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
@@ -21,7 +21,7 @@ module DataFoodConsortium
21
21
  end
22
22
 
23
23
  def self.prefixed_name(uri)
24
- RDF::URI.new(uri).pname(prefixes: Context::VERSION_1_8)
24
+ RDF::URI.new(uri).pname(prefixes: Context.json)
25
25
  end
26
26
 
27
27
  def import(json_string_or_io)
@@ -0,0 +1,105 @@
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
+
27
+
28
+
29
+
30
+ require "virtual_assembly/semantizer"
31
+
32
+ class DataFoodConsortium::Connector::LocalizedProduct
33
+ include VirtualAssembly::Semantizer::SemanticObject
34
+
35
+ SEMANTIC_TYPE = "dfc-b:LocalizedProduct".freeze
36
+
37
+ # @return [String]
38
+ attr_accessor :name
39
+
40
+ # @return [String]
41
+ attr_accessor :description
42
+
43
+ # @return [String]
44
+ attr_accessor :images
45
+
46
+ # @return [IQuantity]
47
+ attr_accessor :quantity
48
+
49
+ # @return [Real]
50
+ attr_accessor :cost
51
+
52
+ # @return [Real]
53
+ attr_accessor :theoreticalStocks
54
+
55
+ # @return [ISuppliedProduct]
56
+ attr_accessor :suppliedProducts
57
+
58
+ # @return [IPhysicalProduct]
59
+ attr_accessor :physicalProducts
60
+
61
+ # @return [IPlannedLocalProductionFlow]
62
+ attr_accessor :plannedLocalProductionFlows
63
+
64
+ # @return [IPlannedLocalConsumptionFlow]
65
+ attr_accessor :plannedLocalConsumptionFlows
66
+
67
+ # @param semanticId [String]
68
+ # @param name [String]
69
+ # @param description [String]
70
+ # @param images [String]
71
+ # @param quantity [IQuantity]
72
+ # @param cost [Real]
73
+ # @param theoreticalStocks [Real]
74
+ # @param suppliedProducts [ISuppliedProduct]
75
+ # @param physicalProducts [IPhysicalProduct]
76
+ # @param plannedLocalProductionFlows [IPlannedLocalProductionFlow]
77
+ # @param plannedLocalConsumptionFlows [IPlannedLocalConsumptionFlow]
78
+ def initialize(semanticId, name: nil, description: nil, images: [], quantity: nil, cost: nil, theoreticalStocks: [], suppliedProducts: [], physicalProducts: [], plannedLocalProductionFlows: [], plannedLocalConsumptionFlows: [])
79
+ super(semanticId)
80
+ @name = name
81
+ @description = description
82
+ @images = images
83
+ @quantity = quantity
84
+ @cost = cost
85
+ @theoreticalStocks = theoreticalStocks
86
+ @suppliedProducts = suppliedProducts
87
+ @physicalProducts = physicalProducts
88
+ @plannedLocalProductionFlows = plannedLocalProductionFlows
89
+ @plannedLocalConsumptionFlows = plannedLocalConsumptionFlows
90
+ self.semanticType = "dfc-b:LocalizedProduct"
91
+ registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
92
+ registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
93
+ registerSemanticProperty("dfc-b:image", &method("images")).valueSetter = method("images=")
94
+ registerSemanticProperty("dfc-b:hasQuantity", &method("quantity")).valueSetter = method("quantity=")
95
+ registerSemanticProperty("dfc-b:cost", &method("cost")).valueSetter = method("cost=")
96
+ registerSemanticProperty("dfc-b:constituedBy", &method("theoreticalStocks")).valueSetter = method("theoreticalStocks=")
97
+ registerSemanticProperty("dfc-b:hasReference", &method("suppliedProducts")).valueSetter = method("suppliedProducts=")
98
+ registerSemanticProperty("dfc-b:representedBy", &method("physicalProducts")).valueSetter = method("physicalProducts=")
99
+ registerSemanticProperty("dfc-b:producedBy", &method("plannedLocalProductionFlows")).valueSetter = method("plannedLocalProductionFlows=")
100
+ registerSemanticProperty("dfc-b:consumedBy", &method("plannedLocalConsumptionFlows")).valueSetter = method("plannedLocalConsumptionFlows=")
101
+ end
102
+
103
+
104
+
105
+ end
@@ -0,0 +1,70 @@
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
+ require "virtual_assembly/semantizer"
26
+
27
+ class DataFoodConsortium::Connector::PaymentMethod
28
+ include VirtualAssembly::Semantizer::SemanticObject
29
+
30
+ SEMANTIC_TYPE = "dfc-b:PaymentMethod".freeze
31
+
32
+ # @return [String]
33
+ attr_accessor :name
34
+
35
+ # @return [String]
36
+ attr_accessor :description
37
+
38
+ # @return [IPrice]
39
+ attr_accessor :price
40
+
41
+ # @return [String]
42
+ attr_accessor :provider
43
+
44
+ # @return [String]
45
+ attr_accessor :type
46
+
47
+ # @param semanticId [String]
48
+ # @param name [String]
49
+ # @param description [String]
50
+ # @param price [IPrice]
51
+ # @param provider [String]
52
+ # @param type [String]
53
+ def initialize(semanticId, name: nil, description: nil, price: nil, provider: nil, type: nil)
54
+ super(semanticId)
55
+ @name = name
56
+ @description = description
57
+ @price = price
58
+ @provider = provider
59
+ @type = type
60
+ self.semanticType = "dfc-b:PaymentMethod"
61
+ registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
62
+ registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
63
+ registerSemanticProperty("dfc-b:hasPrice", &method("price")).valueSetter = method("price=")
64
+ registerSemanticProperty("dfc-b:paymentMethodProvider", &method("provider")).valueSetter = method("provider=")
65
+ registerSemanticProperty("dfc-b:paymentMethodType", &method("type")).valueSetter = method("type=")
66
+ end
67
+
68
+
69
+
70
+ end
@@ -0,0 +1,94 @@
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
+ require "virtual_assembly/semantizer"
26
+
27
+ class DataFoodConsortium::Connector::PhysicalPlace
28
+ include VirtualAssembly::Semantizer::SemanticObject
29
+
30
+ SEMANTIC_TYPE = "dfc-b:PhysicalPlace".freeze
31
+
32
+ # @return [String]
33
+ attr_accessor :name
34
+
35
+ # @return [String]
36
+ attr_accessor :description
37
+
38
+ # @return [ISaleSession]
39
+ attr_accessor :hostedSaleSessions
40
+
41
+ # @return [IPhoneNumber]
42
+ attr_accessor :phoneNumbers
43
+
44
+ # @return [IOpeningHoursSpecification]
45
+ attr_accessor :openingHours
46
+
47
+ # @return [IAddress]
48
+ attr_accessor :addresses
49
+
50
+ # @return [IPerson]
51
+ attr_accessor :mainContact
52
+
53
+ # @return [ITheoreticalStock]
54
+ attr_accessor :theoreticalStocks
55
+
56
+ # @return [IRealStock]
57
+ attr_accessor :realStocks
58
+
59
+ # @param semanticId [String]
60
+ # @param name [String]
61
+ # @param description [String]
62
+ # @param hostedSaleSessions [ISaleSession]
63
+ # @param phoneNumbers [IPhoneNumber]
64
+ # @param openingHours [IOpeningHoursSpecification]
65
+ # @param addresses [IAddress]
66
+ # @param mainContact [IPerson]
67
+ # @param theoreticalStocks [ITheoreticalStock]
68
+ # @param realStocks [IRealStock]
69
+ def initialize(semanticId, name: nil, description: nil, hostedSaleSessions: [], phoneNumbers: [], openingHours: [], addresses: [], mainContact: nil, theoreticalStocks: [], realStocks: [])
70
+ super(semanticId)
71
+ @name = name
72
+ @description = description
73
+ @hostedSaleSessions = hostedSaleSessions
74
+ @phoneNumbers = phoneNumbers
75
+ @openingHours = openingHours
76
+ @addresses = addresses
77
+ @mainContact = mainContact
78
+ @theoreticalStocks = theoreticalStocks
79
+ @realStocks = realStocks
80
+ self.semanticType = "dfc-b:PhysicalPlace"
81
+ registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
82
+ registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
83
+ registerSemanticProperty("dfc-b:hosts", &method("hostedSaleSessions")).valueSetter = method("hostedSaleSessions=")
84
+ registerSemanticProperty("dfc-b:hasPhoneNumber", &method("phoneNumbers")).valueSetter = method("phoneNumbers=")
85
+ registerSemanticProperty("dfc-b:hasOpeningHours", &method("openingHours")).valueSetter = method("openingHours=")
86
+ registerSemanticProperty("dfc-b:hasAddress", &method("addresses")).valueSetter = method("addresses=")
87
+ registerSemanticProperty("dfc-b:hasMainContact", &method("mainContact")).valueSetter = method("mainContact=")
88
+ registerSemanticProperty("dfc-b:localizes", &method("theoreticalStocks")).valueSetter = method("theoreticalStocks=")
89
+ registerSemanticProperty("dfc-b:stores", &method("realStocks")).valueSetter = method("realStocks=")
90
+ end
91
+
92
+
93
+
94
+ end
@@ -0,0 +1,104 @@
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
+
27
+
28
+
29
+ require "virtual_assembly/semantizer"
30
+
31
+ class DataFoodConsortium::Connector::PhysicalProduct
32
+ include VirtualAssembly::Semantizer::SemanticObject
33
+
34
+ SEMANTIC_TYPE = "dfc-b:PhysicalProduct".freeze
35
+
36
+ # @return [String]
37
+ attr_accessor :name
38
+
39
+ # @return [String]
40
+ attr_accessor :description
41
+
42
+ # @return [String]
43
+ attr_accessor :images
44
+
45
+ # @return [IQuantity]
46
+ attr_accessor :quantity
47
+
48
+ # @return [Real]
49
+ attr_accessor :cost
50
+
51
+ # @return [Real]
52
+ attr_accessor :realStocks
53
+
54
+ # @return [ILocalizedProduct]
55
+ attr_accessor :localizedProducts
56
+
57
+ # @return [IProductBatch]
58
+ attr_accessor :productBatches
59
+
60
+ # @return [IRealizedProductionFlow]
61
+ attr_accessor :realizedProductionFlows
62
+
63
+ # @return [IRealizedConsumptionFlow]
64
+ attr_accessor :realizedConsumptionFlows
65
+
66
+ # @param semanticId [String]
67
+ # @param name [String]
68
+ # @param description [String]
69
+ # @param images [String]
70
+ # @param quantity [IQuantity]
71
+ # @param cost [Real]
72
+ # @param realStocks [Real]
73
+ # @param localizedProducts [ILocalizedProduct]
74
+ # @param productBatches [IProductBatch]
75
+ # @param realizedProductionFlows [IRealizedProductionFlow]
76
+ # @param realizedConsumptionFlows [IRealizedConsumptionFlow]
77
+ def initialize(semanticId, name: nil, description: nil, images: [], quantity: nil, cost: nil, realStocks: [], localizedProducts: [], productBatches: [], realizedProductionFlows: [], realizedConsumptionFlows: [])
78
+ super(semanticId)
79
+ @name = name
80
+ @description = description
81
+ @images = images
82
+ @quantity = quantity
83
+ @cost = cost
84
+ @realStocks = realStocks
85
+ @localizedProducts = localizedProducts
86
+ @productBatches = productBatches
87
+ @realizedProductionFlows = realizedProductionFlows
88
+ @realizedConsumptionFlows = realizedConsumptionFlows
89
+ self.semanticType = "dfc-b:PhysicalProduct"
90
+ registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
91
+ registerSemanticProperty("dfc-b:description", &method("description")).valueSetter = method("description=")
92
+ registerSemanticProperty("dfc-b:image", &method("images")).valueSetter = method("images=")
93
+ registerSemanticProperty("dfc-b:hasQuantity", &method("quantity")).valueSetter = method("quantity=")
94
+ registerSemanticProperty("dfc-b:cost", &method("cost")).valueSetter = method("cost=")
95
+ registerSemanticProperty("dfc-b:constituedBy", &method("realStocks")).valueSetter = method("realStocks=")
96
+ registerSemanticProperty("dfc-b:represents", &method("localizedProducts")).valueSetter = method("localizedProducts=")
97
+ registerSemanticProperty("dfc-b:tracedBy", &method("productBatches")).valueSetter = method("productBatches=")
98
+ registerSemanticProperty("dfc-b:producedBy", &method("realizedProductionFlows")).valueSetter = method("realizedProductionFlows=")
99
+ registerSemanticProperty("dfc-b:consumedBy", &method("realizedConsumptionFlows")).valueSetter = method("realizedConsumptionFlows=")
100
+ end
101
+
102
+
103
+
104
+ end
@@ -0,0 +1,55 @@
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::PickupOption < DataFoodConsortium::Connector::ShippingOption
30
+
31
+ SEMANTIC_TYPE = "dfc-b:PickupOption".freeze
32
+
33
+ # @return [IPhysicalPlace]
34
+ attr_accessor :pickupPlace
35
+
36
+ # @param semanticId [String]
37
+ # @param pickupPlace [IPhysicalPlace]
38
+ # @param name [String]
39
+ # @param description [String]
40
+ # @param fee [Real]
41
+ # @param quantity [IQuantity]
42
+ # @param order [IOrder]
43
+ # @param saleSession [ISaleSession]
44
+ # @param beginDate [DateTime]
45
+ # @param endDate [DateTime]
46
+ def initialize(semanticId, pickupPlace: nil, name: nil, description: nil, fee: nil, quantity: nil, order: nil, saleSession: nil, beginDate: nil, endDate: nil)
47
+ super(semanticId, name: name, description: description, fee: fee, quantity: quantity, order: order, saleSession: saleSession, beginDate: beginDate, endDate: endDate)
48
+ @pickupPlace = pickupPlace
49
+ self.semanticType = "dfc-b:PickupOption"
50
+ registerSemanticProperty("dfc-b:pickedUpAt", &method("pickupPlace")).valueSetter = method("pickupPlace=")
51
+ end
52
+
53
+
54
+
55
+ end
@@ -0,0 +1,56 @@
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/flow"
24
+
25
+
26
+
27
+
28
+
29
+ require "virtual_assembly/semantizer"
30
+
31
+ class DataFoodConsortium::Connector::PlannedLocalConsumptionFlow < DataFoodConsortium::Connector::Flow
32
+
33
+ SEMANTIC_TYPE = "dfc-b:AsPlannedLocalConsumptionFlow".freeze
34
+
35
+ # @return [IPlannedLocalTransformation]
36
+ attr_accessor :transformation
37
+
38
+ # @return [ILocalizedProduct]
39
+ attr_accessor :product
40
+
41
+ # @param semanticId [String]
42
+ # @param transformation [IPlannedLocalTransformation]
43
+ # @param product [ILocalizedProduct]
44
+ # @param quantity [IQuantity]
45
+ def initialize(semanticId, transformation: nil, product: nil, quantity: nil)
46
+ super(semanticId, quantity: quantity)
47
+ @transformation = transformation
48
+ @product = product
49
+ self.semanticType = "dfc-b:AsPlannedLocalConsumptionFlow"
50
+ registerSemanticProperty("dfc-b:incomeOf", &method("transformation")).valueSetter = method("transformation=")
51
+ registerSemanticProperty("dfc-b:consumes", &method("product")).valueSetter = method("product=")
52
+ end
53
+
54
+
55
+
56
+ end
@@ -0,0 +1,56 @@
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/flow"
24
+
25
+
26
+
27
+
28
+
29
+ require "virtual_assembly/semantizer"
30
+
31
+ class DataFoodConsortium::Connector::PlannedLocalProductionFlow < DataFoodConsortium::Connector::Flow
32
+
33
+ SEMANTIC_TYPE = "dfc-b:AsPlannedLocalProductionFlow".freeze
34
+
35
+ # @return [IPlannedLocalTransformation]
36
+ attr_accessor :transformation
37
+
38
+ # @return [ILocalizedProduct]
39
+ attr_accessor :product
40
+
41
+ # @param semanticId [String]
42
+ # @param transformation [IPlannedLocalTransformation]
43
+ # @param product [ILocalizedProduct]
44
+ # @param quantity [IQuantity]
45
+ def initialize(semanticId, transformation: nil, product: nil, quantity: nil)
46
+ super(semanticId, quantity: quantity)
47
+ @transformation = transformation
48
+ @product = product
49
+ self.semanticType = "dfc-b:AsPlannedLocalProductionFlow"
50
+ registerSemanticProperty("dfc-b:outcomeOf", &method("transformation")).valueSetter = method("transformation=")
51
+ registerSemanticProperty("dfc-b:produces", &method("product")).valueSetter = method("product=")
52
+ end
53
+
54
+
55
+
56
+ end
@@ -0,0 +1,79 @@
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
+
27
+
28
+ require "virtual_assembly/semantizer"
29
+
30
+ class DataFoodConsortium::Connector::PlannedLocalTransformation
31
+ include VirtualAssembly::Semantizer::SemanticObject
32
+
33
+ SEMANTIC_TYPE = "dfc-b:AsPlannedLocalTransformation".freeze
34
+
35
+ # @return [ISKOSConcept]
36
+ attr_accessor :transformationType
37
+
38
+ # @return [Real]
39
+ attr_accessor :cost
40
+
41
+ # @return [DateTime]
42
+ attr_accessor :startDate
43
+
44
+ # @return [DateTime]
45
+ attr_accessor :endDate
46
+
47
+ # @return [IPlannedLocalConsumptionFlow]
48
+ attr_accessor :consumptionFlow
49
+
50
+ # @return [IPlannedLocalProductionFlow]
51
+ attr_accessor :productionFlow
52
+
53
+ # @param semanticId [String]
54
+ # @param transformationType [ISKOSConcept]
55
+ # @param cost [Real]
56
+ # @param startDate [DateTime]
57
+ # @param endDate [DateTime]
58
+ # @param consumptionFlow [IPlannedLocalConsumptionFlow]
59
+ # @param productionFlow [IPlannedLocalProductionFlow]
60
+ def initialize(semanticId, transformationType: nil, cost: nil, startDate: nil, endDate: nil, consumptionFlow: nil, productionFlow: nil)
61
+ super(semanticId)
62
+ @transformationType = transformationType
63
+ @cost = cost
64
+ @startDate = startDate
65
+ @endDate = endDate
66
+ @consumptionFlow = consumptionFlow
67
+ @productionFlow = productionFlow
68
+ self.semanticType = "dfc-b:AsPlannedLocalTransformation"
69
+ registerSemanticProperty("dfc-b:hasTransformationType", &method("transformationType")).valueSetter = method("transformationType=")
70
+ registerSemanticProperty("dfc-b:cost", &method("cost")).valueSetter = method("cost=")
71
+ registerSemanticProperty("dfc-b:startDate", &method("startDate")).valueSetter = method("startDate=")
72
+ registerSemanticProperty("dfc-b:endDate", &method("endDate")).valueSetter = method("endDate=")
73
+ registerSemanticProperty("dfc-b:hasIncome", &method("consumptionFlow")).valueSetter = method("consumptionFlow=")
74
+ registerSemanticProperty("dfc-b:hasOutcome", &method("productionFlow")).valueSetter = method("productionFlow=")
75
+ end
76
+
77
+
78
+
79
+ end
@@ -23,6 +23,7 @@
23
23
 
24
24
 
25
25
 
26
+
26
27
  require "virtual_assembly/semantizer"
27
28
 
28
29
  class DataFoodConsortium::Connector::PlannedTransformation