datafoodconsortium-connector 1.2.0 → 1.3.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53c5f255a48f339e30ae7ab2745a661f5989c6e91fd81ec639fa179ef82e7111
|
|
4
|
+
data.tar.gz: 1b5f034696fb9540252bcb3f4431e0fe404a331c9c228098a2ab73c3c01b3532
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3d9907d5f5b7b7529b464cde69eccc6e0c6de00a45097b58f79369d933c5cc08195f61716d4d9108e51b53c9a134b4312c8529ad8131d6e6e59aac13dca6400
|
|
7
|
+
data.tar.gz: 97aa860ebfb2b1fd8ccd32c85c55a01e3f6ce2973856dd51df1a92621bcf523fdcdaf51d314caa7f605ebda2f933267e6e689b2d7d37e17bcefcf12241328d43
|
|
@@ -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,27 +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_1.16.0.json"
|
|
12
|
+
URL_NORMALISED = "http://w3id.org/dfc/ontology/context/context_1.16.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_1.16.0.jsonld",
|
|
25
|
+
URL_NORMALISED
|
|
19
26
|
)
|
|
20
27
|
|
|
21
28
|
# This was the file the DFC website refers to in a link header.
|
|
22
29
|
alias_preloaded(
|
|
23
|
-
"
|
|
24
|
-
|
|
30
|
+
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context.jsonld",
|
|
31
|
+
URL_NORMALISED
|
|
25
32
|
)
|
|
26
33
|
|
|
27
34
|
# This is the old URL that's not online anymore.
|
|
28
35
|
# Keep it for compatiblity with all versions before 1.8.
|
|
29
36
|
alias_preloaded(
|
|
30
37
|
"http://static.datafoodconsortium.org/ontologies/context.json",
|
|
31
|
-
|
|
38
|
+
URL_NORMALISED
|
|
32
39
|
)
|
|
33
40
|
|
|
34
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.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datafoodconsortium-connector
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maxime Lecoq
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-
|
|
12
|
+
date: 2025-12-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: virtual_assembly-semantizer
|