datafoodconsortium-connector 1.0.0.pre.alpha.7 → 1.0.0.pre.alpha.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/datafoodconsortium/connector/address.rb +5 -5
  3. data/lib/datafoodconsortium/connector/agent.rb +29 -31
  4. data/lib/datafoodconsortium/connector/allergen_characteristic.rb +5 -6
  5. data/lib/datafoodconsortium/connector/catalog.rb +53 -0
  6. data/lib/datafoodconsortium/connector/catalog_item.rb +13 -10
  7. data/lib/datafoodconsortium/connector/characteristic.rb +1 -2
  8. data/lib/datafoodconsortium/connector/connector.rb +3 -3
  9. data/lib/datafoodconsortium/connector/customer_category.rb +2 -2
  10. data/lib/datafoodconsortium/connector/defined_product.rb +31 -111
  11. data/lib/datafoodconsortium/connector/enterprise.rb +42 -22
  12. data/lib/datafoodconsortium/connector/nutrient_characteristic.rb +6 -7
  13. data/lib/datafoodconsortium/connector/offer.rb +6 -6
  14. data/lib/datafoodconsortium/connector/order.rb +39 -1
  15. data/lib/datafoodconsortium/connector/order_line.rb +39 -1
  16. data/lib/datafoodconsortium/connector/person.rb +14 -20
  17. data/lib/datafoodconsortium/connector/phone_number.rb +50 -0
  18. data/lib/datafoodconsortium/connector/physical_characteristic.rb +6 -7
  19. data/lib/datafoodconsortium/connector/price.rb +7 -6
  20. data/lib/datafoodconsortium/connector/quantitative_value.rb +5 -5
  21. data/lib/datafoodconsortium/connector/quantity.rb +50 -0
  22. data/lib/datafoodconsortium/connector/sale_session.rb +63 -0
  23. data/lib/datafoodconsortium/connector/skos_concept.rb +8 -31
  24. data/lib/datafoodconsortium/connector/skos_parser.rb +1 -2
  25. data/lib/datafoodconsortium/connector/social_media.rb +54 -0
  26. data/lib/datafoodconsortium/connector/supplied_product.rb +20 -13
  27. data/lib/datafoodconsortium/connector/technical_product.rb +59 -0
  28. data/lib/datafoodconsortium/connector.rb +17 -20
  29. metadata +8 -2
@@ -21,13 +21,51 @@
21
21
  # SOFTWARE.
22
22
 
23
23
 
24
+
25
+
26
+
24
27
  require "virtual_assembly/semantizer"
25
28
 
26
29
  class DataFoodConsortium::Connector::Order
27
30
 
28
-
31
+ include VirtualAssembly::Semantizer::SemanticObject
32
+
33
+ # @return [String]
34
+ attr_accessor :number
29
35
 
36
+ # @return [String]
37
+ attr_accessor :date
30
38
 
39
+ # @return [ISaleSession]
40
+ attr_accessor :saleSession
41
+
42
+ # @return [IOrderLine]
43
+ attr_accessor :lines
44
+
45
+ # @return [IAgent]
46
+ attr_accessor :client
47
+
48
+ # @param semanticId [String]
49
+ # @param number [String]
50
+ # @param date [String]
51
+ # @param saleSession [ISaleSession]
52
+ # @param lines [IOrderLine]
53
+ # @param client [IAgent]
54
+ def initialize(semanticId, number: "", date: "", saleSession: nil, lines: [], client: nil)
55
+ super(semanticId)
56
+ @number = number
57
+ @date = date
58
+ @saleSession = saleSession
59
+ @lines = lines
60
+ @client = client
61
+ self.semanticType = "dfc-b:Order"
62
+ registerSemanticProperty("dfc-b:orderNumber") { self.number }
63
+ registerSemanticProperty("dfc-b:date") { self.date }
64
+ registerSemanticProperty("dfc-b:belongsTo") { self.saleSession }
65
+ registerSemanticProperty("dfc-b:hasPart") { self.lines }
66
+ registerSemanticProperty("dfc-b:orderedBy") { self.client }
67
+ end
68
+
31
69
 
32
70
 
33
71
  end
@@ -21,13 +21,51 @@
21
21
  # SOFTWARE.
22
22
 
23
23
 
24
+
25
+
26
+
24
27
  require "virtual_assembly/semantizer"
25
28
 
26
29
  class DataFoodConsortium::Connector::OrderLine
27
30
 
28
-
31
+ include VirtualAssembly::Semantizer::SemanticObject
32
+
33
+ # @return [String]
34
+ attr_accessor :description
29
35
 
36
+ # @return [Real]
37
+ attr_accessor :quantity
30
38
 
39
+ # @return [IPrice]
40
+ attr_accessor :price
41
+
42
+ # @return [IOffer]
43
+ attr_accessor :offer
44
+
45
+ # @return [IOrder]
46
+ attr_accessor :order
47
+
48
+ # @param semanticId [String]
49
+ # @param description [String]
50
+ # @param quantity [Real]
51
+ # @param price [IPrice]
52
+ # @param offer [IOffer]
53
+ # @param order [IOrder]
54
+ def initialize(semanticId, description: "", quantity: 0.0, price: nil, offer: nil, order: nil)
55
+ super(semanticId)
56
+ @description = description
57
+ @quantity = quantity
58
+ @price = price
59
+ @offer = offer
60
+ @order = order
61
+ self.semanticType = "dfc-b:OrderLine"
62
+ registerSemanticProperty("dfc-b:description") { self.description }
63
+ registerSemanticProperty("dfc-b:quantity") { self.quantity }
64
+ registerSemanticProperty("dfc-b:hasPrice") { self.price }
65
+ registerSemanticProperty("dfc-b:concerns") { self.offer }
66
+ registerSemanticProperty("dfc-b:partOf") { self.order }
67
+ end
68
+
31
69
 
32
70
 
33
71
  end
@@ -22,6 +22,7 @@
22
22
 
23
23
 
24
24
 
25
+
25
26
  require "datafoodconsortium/connector/agent"
26
27
  require "virtual_assembly/semantizer"
27
28
 
@@ -35,36 +36,29 @@ class DataFoodConsortium::Connector::Person < DataFoodConsortium::Connector::Age
35
36
  # @return [String]
36
37
  attr_accessor :lastName
37
38
 
38
- # @return [Onboardable]
39
+ # @return [IEnterprise]
39
40
  attr_accessor :affiliatedOrganizations
40
41
 
41
42
  # @param semanticId [String]
42
43
  # @param firstName [String]
43
44
  # @param lastName [String]
44
- # @param affiliatedOrganizations [Onboardable]
45
- # @param contacts [Contactable]
46
- # @param localizations [Localizable]
47
- def initialize(semanticId, firstName: "", lastName: "", affiliatedOrganizations: [], contacts: [], localizations: [])
48
- super(semanticId, contacts: contacts, localizations: localizations)
45
+ # @param affiliatedOrganizations [IEnterprise]
46
+ # @param localizations [IAddress]
47
+ # @param phoneNumbers [IPhoneNumber]
48
+ # @param emails [String]
49
+ # @param websites [String]
50
+ # @param socialMedias [ISocialMedia]
51
+ def initialize(semanticId, firstName: "", lastName: "", affiliatedOrganizations: [], localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [])
52
+ super(semanticId, localizations: localizations, phoneNumbers: phoneNumbers, emails: emails, websites: websites, socialMedias: socialMedias)
49
53
  @firstName = firstName
50
54
  @lastName = lastName
51
55
  @affiliatedOrganizations = affiliatedOrganizations
52
- self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#Person"
53
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#firstName") { self.firstName }
54
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#familyName") { self.lastName }
55
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#affiliates") { self.affiliatedOrganizations }
56
+ self.semanticType = "dfc-b:Person"
57
+ registerSemanticProperty("dfc-b:firstName") { self.firstName }
58
+ registerSemanticProperty("dfc-b:familyName") { self.lastName }
59
+ registerSemanticProperty("dfc-b:affiliates") { self.affiliatedOrganizations }
56
60
  end
57
61
 
58
62
 
59
-
60
- def affiliateTo(organization)
61
- self.affiliatedOrganizations.push(organization)
62
- end
63
-
64
-
65
- def leaveAffiliatedOrganization(organization)
66
- raise "Not yet implemented."
67
- end
68
-
69
63
 
70
64
  end
@@ -0,0 +1,50 @@
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::PhoneNumber
27
+
28
+ include VirtualAssembly::Semantizer::SemanticObject
29
+
30
+ # @return [Integer]
31
+ attr_accessor :countryCode
32
+
33
+ # @return [String]
34
+ attr_accessor :phoneNumber
35
+
36
+ # @param semanticId [String]
37
+ # @param countryCode [Integer]
38
+ # @param phoneNumber [String]
39
+ def initialize(semanticId, countryCode: 0, phoneNumber: "")
40
+ super(semanticId)
41
+ @countryCode = countryCode
42
+ @phoneNumber = phoneNumber
43
+ self.semanticType = "dfc-b:PhoneNumber"
44
+ registerSemanticProperty("dfc-b:countryCode") { self.countryCode }
45
+ registerSemanticProperty("dfc-b:phoneNumber") { self.phoneNumber }
46
+ end
47
+
48
+
49
+
50
+ end
@@ -20,27 +20,26 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require "datafoodconsortium/connector/characteristic"
24
-
25
23
 
26
24
 
25
+ require "datafoodconsortium/connector/characteristic"
27
26
  require "virtual_assembly/semantizer"
28
27
 
29
28
  class DataFoodConsortium::Connector::PhysicalCharacteristic < DataFoodConsortium::Connector::Characteristic
30
29
 
31
30
 
32
31
 
33
- # @return [IPhysicalDimension]
32
+ # @return [ISKOSConcept]
34
33
  attr_accessor :physicalDimension
35
34
 
36
- # @param physicalDimension [IPhysicalDimension]
37
- # @param unit [IUnit]
35
+ # @param physicalDimension [ISKOSConcept]
36
+ # @param unit [ISKOSConcept]
38
37
  # @param value [Real]
39
38
  def initialize(physicalDimension: nil, unit: nil, value: 0.0)
40
39
  super(unit: unit, value: value)
41
40
  @physicalDimension = physicalDimension
42
- self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#PhysicalCharacteristic"
43
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#hasPhysicalDimension") { self.physicalDimension }
41
+ self.semanticType = "dfc-b:PhysicalCharacteristic"
42
+ registerSemanticProperty("dfc-b:hasPhysicalDimension") { self.physicalDimension }
44
43
  end
45
44
 
46
45
 
@@ -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::Price
@@ -33,21 +34,21 @@ class DataFoodConsortium::Connector::Price
33
34
  # @return [Real]
34
35
  attr_accessor :vatRate
35
36
 
36
- # @return [IUnit]
37
+ # @return [ISKOSConcept]
37
38
  attr_accessor :unit
38
39
 
39
40
  # @param value [Real]
40
41
  # @param vatRate [Real]
41
- # @param unit [IUnit]
42
+ # @param unit [ISKOSConcept]
42
43
  def initialize(value: 0.0, vatRate: 0.0, unit: nil)
43
44
  super()
44
45
  @value = value
45
46
  @vatRate = vatRate
46
47
  @unit = unit
47
- self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#Price"
48
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#value") { self.value }
49
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#VATrate") { self.vatRate }
50
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#hasUnit") { self.unit }
48
+ self.semanticType = "dfc-b:Price"
49
+ registerSemanticProperty("dfc-b:value") { self.value }
50
+ registerSemanticProperty("dfc-b:VATrate") { self.vatRate }
51
+ registerSemanticProperty("dfc-b:hasUnit") { self.unit }
51
52
  end
52
53
 
53
54
 
@@ -28,21 +28,21 @@ class DataFoodConsortium::Connector::QuantitativeValue
28
28
 
29
29
  include VirtualAssembly::Semantizer::SemanticObject
30
30
 
31
- # @return [IUnit]
31
+ # @return [ISKOSConcept]
32
32
  attr_accessor :unit
33
33
 
34
34
  # @return [Real]
35
35
  attr_accessor :value
36
36
 
37
- # @param unit [IUnit]
37
+ # @param unit [ISKOSConcept]
38
38
  # @param value [Real]
39
39
  def initialize(unit: nil, value: 0.0)
40
40
  super()
41
41
  @unit = unit
42
42
  @value = value
43
- self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#QuantitativeValue"
44
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#hasUnit") { self.unit }
45
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#value") { self.value }
43
+ self.semanticType = "dfc-b:QuantitativeValue"
44
+ registerSemanticProperty("dfc-b:hasUnit") { self.unit }
45
+ registerSemanticProperty("dfc-b:value") { self.value }
46
46
  end
47
47
 
48
48
 
@@ -0,0 +1,50 @@
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::Quantity
28
+
29
+ include VirtualAssembly::Semantizer::SemanticObject
30
+
31
+ # @return [ISKOSConcept]
32
+ attr_accessor :unit
33
+
34
+ # @return [Real]
35
+ attr_accessor :value
36
+
37
+ # @param unit [ISKOSConcept]
38
+ # @param value [Real]
39
+ def initialize(unit: nil, value: 0.0)
40
+ super()
41
+ @unit = unit
42
+ @value = value
43
+ self.semanticType = "dfc-b:Quantity"
44
+ registerSemanticProperty("dfc-b:hasUnit") { self.unit }
45
+ registerSemanticProperty("dfc-b:value") { self.value }
46
+ end
47
+
48
+
49
+
50
+ end
@@ -0,0 +1,63 @@
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::SaleSession
28
+
29
+ include VirtualAssembly::Semantizer::SemanticObject
30
+
31
+ # @return [String]
32
+ attr_accessor :beginDate
33
+
34
+ # @return [String]
35
+ attr_accessor :endDate
36
+
37
+ # @return [Real]
38
+ attr_accessor :quantity
39
+
40
+ # @return [IOffer]
41
+ attr_accessor :offers
42
+
43
+ # @param semanticId [String]
44
+ # @param beginDate [String]
45
+ # @param endDate [String]
46
+ # @param quantity [Real]
47
+ # @param offers [IOffer]
48
+ def initialize(semanticId, beginDate: "", endDate: "", quantity: 0.0, offers: [])
49
+ super(semanticId)
50
+ @beginDate = beginDate
51
+ @endDate = endDate
52
+ @quantity = quantity
53
+ @offers = offers
54
+ self.semanticType = "dfc-b:SaleSession"
55
+ registerSemanticProperty("dfc-b:beginDate") { self.beginDate }
56
+ registerSemanticProperty("dfc-b:endDate") { self.endDate }
57
+ registerSemanticProperty("dfc-b:quantity") { self.quantity }
58
+ registerSemanticProperty("dfc-b:lists") { self.offers }
59
+ end
60
+
61
+
62
+
63
+ end
@@ -41,47 +41,24 @@ class DataFoodConsortium::Connector::SKOSConcept
41
41
  # @return [ISKOSLabel]
42
42
  attr_accessor :prefLabels
43
43
 
44
+ # @param semanticId [String]
44
45
  # @param broaders [ISKOSConcept]
45
46
  # @param schemes [ISKOSConceptScheme]
46
47
  # @param narrowers [ISKOSConcept]
47
48
  # @param prefLabels [ISKOSLabel]
48
- def initialize(broaders: [], schemes: [], narrowers: [], prefLabels: [])
49
- super()
49
+ def initialize(semanticId, broaders: [], schemes: [], narrowers: [], prefLabels: [])
50
+ super(semanticId)
50
51
  @broaders = broaders
51
52
  @schemes = schemes
52
53
  @narrowers = narrowers
53
54
  @prefLabels = prefLabels
54
- self.semanticType = "http://www.w3.org/2004/02/skos/core#Concept"
55
- registerSemanticProperty("http://www.w3.org/2004/02/skos/core#broader") { self.broaders }
56
- registerSemanticProperty("http://www.w3.org/2004/02/skos/core#inScheme") { self.schemes }
57
- registerSemanticProperty("http://www.w3.org/2004/02/skos/core#narrower") { self.narrowers }
58
- registerSemanticProperty("http://www.w3.org/2004/02/skos/core#prefLabel") { self.prefLabels }
55
+ self.semanticType = "skos:Concept"
56
+ registerSemanticProperty("skos:broader") { self.broaders }
57
+ registerSemanticProperty("skos:inScheme") { self.schemes }
58
+ registerSemanticProperty("skos:narrower") { self.narrowers }
59
+ registerSemanticProperty("skos:prefLabel") { self.prefLabels }
59
60
  end
60
61
 
61
62
 
62
-
63
-
64
-
65
-
66
-
67
- def removeBroader(broader)
68
- raise "Not yet implemented."
69
- end
70
-
71
-
72
- def removeScheme(scheme)
73
- raise "Not yet implemented."
74
- end
75
-
76
-
77
- def removeNarrower(narrower)
78
- raise "Not yet implemented."
79
- end
80
-
81
-
82
- def removePrefLabel(prefLabel)
83
- raise "Not yet implemented."
84
- end
85
-
86
63
 
87
64
  end
@@ -85,8 +85,7 @@ class DataFoodConsortium::Connector::SKOSParser
85
85
  protected
86
86
 
87
87
  def createSKOSConcept(element)
88
- skosConcept = DataFoodConsortium::Connector::SKOSConcept.new
89
- skosConcept.semanticId = element.id
88
+ skosConcept = DataFoodConsortium::Connector::SKOSConcept.new(element.id)
90
89
  skosConcept.semanticType = element.type
91
90
  return skosConcept
92
91
  end
@@ -0,0 +1,54 @@
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::SocialMedia
27
+
28
+ include VirtualAssembly::Semantizer::SemanticObject
29
+
30
+ # @return [String]
31
+ attr_accessor :name
32
+
33
+ # @return [String]
34
+ attr_accessor :url
35
+
36
+ # @param semanticId [String]
37
+ # @param name [String]
38
+ # @param url [String]
39
+ def initialize(semanticId, name: "", url: "")
40
+ super(semanticId)
41
+ @name = name
42
+ @url = url
43
+ self.semanticType = "dfc-b:SocialMedia"
44
+ registerSemanticProperty("dfc-b:name") { self.name }
45
+ registerSemanticProperty("dfc-b:URL") { self.url }
46
+ end
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ end
@@ -21,6 +21,13 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require "datafoodconsortium/connector/defined_product"
24
+
25
+
26
+
27
+
28
+
29
+
30
+
24
31
  require "virtual_assembly/semantizer"
25
32
 
26
33
  class DataFoodConsortium::Connector::SuppliedProduct < DataFoodConsortium::Connector::DefinedProduct
@@ -30,35 +37,35 @@ class DataFoodConsortium::Connector::SuppliedProduct < DataFoodConsortium::Conne
30
37
  # @return [Real]
31
38
  attr_accessor :totalTheoreticalStock
32
39
 
40
+
41
+
42
+
43
+
33
44
  # @param semanticId [String]
34
45
  # @param totalTheoreticalStock [Real]
35
46
  # @param name [String]
36
47
  # @param description [String]
37
- # @param productType [IProductType]
38
- # @param quantity [Quantifiable]
48
+ # @param productType [ISKOSConcept]
49
+ # @param quantity [IQuantity]
39
50
  # @param alcoholPercentage [Real]
40
51
  # @param lifetime [String]
41
- # @param claims [Claimable]
52
+ # @param claims [ISKOSConcept]
42
53
  # @param usageOrStorageConditions [String]
43
54
  # @param allergenCharacteristics [IAllergenCharacteristic]
44
55
  # @param nutrientCharacteristics [INutrientCharacteristic]
45
56
  # @param physicalCharacteristics [IPhysicalCharacteristic]
46
- # @param geographicalOrigin [IGeographicalOrigin]
57
+ # @param geographicalOrigin [ISKOSConcept]
47
58
  # @param catalogItems [ICatalogItem]
48
- # @param certifications [ICertification]
49
- # @param natureOrigin [INatureOrigin]
50
- # @param partOrigin [IPartOrigin]
59
+ # @param certifications [ISKOSConcept]
60
+ # @param natureOrigin [ISKOSConcept]
61
+ # @param partOrigin [ISKOSConcept]
51
62
  def initialize(semanticId, totalTheoreticalStock: 0.0, name: "", description: "", productType: nil, quantity: nil, alcoholPercentage: 0.0, lifetime: "", claims: [], usageOrStorageConditions: "", allergenCharacteristics: [], nutrientCharacteristics: [], physicalCharacteristics: [], geographicalOrigin: nil, catalogItems: [], certifications: [], natureOrigin: [], partOrigin: [])
52
63
  super(semanticId, name: name, description: description, productType: productType, quantity: quantity, alcoholPercentage: alcoholPercentage, lifetime: lifetime, claims: claims, usageOrStorageConditions: usageOrStorageConditions, allergenCharacteristics: allergenCharacteristics, nutrientCharacteristics: nutrientCharacteristics, physicalCharacteristics: physicalCharacteristics, geographicalOrigin: geographicalOrigin, catalogItems: catalogItems, certifications: certifications, natureOrigin: natureOrigin, partOrigin: partOrigin)
53
64
  @totalTheoreticalStock = totalTheoreticalStock
54
- self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#SuppliedProduct"
55
- registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#totalTheoreticalStock") { self.totalTheoreticalStock }
65
+ self.semanticType = "dfc-b:SuppliedProduct"
66
+ registerSemanticProperty("dfc-b:totalTheoreticalStock") { self.totalTheoreticalStock }
56
67
  end
57
68
 
58
69
 
59
-
60
-
61
-
62
-
63
70
 
64
71
  end
@@ -0,0 +1,59 @@
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 "datafoodconsortium/connector/defined_product"
26
+ require "virtual_assembly/semantizer"
27
+
28
+ class DataFoodConsortium::Connector::TechnicalProduct < DataFoodConsortium::Connector::DefinedProduct
29
+
30
+
31
+
32
+
33
+ # @param semanticId [String]
34
+ # @param name [String]
35
+ # @param description [String]
36
+ # @param productType [ISKOSConcept]
37
+ # @param quantity [IQuantity]
38
+ # @param alcoholPercentage [Real]
39
+ # @param lifetime [String]
40
+ # @param claims [ISKOSConcept]
41
+ # @param usageOrStorageConditions [String]
42
+ # @param allergenCharacteristics [IAllergenCharacteristic]
43
+ # @param nutrientCharacteristics [INutrientCharacteristic]
44
+ # @param physicalCharacteristics [IPhysicalCharacteristic]
45
+ # @param geographicalOrigin [ISKOSConcept]
46
+ # @param catalogItems [ICatalogItem]
47
+ # @param certifications [ISKOSConcept]
48
+ # @param natureOrigin [ISKOSConcept]
49
+ # @param partOrigin [ISKOSConcept]
50
+ def initialize(semanticId, name: "", description: "", productType: nil, quantity: nil, alcoholPercentage: 0.0, lifetime: "", claims: [], usageOrStorageConditions: "", allergenCharacteristics: [], nutrientCharacteristics: [], physicalCharacteristics: [], geographicalOrigin: nil, catalogItems: [], certifications: [], natureOrigin: [], partOrigin: [])
51
+ super(semanticId, name: name, description: description, productType: productType, quantity: quantity, alcoholPercentage: alcoholPercentage, lifetime: lifetime, claims: claims, usageOrStorageConditions: usageOrStorageConditions, allergenCharacteristics: allergenCharacteristics, nutrientCharacteristics: nutrientCharacteristics, physicalCharacteristics: physicalCharacteristics, geographicalOrigin: geographicalOrigin, catalogItems: catalogItems, certifications: certifications, natureOrigin: natureOrigin, partOrigin: partOrigin)
52
+
53
+ self.semanticType = "dfc-b:TechnicalProduct"
54
+
55
+ end
56
+
57
+
58
+
59
+ end