Skip to content

Commit

Permalink
Merge pull request #25 from mkllnk/context-update
Browse files Browse the repository at this point in the history
Release 1.1.0 with context update
  • Loading branch information
mkllnk authored Feb 12, 2025
2 parents bcaf273 + fdb6eb7 commit be7f783
Show file tree
Hide file tree
Showing 8 changed files with 493 additions and 56 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.0] - 2025-01-14

This version has been generated using:

- [Connector code generator](https://github.com/datafoodconsortium/connector-codegen) [main](https://github.com/datafoodconsortium/connector-codegen/commit/8742cb8ee82a312f5735c4739e95e7cbf85ca0b3).
- [UML data model](https://github.com/datafoodconsortium/data-model-uml) [next](https://github.com/datafoodconsortium/data-model-uml/commit/621e823c21c79a58b117bae97132da9140e47be6).

### Changed

- Bump DFC context from 1.8.0 to 1.14.0
- Bump dev dependencies

## [1.0.0] - 2025-01-09

This version has been generated using:
Expand Down Expand Up @@ -154,7 +166,8 @@ This version has been generated using the [code generator](https://github.com/da

- Initial version of this library.

[unreleased]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0...HEAD
[unreleased]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.13...v1.0.0
[1.0.0-alpha.13]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.12...v1.0.0-alpha.13
[1.0.0-alpha.12]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.11...v1.0.0-alpha.12
Expand Down
20 changes: 12 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
PATH
remote: .
specs:
datafoodconsortium-connector (1.0.0)
datafoodconsortium-connector (1.1.0)
virtual_assembly-semantizer (~> 1.0, >= 1.0.5)

GEM
remote: https://rubygems.org/
specs:
bcp47_spec (0.2.1)
bigdecimal (3.1.9)
diff-lcs (1.5.1)
htmlentities (4.3.4)
json-canonicalization (1.0.0)
json-ld (3.3.1)
json-ld (3.3.2)
htmlentities (~> 4.3)
json-canonicalization (~> 1.0)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.15)
rack (>= 2.2, < 4)
rdf (~> 3.3)
rexml (~> 3.2)
link_header (0.0.8)
multi_json (1.15.0)
rack (3.0.10)
rdf (3.3.1)
rack (3.1.8)
rdf (3.3.2)
bcp47_spec (~> 0.2)
bigdecimal (~> 3.1, >= 3.1.5)
link_header (~> 0.0, >= 0.0.8)
rexml (3.4.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rspec-support (3.13.2)
virtual_assembly-semantizer (1.1.1)
json-ld (~> 3.2, >= 3.2.3)

Expand Down
4 changes: 2 additions & 2 deletions connector.gemspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Gem::Specification.new do |s|
s.name = "datafoodconsortium-connector"
s.version = "1.0.0"
s.version = "1.1.0"
s.summary = "Data Food Consortium connector"
s.description = "A library to easily integrate the DFC standard within your application."
s.authors = ["Maxime Lecoq"]
s.email = "maxime@lecoqlibre.fr"
s.files = Dir["lib/**/*.rb"]
s.files = Dir["lib/**/*.*"]
s.homepage = "https://github.com/datafoodconsortium/connector-ruby/"
s.license = "MIT"

Expand Down
48 changes: 6 additions & 42 deletions lib/datafoodconsortium/connector/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,7 @@
module DataFoodConsortium
module Connector
class Context < JSON::LD::Context
VERSION_1_8 = JSON.parse <<~JSON
{
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"skos" : "http://www.w3.org/2004/02/skos/core#",
"dfc": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl#",
"dc": "http://purl.org/dc/elements/1.1/#",
"dfc-b": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
"dfc-p": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_ProductGlossary.owl#",
"dfc-t": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_TechnicalOntology.owl#",
"dfc-m": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/measures.rdf#",
"dfc-pt": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/productTypes.rdf#",
"dfc-f": "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#",
"ontosec": "http://www.semanticweb.org/ontologies/2008/11/OntologySecurity.owl#",
"dfc-p:hasUnit":{ "@type":"@id" },
"dfc-b:hasUnit":{ "@type":"@id" },
"dfc-b:hasQuantity":{ "@type":"@id" },
"dfc-p:hasType":{ "@type":"@id" },
"dfc-b:hasType":{ "@type":"@id" },
"dfc-b:references":{ "@type":"@id" },
"dfc-b:referencedBy":{ "@type":"@id" },
"dfc-b:offeres":{ "@type":"@id" },
"dfc-b:supplies":{ "@type":"@id" },
"dfc-b:defines":{ "@type":"@id" },
"dfc-b:affiliates":{ "@type":"@id" },
"dfc-b:hasCertification":{ "@type":"@id" },
"dfc-b:manages":{ "@type":"@id" },
"dfc-b:offeredThrough":{ "@type":"@id" },
"dfc-b:hasBrand":{ "@type":"@id" },
"dfc-b:hasGeographicalOrigin":{ "@type":"@id" },
"dfc-b:hasClaim":{ "@type":"@id" },
"dfc-b:hasAllergenDimension":{ "@type":"@id" },
"dfc-b:hasNutrientDimension":{ "@type":"@id" },
"dfc-b:hasPhysicalDimension":{ "@type":"@id" },
"dfc:owner":{ "@type":"@id" },
"dfc-t:hostedBy":{ "@type":"@id" },
"dfc-t:hasPivot":{ "@type":"@id" },
"dfc-t:represent":{ "@type":"@id" }
}
JSON

add_preloaded("http://www.datafoodconsortium.org/") { parse(VERSION_1_8) }
add_preloaded("http://www.datafoodconsortium.org/") { parse(json) }

# This is the actual file the DFC website refers to in a link header.
alias_preloaded(
Expand All @@ -65,7 +25,11 @@ class Context < JSON::LD::Context

# The hash serializer expects only string values in the context.
def self.inputContext
@inputContext = VERSION_1_8.select { |key, value| value.is_a? String }
@inputContext = json.select { |key, value| value.is_a? String }
end

def self.json
@json ||= JSON.parse(File.read("#{__dir__}/context_1.14.0.json"))["@context"]
end
end
end
Expand Down
Loading

0 comments on commit be7f783

Please sign in to comment.