datafoodconsortium-connector 2.0.0.pre.beta5 → 2.0.0.pre.beta7
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.
- checksums.yaml +4 -4
- data/lib/datafoodconsortium/connector/connector.rb +2 -2
- data/lib/datafoodconsortium/connector/context.rb +18 -8
- data/lib/datafoodconsortium/connector/json_ld_serializer.rb +0 -2
- data/lib/datafoodconsortium/connector/localized_product.rb +2 -2
- data/lib/datafoodconsortium/connector/organization.rb +8 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f5b061c92d1587c70f6e3dc657a1537d2bc96adfb4a8d92db56a5c07d1de812
|
|
4
|
+
data.tar.gz: '0728e0d48e9a2b891328e7407423874c59b2435b95abc163fafe44a78657036b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c4c69ff07e1d4e0d084c4f7d41b5371c41a6486284eb4cae1c409fef7b5224523f3802fa42ff89d578f2a0dbc8b385e087ecafc163ad81c9c1b23d4bdb19344
|
|
7
|
+
data.tar.gz: 230b2682c15c487c17929b0efc5432df25bbd7197d3210d0196b74d03c3473d8dba5fa0414e24cf504142ae7ceee1edbbbb4a04da8761c56af9faa5e1d1aaf56
|
|
@@ -35,8 +35,8 @@ module DataFoodConsortium::Connector
|
|
|
35
35
|
attr_reader :MEASURES
|
|
36
36
|
attr_reader :PRODUCT_TYPES
|
|
37
37
|
|
|
38
|
-
def export(
|
|
39
|
-
|
|
38
|
+
def export(*subjects)
|
|
39
|
+
@exporter.process(*subjects)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def import(json_string_or_io)
|
|
@@ -8,24 +8,34 @@ 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://
|
|
11
|
+
URL = "https://w3id.org/dfc/ontology/context/context_2.0.0.json"
|
|
12
|
+
URL_NORMALISED = "http://w3id.org/dfc/ontology/context/context_2.0.0.json"
|
|
12
13
|
|
|
13
|
-
|
|
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)
|
|
14
21
|
|
|
15
22
|
# This is the current file the DFC website refers to in a link header.
|
|
16
23
|
alias_preloaded(
|
|
17
|
-
"
|
|
18
|
-
|
|
24
|
+
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_2.0.0.jsonld",
|
|
25
|
+
URL_NORMALISED
|
|
19
26
|
)
|
|
20
27
|
|
|
28
|
+
# This was the file the DFC website refers to in a link header.
|
|
21
29
|
alias_preloaded(
|
|
22
|
-
"
|
|
23
|
-
|
|
30
|
+
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_2.0.0.jsonld",
|
|
31
|
+
URL_NORMALISED
|
|
24
32
|
)
|
|
25
33
|
|
|
34
|
+
# This is the old URL that's not online anymore.
|
|
35
|
+
# Keep it for compatiblity with all versions before 1.8.
|
|
26
36
|
alias_preloaded(
|
|
27
|
-
"
|
|
28
|
-
|
|
37
|
+
"http://static.datafoodconsortium.org/ontologies/context.json",
|
|
38
|
+
URL_NORMALISED
|
|
29
39
|
)
|
|
30
40
|
|
|
31
41
|
# The hash serializer expects only string values in the context.
|
|
@@ -31,8 +31,6 @@ class DataFoodConsortium::Connector::JsonLdSerializer
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def process(*subjects)
|
|
34
|
-
return "" if subjects.empty?
|
|
35
|
-
|
|
36
34
|
# Insert an input context on each subject so the properties could be prefixed. This way,
|
|
37
35
|
# the DFC's context can be used.
|
|
38
36
|
# See https://github.com/datafoodconsortium/connector-ruby/issues/11.
|
|
@@ -49,7 +49,7 @@ class DataFoodConsortium::Connector::LocalizedProduct
|
|
|
49
49
|
# @return [Real]
|
|
50
50
|
attr_accessor :cost
|
|
51
51
|
|
|
52
|
-
# @return [
|
|
52
|
+
# @return [ITheoreticalStock]
|
|
53
53
|
attr_accessor :theoreticalStocks
|
|
54
54
|
|
|
55
55
|
# @return [ISuppliedProduct]
|
|
@@ -70,7 +70,7 @@ class DataFoodConsortium::Connector::LocalizedProduct
|
|
|
70
70
|
# @param images [String]
|
|
71
71
|
# @param quantity [IQuantity]
|
|
72
72
|
# @param cost [Real]
|
|
73
|
-
# @param theoreticalStocks [
|
|
73
|
+
# @param theoreticalStocks [ITheoreticalStock]
|
|
74
74
|
# @param suppliedProducts [ISuppliedProduct]
|
|
75
75
|
# @param physicalProducts [IPhysicalProduct]
|
|
76
76
|
# @param plannedLocalProductionFlows [IPlannedLocalProductionFlow]
|
|
@@ -33,6 +33,7 @@ require "datafoodconsortium/connector/agent"
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
require "virtual_assembly/semantizer"
|
|
37
38
|
|
|
38
39
|
class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connector::Agent
|
|
@@ -72,6 +73,9 @@ class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connecto
|
|
|
72
73
|
# @return [ICertification]
|
|
73
74
|
attr_accessor :certifications
|
|
74
75
|
|
|
76
|
+
# @return [IPerson]
|
|
77
|
+
attr_accessor :affiliates
|
|
78
|
+
|
|
75
79
|
# @param semanticId [String]
|
|
76
80
|
# @param name [String]
|
|
77
81
|
# @param description [String]
|
|
@@ -84,6 +88,7 @@ class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connecto
|
|
|
84
88
|
# @param mainContact [IPerson]
|
|
85
89
|
# @param templateSaleSessions [ITemplateSaleSession]
|
|
86
90
|
# @param certifications [ICertification]
|
|
91
|
+
# @param affiliates [IPerson]
|
|
87
92
|
# @param localizations [IAddress]
|
|
88
93
|
# @param phoneNumbers [IPhoneNumber]
|
|
89
94
|
# @param emails [String]
|
|
@@ -91,7 +96,7 @@ class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connecto
|
|
|
91
96
|
# @param socialMedias [ISocialMedia]
|
|
92
97
|
# @param logo [String]
|
|
93
98
|
# @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: [])
|
|
99
|
+
def initialize(semanticId, name: nil, description: nil, vatNumber: nil, customerCategories: [], catalogs: [], catalogItems: [], suppliedProducts: [], technicalProducts: [], mainContact: nil, templateSaleSessions: [], certifications: [], affiliates: [], localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [], logo: nil, customerCategoriesMembership: [])
|
|
95
100
|
super(semanticId, localizations: localizations, phoneNumbers: phoneNumbers, emails: emails, websites: websites, socialMedias: socialMedias, logo: logo, customerCategoriesMembership: customerCategoriesMembership)
|
|
96
101
|
@name = name
|
|
97
102
|
@description = description
|
|
@@ -104,6 +109,7 @@ class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connecto
|
|
|
104
109
|
@mainContact = mainContact
|
|
105
110
|
@templateSaleSessions = templateSaleSessions
|
|
106
111
|
@certifications = certifications
|
|
112
|
+
@affiliates = affiliates
|
|
107
113
|
self.semanticType = "dfc-b:Organization"
|
|
108
114
|
registerSemanticProperty("dfc-b:name", &method("name")).valueSetter = method("name=")
|
|
109
115
|
registerSemanticProperty("dfc-b:hasDescription", &method("description")).valueSetter = method("description=")
|
|
@@ -116,6 +122,7 @@ class DataFoodConsortium::Connector::Organization < DataFoodConsortium::Connecto
|
|
|
116
122
|
registerSemanticProperty("dfc-b:hasMainContact", &method("mainContact")).valueSetter = method("mainContact=")
|
|
117
123
|
registerSemanticProperty("dfc-b:hasTemplateSaleSession", &method("templateSaleSessions")).valueSetter = method("templateSaleSessions=")
|
|
118
124
|
registerSemanticProperty("dfc-b:isCertifiedBy", &method("certifications")).valueSetter = method("certifications=")
|
|
125
|
+
registerSemanticProperty("dfc-b:affiliates", &method("affiliates")).valueSetter = method("affiliates=")
|
|
119
126
|
end
|
|
120
127
|
|
|
121
128
|
|