datafoodconsortium-connector 1.0.0.pre.alpha.9 → 1.0.0.pre.alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/datafoodconsortium/connector/address.rb +25 -6
- data/lib/datafoodconsortium/connector/agent.rb +14 -7
- data/lib/datafoodconsortium/connector/allergen_characteristic.rb +3 -3
- data/lib/datafoodconsortium/connector/catalog.rb +4 -3
- data/lib/datafoodconsortium/connector/catalog_item.rb +7 -6
- data/lib/datafoodconsortium/connector/characteristic.rb +1 -3
- data/lib/datafoodconsortium/connector/connector.rb +10 -9
- data/lib/datafoodconsortium/connector/context.rb +72 -0
- data/lib/datafoodconsortium/connector/customer_category.rb +3 -2
- data/lib/datafoodconsortium/connector/defined_product.rb +25 -18
- data/lib/datafoodconsortium/connector/enterprise.rb +14 -13
- data/lib/datafoodconsortium/connector/{allergen_dimension.rb → flow.rb} +15 -3
- data/lib/datafoodconsortium/connector/importer.rb +112 -0
- data/lib/datafoodconsortium/connector/json_ld_serializer.rb +7 -14
- data/lib/datafoodconsortium/connector/nutrient_characteristic.rb +2 -2
- data/lib/datafoodconsortium/connector/offer.rb +6 -5
- data/lib/datafoodconsortium/connector/order.rb +26 -7
- data/lib/datafoodconsortium/connector/order_line.rb +7 -6
- data/lib/datafoodconsortium/connector/person.rb +8 -7
- data/lib/datafoodconsortium/connector/phone_number.rb +4 -3
- data/lib/datafoodconsortium/connector/physical_characteristic.rb +3 -3
- data/lib/datafoodconsortium/connector/{certification.rb → planned_consumption_flow.rb} +25 -3
- data/lib/datafoodconsortium/connector/{characteristic_dimension.rb → planned_production_flow.rb} +25 -3
- data/lib/datafoodconsortium/connector/planned_transformation.rb +59 -0
- data/lib/datafoodconsortium/connector/price.rb +5 -4
- data/lib/datafoodconsortium/connector/quantitative_value.rb +4 -3
- data/lib/datafoodconsortium/connector/quantity.rb +4 -3
- data/lib/datafoodconsortium/connector/sale_session.rb +6 -5
- data/lib/datafoodconsortium/connector/skos_concept.rb +10 -7
- data/lib/datafoodconsortium/connector/skos_helper.rb +14 -0
- data/lib/datafoodconsortium/connector/skos_parser.rb +122 -99
- data/lib/datafoodconsortium/connector/skos_parser_element.rb +72 -53
- data/lib/datafoodconsortium/connector/social_media.rb +4 -7
- data/lib/datafoodconsortium/connector/supplied_product.rb +5 -4
- data/lib/datafoodconsortium/connector/technical_product.rb +5 -4
- data/lib/datafoodconsortium/connector.rb +23 -13
- metadata +13 -41
- data/lib/datafoodconsortium/connector/geographical_origin.rb +0 -34
- data/lib/datafoodconsortium/connector/nature_origin.rb +0 -34
- data/lib/datafoodconsortium/connector/part_origin.rb +0 -34
- data/lib/datafoodconsortium/connector/product_type.rb +0 -34
- data/lib/datafoodconsortium/connector/repository.rb +0 -33
- data/lib/datafoodconsortium/connector/unit.rb +0 -34
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# MIT License
|
2
|
-
#
|
4
|
+
#
|
3
5
|
# Copyright (c) 2023 Maxime Lecoq <maxime@lecoqlibre.fr>
|
4
|
-
#
|
6
|
+
#
|
5
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
8
|
# of this software and associated documentation files (the "Software"), to deal
|
7
9
|
# in the Software without restriction, including without limitation the rights
|
8
10
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
11
|
# copies of the Software, and to permit persons to whom the Software is
|
10
12
|
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
13
|
+
#
|
12
14
|
# The above copyright notice and this permission notice shall be included in all
|
13
15
|
# copies or substantial portions of the Software.
|
14
|
-
#
|
16
|
+
#
|
15
17
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
18
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
19
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -20,124 +22,145 @@
|
|
20
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
23
|
# SOFTWARE.
|
22
24
|
|
25
|
+
require 'datafoodconsortium/connector/skos_helper'
|
23
26
|
require 'datafoodconsortium/connector/skos_concept'
|
24
27
|
require 'datafoodconsortium/connector/skos_parser_element'
|
25
28
|
|
26
29
|
class DataFoodConsortium::Connector::SKOSInstance
|
30
|
+
include DataFoodConsortium::Connector::SKOSHelper
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def hasAttribute(name)
|
36
|
-
return self.methods.include?(:"#{name}")
|
37
|
-
end
|
38
|
-
|
32
|
+
# Return a list of singelton methods, ie the list of Concept available
|
33
|
+
def topConcepts
|
34
|
+
self.methods(false).sort
|
35
|
+
end
|
39
36
|
end
|
40
37
|
|
41
38
|
class DataFoodConsortium::Connector::SKOSParser
|
39
|
+
CONCEPT_SCHEMES = ["Facet", "productTypes"].freeze
|
40
|
+
|
41
|
+
def self.concepts
|
42
|
+
@concepts ||= {}
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize
|
46
|
+
@results = DataFoodConsortium::Connector::SKOSInstance.new
|
47
|
+
@skosConcepts = {}
|
48
|
+
@rootElements = []
|
49
|
+
@broaders = {}
|
50
|
+
# Flag used to tell the parser to use SkosConcept object when parsing data from Concept Scheme
|
51
|
+
# defined in CONCEPT_SCHEMES
|
52
|
+
@useSkosConcept = false
|
53
|
+
end
|
54
|
+
|
55
|
+
def parse(data)
|
56
|
+
init
|
57
|
+
|
58
|
+
data.each do |element|
|
59
|
+
current = DataFoodConsortium::Connector::SKOSParserElement.new(element)
|
60
|
+
|
61
|
+
setSkosConceptFlag(current)
|
62
|
+
|
63
|
+
if current.isConcept? || current.isCollection?
|
64
|
+
if !@skosConcepts.has_key?(current.id)
|
65
|
+
concept = createSKOSConcept(current)
|
66
|
+
@skosConcepts[current.id] = concept
|
67
|
+
end
|
42
68
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
@broaders = {}
|
48
|
-
end
|
49
|
-
|
50
|
-
def parse(data)
|
51
|
-
init()
|
52
|
-
|
53
|
-
data.each do |element|
|
54
|
-
current = DataFoodConsortium::Connector::SKOSParserElement.new(element)
|
55
|
-
|
56
|
-
if (current.isConcept?() || current.isCollection?())
|
57
|
-
if (!@skosConcepts.has_key?(current.id))
|
58
|
-
concept = createSKOSConcept(current)
|
59
|
-
@skosConcepts[current.id] = concept
|
60
|
-
end
|
61
|
-
|
62
|
-
if (current.hasBroader())
|
63
|
-
current.broader.each do |broaderId|
|
64
|
-
if (!@broaders.has_key?(broaderId))
|
65
|
-
@broaders[broaderId] = []
|
66
|
-
end
|
67
|
-
|
68
|
-
@broaders[broaderId].push(current.id)
|
69
|
-
end
|
70
|
-
|
71
|
-
# No broader, save the concept to the root
|
72
|
-
else
|
73
|
-
@rootElements.push(current.id)
|
74
|
-
end
|
69
|
+
if current.hasBroader
|
70
|
+
current.broader.each do |broaderId|
|
71
|
+
if !@broaders.has_key?(broaderId)
|
72
|
+
@broaders[broaderId] = []
|
75
73
|
end
|
76
|
-
end
|
77
|
-
|
78
|
-
@rootElements.each do |rootElementId|
|
79
|
-
setResults(@results, rootElementId)
|
80
|
-
end
|
81
74
|
|
82
|
-
|
75
|
+
@broaders[broaderId].push(current.id)
|
76
|
+
end
|
77
|
+
# No broader, save the concept to the root
|
78
|
+
else
|
79
|
+
@rootElements.push(current.id)
|
80
|
+
end
|
81
|
+
end
|
83
82
|
end
|
84
83
|
|
85
|
-
|
86
|
-
|
87
|
-
def createSKOSConcept(element)
|
88
|
-
skosConcept = DataFoodConsortium::Connector::SKOSConcept.new(element.id)
|
89
|
-
skosConcept.semanticType = element.type
|
90
|
-
return skosConcept
|
84
|
+
@rootElements.each do |rootElementId|
|
85
|
+
setResults(@results, rootElementId)
|
91
86
|
end
|
92
87
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
if (!property.include?('http') && property.include?(':'))
|
97
|
-
name = property.split(':')[1]
|
98
|
-
elsif (property.include?('#'))
|
99
|
-
name = property.split('#')[1]
|
100
|
-
end
|
88
|
+
@results
|
89
|
+
end
|
101
90
|
|
102
|
-
|
91
|
+
protected
|
103
92
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
93
|
+
def createSKOSConcept(element)
|
94
|
+
skosConcept = DataFoodConsortium::Connector::SKOSConcept.new(
|
95
|
+
element.id, broaders: element.broader, narrowers: element.narrower, prefLabels: element.label
|
96
|
+
)
|
97
|
+
skosConcept.semanticType = element.type
|
98
|
+
|
99
|
+
self.class.concepts[element.id] = skosConcept
|
100
|
+
|
101
|
+
skosConcept
|
102
|
+
end
|
110
103
|
|
111
|
-
|
104
|
+
def getValueWithoutPrefix(property)
|
105
|
+
name = 'undefined'
|
106
|
+
|
107
|
+
if !property.include?('http') && property.include?(':')
|
108
|
+
name = property.split(':')[1]
|
109
|
+
elsif property.include?('#')
|
110
|
+
name = property.split('#')[1]
|
112
111
|
end
|
113
112
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
113
|
+
name = name.gsub('-', '_')
|
114
|
+
|
115
|
+
# workaround to fix concepts starting with a number
|
116
|
+
# see https://github.com/datafoodconsortium/connector-ruby/issues/3
|
117
|
+
# see https://github.com/datafoodconsortium/ontology/issues/66
|
118
|
+
name = "_" + name if name.match?("^[0-9]")
|
119
|
+
|
120
|
+
name.upcase
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
def init
|
126
|
+
@results = DataFoodConsortium::Connector::SKOSInstance.new
|
127
|
+
@skosConcepts = {}
|
128
|
+
@rootElements = []
|
129
|
+
@broaders = {}
|
130
|
+
@useSkosConcept = false
|
131
|
+
end
|
132
|
+
|
133
|
+
def setResults(parent, id)
|
134
|
+
name = getValueWithoutPrefix(id)
|
135
|
+
|
136
|
+
if !parent.hasAttribute(name)
|
137
|
+
if @useSkosConcept && @skosConcepts[id]
|
138
|
+
parent.addAttribute(name, @skosConcepts[id])
|
139
|
+
else
|
140
|
+
parent.addAttribute(name, DataFoodConsortium::Connector::SKOSInstance.new)
|
141
|
+
end
|
121
142
|
end
|
122
143
|
|
123
|
-
|
124
|
-
|
144
|
+
# Leaf concepts, stop the process
|
145
|
+
if !@broaders.has_key?(id)
|
146
|
+
parent.instance_variable_set("@#{name}", @skosConcepts[id])
|
147
|
+
return
|
148
|
+
end
|
125
149
|
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
# Leaf concepts, stop the process
|
131
|
-
if (!@broaders.has_key?(id))
|
132
|
-
parent.instance_variable_set("@#{name}", @skosConcepts[id])
|
133
|
-
return
|
134
|
-
end
|
150
|
+
@broaders[id].each do |narrower|
|
151
|
+
parentSkosInstance = parent.instance_variable_get("@#{name}")
|
135
152
|
|
136
|
-
|
137
|
-
childName = getValueWithoutPrefix(narrower)
|
138
|
-
parentSkosInstance = parent.instance_variable_get("@#{name}")
|
139
|
-
setResults(parentSkosInstance, narrower) # recursive call
|
140
|
-
end
|
153
|
+
setResults(parentSkosInstance, narrower) # recursive call
|
141
154
|
end
|
155
|
+
end
|
142
156
|
|
143
|
-
|
157
|
+
def setSkosConceptFlag(current)
|
158
|
+
@useSkosConcept = true if current.isConceptScheme? && matchingConceptSchemes(current)
|
159
|
+
end
|
160
|
+
|
161
|
+
def matchingConceptSchemes(current)
|
162
|
+
regex = /#{CONCEPT_SCHEMES.join("|")}/
|
163
|
+
|
164
|
+
current.id =~ regex
|
165
|
+
end
|
166
|
+
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# MIT License
|
2
|
-
#
|
4
|
+
#
|
3
5
|
# Copyright (c) 2023 Maxime Lecoq <maxime@lecoqlibre.fr>
|
4
|
-
#
|
6
|
+
#
|
5
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
8
|
# of this software and associated documentation files (the "Software"), to deal
|
7
9
|
# in the Software without restriction, including without limitation the rights
|
8
10
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
11
|
# copies of the Software, and to permit persons to whom the Software is
|
10
12
|
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
13
|
+
#
|
12
14
|
# The above copyright notice and this permission notice shall be included in all
|
13
15
|
# copies or substantial portions of the Software.
|
14
|
-
#
|
16
|
+
#
|
15
17
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
18
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
19
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -22,57 +24,74 @@
|
|
22
24
|
|
23
25
|
class DataFoodConsortium::Connector::SKOSParserElement
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
@type = ""
|
27
|
+
attr_reader :id
|
28
|
+
attr_reader :type
|
29
|
+
attr_reader :broader
|
30
|
+
attr_reader :narrower
|
31
|
+
attr_reader :label
|
32
|
+
|
33
|
+
def initialize(element)
|
34
|
+
@broader = []
|
35
|
+
@narrower = []
|
36
|
+
@label = {}
|
37
|
+
|
38
|
+
if element
|
39
|
+
@id = element["@id"]
|
40
|
+
|
41
|
+
if element["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
42
|
+
@type = extractId(element["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"])
|
43
|
+
elsif element["@type"]
|
44
|
+
@type = extractId(element["@type"])
|
45
|
+
else
|
46
|
+
@type = "undefined"
|
47
|
+
end
|
48
|
+
|
49
|
+
if element["http://www.w3.org/2004/02/skos/core#broader"]
|
50
|
+
element["http://www.w3.org/2004/02/skos/core#broader"].each do |broader|
|
51
|
+
@broader.push(broader["@id"])
|
51
52
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
def isConcept?()
|
59
|
-
return @type == "http://www.w3.org/2004/02/skos/core#Concept" || @type == "skos:Concept"
|
60
|
-
end
|
61
|
-
|
62
|
-
def isCollection?()
|
63
|
-
return @type == "http://www.w3.org/2004/02/skos/core#Collection" || @type == "skos:Collection"
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def extractId(data)
|
69
|
-
id = data[0]
|
70
|
-
|
71
|
-
if (id["@id"])
|
72
|
-
return id["@id"]
|
53
|
+
end
|
54
|
+
|
55
|
+
if element["http://www.w3.org/2004/02/skos/core#narrower"]
|
56
|
+
element["http://www.w3.org/2004/02/skos/core#narrower"].each do |narrower|
|
57
|
+
@narrower.push(narrower["@id"])
|
73
58
|
end
|
59
|
+
end
|
74
60
|
|
75
|
-
|
61
|
+
if element["http://www.w3.org/2004/02/skos/core#prefLabel"]
|
62
|
+
element["http://www.w3.org/2004/02/skos/core#prefLabel"].each do |label|
|
63
|
+
@label[label["@language"].to_sym] = label["@value"]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
else
|
67
|
+
@id = ""
|
68
|
+
@type = ""
|
76
69
|
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def hasBroader()
|
73
|
+
@broader.count > 0
|
74
|
+
end
|
75
|
+
|
76
|
+
def isConcept?()
|
77
|
+
@type == "http://www.w3.org/2004/02/skos/core#Concept" || @type == "skos:Concept"
|
78
|
+
end
|
79
|
+
|
80
|
+
def isCollection?()
|
81
|
+
@type == "http://www.w3.org/2004/02/skos/core#Collection" || @type == "skos:Collection"
|
82
|
+
end
|
83
|
+
|
84
|
+
def isConceptScheme?
|
85
|
+
@type == "http://www.w3.org/2004/02/skos/core#ConceptScheme"
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def extractId(data)
|
91
|
+
id = data[0]
|
92
|
+
|
93
|
+
return id["@id"] if id["@id"]
|
77
94
|
|
78
|
-
|
95
|
+
id
|
96
|
+
end
|
97
|
+
end
|
@@ -24,8 +24,9 @@
|
|
24
24
|
require "virtual_assembly/semantizer"
|
25
25
|
|
26
26
|
class DataFoodConsortium::Connector::SocialMedia
|
27
|
+
include VirtualAssembly::Semantizer::SemanticObject
|
27
28
|
|
28
|
-
|
29
|
+
SEMANTIC_TYPE = "dfc-b:SocialMedia".freeze
|
29
30
|
|
30
31
|
# @return [String]
|
31
32
|
attr_accessor :name
|
@@ -41,14 +42,10 @@ class DataFoodConsortium::Connector::SocialMedia
|
|
41
42
|
@name = name
|
42
43
|
@url = url
|
43
44
|
self.semanticType = "dfc-b:SocialMedia"
|
44
|
-
registerSemanticProperty("dfc-b:name")
|
45
|
-
registerSemanticProperty("dfc-b:URL")
|
45
|
+
registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
|
46
|
+
registerSemanticProperty("dfc-b:URL", &method("url")).valueSetter = method("url=")
|
46
47
|
end
|
47
48
|
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
50
|
|
54
51
|
end
|
@@ -32,7 +32,7 @@ require "virtual_assembly/semantizer"
|
|
32
32
|
|
33
33
|
class DataFoodConsortium::Connector::SuppliedProduct < DataFoodConsortium::Connector::DefinedProduct
|
34
34
|
|
35
|
-
|
35
|
+
SEMANTIC_TYPE = "dfc-b:SuppliedProduct".freeze
|
36
36
|
|
37
37
|
# @return [Real]
|
38
38
|
attr_accessor :totalTheoreticalStock
|
@@ -59,11 +59,12 @@ class DataFoodConsortium::Connector::SuppliedProduct < DataFoodConsortium::Conne
|
|
59
59
|
# @param certifications [ISKOSConcept]
|
60
60
|
# @param natureOrigin [ISKOSConcept]
|
61
61
|
# @param partOrigin [ISKOSConcept]
|
62
|
-
|
63
|
-
|
62
|
+
# @param images [String]
|
63
|
+
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: [], images: [])
|
64
|
+
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, images: images)
|
64
65
|
@totalTheoreticalStock = totalTheoreticalStock
|
65
66
|
self.semanticType = "dfc-b:SuppliedProduct"
|
66
|
-
registerSemanticProperty("dfc-b:totalTheoreticalStock")
|
67
|
+
registerSemanticProperty("dfc-b:totalTheoreticalStock", &method("totalTheoreticalStock")).valueSetter = method("totalTheoreticalStock=")
|
67
68
|
end
|
68
69
|
|
69
70
|
|
@@ -20,14 +20,14 @@
|
|
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/defined_product"
|
23
24
|
|
24
25
|
|
25
|
-
require "datafoodconsortium/connector/defined_product"
|
26
26
|
require "virtual_assembly/semantizer"
|
27
27
|
|
28
28
|
class DataFoodConsortium::Connector::TechnicalProduct < DataFoodConsortium::Connector::DefinedProduct
|
29
29
|
|
30
|
-
|
30
|
+
SEMANTIC_TYPE = "dfc-b:TechnicalProduct".freeze
|
31
31
|
|
32
32
|
|
33
33
|
# @param semanticId [String]
|
@@ -47,8 +47,9 @@ class DataFoodConsortium::Connector::TechnicalProduct < DataFoodConsortium::Conn
|
|
47
47
|
# @param certifications [ISKOSConcept]
|
48
48
|
# @param natureOrigin [ISKOSConcept]
|
49
49
|
# @param partOrigin [ISKOSConcept]
|
50
|
-
|
51
|
-
|
50
|
+
# @param images [String]
|
51
|
+
def initialize(semanticId, name: "", description: "", productType: nil, quantity: nil, alcoholPercentage: 0.0, lifetime: "", claims: [], usageOrStorageConditions: "", allergenCharacteristics: [], nutrientCharacteristics: [], physicalCharacteristics: [], geographicalOrigin: nil, catalogItems: [], certifications: [], natureOrigin: [], partOrigin: [], images: [])
|
52
|
+
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, images: images)
|
52
53
|
|
53
54
|
self.semanticType = "dfc-b:TechnicalProduct"
|
54
55
|
|
@@ -4,29 +4,39 @@ module DataFoodConsortium
|
|
4
4
|
require 'datafoodconsortium/connector/json_ld_serializer'
|
5
5
|
require 'datafoodconsortium/connector/skos_parser_element'
|
6
6
|
require 'datafoodconsortium/connector/skos_parser'
|
7
|
-
require 'datafoodconsortium/connector/social_media.rb'
|
8
7
|
require 'datafoodconsortium/connector/agent.rb'
|
9
|
-
require 'datafoodconsortium/connector/person.rb'
|
10
|
-
require 'datafoodconsortium/connector/phone_number.rb'
|
11
8
|
require 'datafoodconsortium/connector/customer_category.rb'
|
12
9
|
require 'datafoodconsortium/connector/enterprise.rb'
|
13
|
-
require 'datafoodconsortium/connector/
|
14
|
-
require 'datafoodconsortium/connector/
|
15
|
-
require 'datafoodconsortium/connector/
|
16
|
-
require 'datafoodconsortium/connector/physical_characteristic.rb'
|
17
|
-
require 'datafoodconsortium/connector/nutrient_characteristic.rb'
|
18
|
-
require 'datafoodconsortium/connector/characteristic.rb'
|
19
|
-
require 'datafoodconsortium/connector/quantity.rb'
|
20
|
-
require 'datafoodconsortium/connector/allergen_characteristic.rb'
|
10
|
+
require 'datafoodconsortium/connector/person.rb'
|
11
|
+
require 'datafoodconsortium/connector/phone_number.rb'
|
12
|
+
require 'datafoodconsortium/connector/social_media.rb'
|
21
13
|
require 'datafoodconsortium/connector/address.rb'
|
14
|
+
require 'datafoodconsortium/connector/allergen_characteristic.rb'
|
15
|
+
require 'datafoodconsortium/connector/characteristic.rb'
|
16
|
+
require 'datafoodconsortium/connector/nutrient_characteristic.rb'
|
17
|
+
require 'datafoodconsortium/connector/physical_characteristic.rb'
|
22
18
|
require 'datafoodconsortium/connector/quantitative_value.rb'
|
19
|
+
require 'datafoodconsortium/connector/quantity.rb'
|
20
|
+
require 'datafoodconsortium/connector/defined_product.rb'
|
21
|
+
require 'datafoodconsortium/connector/flow.rb'
|
22
|
+
require 'datafoodconsortium/connector/planned_consumption_flow.rb'
|
23
|
+
require 'datafoodconsortium/connector/planned_production_flow.rb'
|
24
|
+
require 'datafoodconsortium/connector/planned_transformation.rb'
|
25
|
+
require 'datafoodconsortium/connector/supplied_product.rb'
|
26
|
+
require 'datafoodconsortium/connector/technical_product.rb'
|
23
27
|
require 'datafoodconsortium/connector/catalog.rb'
|
28
|
+
require 'datafoodconsortium/connector/catalog_item.rb'
|
29
|
+
require 'datafoodconsortium/connector/offer.rb'
|
24
30
|
require 'datafoodconsortium/connector/order.rb'
|
25
31
|
require 'datafoodconsortium/connector/order_line.rb'
|
26
|
-
require 'datafoodconsortium/connector/offer.rb'
|
27
|
-
require 'datafoodconsortium/connector/catalog_item.rb'
|
28
32
|
require 'datafoodconsortium/connector/price.rb'
|
29
33
|
require 'datafoodconsortium/connector/sale_session.rb'
|
30
34
|
require 'datafoodconsortium/connector/skos_concept.rb'
|
35
|
+
|
36
|
+
def self.semantic_types
|
37
|
+
constants.map(&method(:const_get)).select do |c|
|
38
|
+
c.constants.include?(:SEMANTIC_TYPE)
|
39
|
+
end
|
40
|
+
end
|
31
41
|
end
|
32
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datafoodconsortium-connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.alpha.
|
4
|
+
version: 1.0.0.pre.alpha.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Lecoq
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtual_assembly-semantizer
|
@@ -30,34 +30,6 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.5
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: minitest
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
40
|
-
type: :development
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rake
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
33
|
description: A library to easily integrate the DFC standard within your application.
|
62
34
|
email: maxime@lecoqlibre.fr
|
63
35
|
executables: []
|
@@ -68,44 +40,44 @@ files:
|
|
68
40
|
- lib/datafoodconsortium/connector/address.rb
|
69
41
|
- lib/datafoodconsortium/connector/agent.rb
|
70
42
|
- lib/datafoodconsortium/connector/allergen_characteristic.rb
|
71
|
-
- lib/datafoodconsortium/connector/allergen_dimension.rb
|
72
43
|
- lib/datafoodconsortium/connector/catalog.rb
|
73
44
|
- lib/datafoodconsortium/connector/catalog_item.rb
|
74
|
-
- lib/datafoodconsortium/connector/certification.rb
|
75
45
|
- lib/datafoodconsortium/connector/characteristic.rb
|
76
|
-
- lib/datafoodconsortium/connector/characteristic_dimension.rb
|
77
46
|
- lib/datafoodconsortium/connector/connector.rb
|
47
|
+
- lib/datafoodconsortium/connector/context.rb
|
78
48
|
- lib/datafoodconsortium/connector/customer_category.rb
|
79
49
|
- lib/datafoodconsortium/connector/defined_product.rb
|
80
50
|
- lib/datafoodconsortium/connector/enterprise.rb
|
81
|
-
- lib/datafoodconsortium/connector/
|
51
|
+
- lib/datafoodconsortium/connector/flow.rb
|
52
|
+
- lib/datafoodconsortium/connector/importer.rb
|
82
53
|
- lib/datafoodconsortium/connector/json_ld_serializer.rb
|
83
|
-
- lib/datafoodconsortium/connector/nature_origin.rb
|
84
54
|
- lib/datafoodconsortium/connector/nutrient_characteristic.rb
|
85
55
|
- lib/datafoodconsortium/connector/offer.rb
|
86
56
|
- lib/datafoodconsortium/connector/order.rb
|
87
57
|
- lib/datafoodconsortium/connector/order_line.rb
|
88
|
-
- lib/datafoodconsortium/connector/part_origin.rb
|
89
58
|
- lib/datafoodconsortium/connector/person.rb
|
90
59
|
- lib/datafoodconsortium/connector/phone_number.rb
|
91
60
|
- lib/datafoodconsortium/connector/physical_characteristic.rb
|
61
|
+
- lib/datafoodconsortium/connector/planned_consumption_flow.rb
|
62
|
+
- lib/datafoodconsortium/connector/planned_production_flow.rb
|
63
|
+
- lib/datafoodconsortium/connector/planned_transformation.rb
|
92
64
|
- lib/datafoodconsortium/connector/price.rb
|
93
|
-
- lib/datafoodconsortium/connector/product_type.rb
|
94
65
|
- lib/datafoodconsortium/connector/quantitative_value.rb
|
95
66
|
- lib/datafoodconsortium/connector/quantity.rb
|
96
|
-
- lib/datafoodconsortium/connector/repository.rb
|
97
67
|
- lib/datafoodconsortium/connector/sale_session.rb
|
98
68
|
- lib/datafoodconsortium/connector/skos_concept.rb
|
69
|
+
- lib/datafoodconsortium/connector/skos_helper.rb
|
99
70
|
- lib/datafoodconsortium/connector/skos_parser.rb
|
100
71
|
- lib/datafoodconsortium/connector/skos_parser_element.rb
|
101
72
|
- lib/datafoodconsortium/connector/social_media.rb
|
102
73
|
- lib/datafoodconsortium/connector/supplied_product.rb
|
103
74
|
- lib/datafoodconsortium/connector/technical_product.rb
|
104
|
-
- lib/datafoodconsortium/connector/unit.rb
|
105
75
|
homepage: https://github.com/datafoodconsortium/connector-ruby/
|
106
76
|
licenses:
|
107
77
|
- MIT
|
108
|
-
metadata:
|
78
|
+
metadata:
|
79
|
+
changelog_uri: https://github.com/datafoodconsortium/connector-ruby/blob/main/CHANGELOG.md
|
80
|
+
source_code_uri: https://github.com/datafoodconsortium/connector-ruby/
|
109
81
|
post_install_message:
|
110
82
|
rdoc_options: []
|
111
83
|
require_paths:
|
@@ -121,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
93
|
- !ruby/object:Gem::Version
|
122
94
|
version: 1.3.1
|
123
95
|
requirements: []
|
124
|
-
rubygems_version: 3.3.
|
96
|
+
rubygems_version: 3.3.26
|
125
97
|
signing_key:
|
126
98
|
specification_version: 4
|
127
99
|
summary: Data Food Consortium connector
|