Skip to content
Open

V2 #38

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
41c1622
Scaffold basic TypeScript generator
jgaehring Feb 8, 2024
4acd6d7
Copy static files from old repository
jgaehring Feb 8, 2024
b225204
Remove semantizer symlinks in package-lock.json
jgaehring Feb 9, 2024
a512f20
Re-export php license from common
jgaehring Feb 9, 2024
0bfa730
Export classes & interfaces as defaults
jgaehring Feb 9, 2024
183a22d
Generate TS class heritage
jgaehring Feb 14, 2024
bc1663d
Generate TS imports
jgaehring Feb 13, 2024
c0f3619
Generate TS base class connector member
jgaehring Feb 14, 2024
5663da7
Generate TS constructor & owned operations
jgaehring Feb 14, 2024
faf1674
Generate interface heritage
jgaehring Feb 14, 2024
3da2e4b
Generate TS constructor body
jgaehring Feb 18, 2024
d6a3227
Reorganize operation templates
jgaehring Feb 19, 2024
9333b68
Copy remaining static files from orig repo
jgaehring Feb 20, 2024
df08864
Generate TS interface operations
jgaehring Feb 20, 2024
0c406cf
Generate TS getters
jgaehring Feb 20, 2024
f32ba9d
Import IGetterOptions for all TS classes
jgaehring Feb 20, 2024
51581d0
Omit async keyword from abstract methods
jgaehring Feb 20, 2024
dca545c
Fix getter return types for multiple primitives
jgaehring Feb 20, 2024
8bd8a52
Generate TS setters
jgaehring Feb 20, 2024
77bfc44
Generate TS adders
jgaehring Feb 20, 2024
e28768a
Provide stub for unimplemented remover methods
jgaehring Feb 20, 2024
46248f0
Fix primitive type names
jgaehring Feb 20, 2024
66ca69a
Fix getter's nullable result type
jgaehring Feb 20, 2024
632dcc3
Fix whitespace in getter template
jgaehring Feb 20, 2024
58c1bd5
Fix misaligned getter return types
jgaehring Feb 23, 2024
c8e5c24
Sort & alphabetize TS factory imports
jgaehring Feb 22, 2024
338d42e
Replace deprecated subs of ISKOSConcept in static
jgaehring Feb 23, 2024
c087d13
Copy static test files from orig TS repo
jgaehring Feb 24, 2024
2b0c2a4
Add auto import queries
lecoqlibre Feb 29, 2024
f11b534
Generate TypeScript imports automatically
lecoqlibre Feb 29, 2024
418d597
Prevent auto self importing
lecoqlibre Feb 29, 2024
f673d17
Fix return type of getImportedClasses
lecoqlibre Mar 2, 2024
8321748
Add queries in changelog and docs in readme
lecoqlibre Mar 2, 2024
36c84da
Fix abstract sub classes should not re-implement methods already impl…
lecoqlibre Mar 8, 2024
91d201f
Add queries for operations to be implemented or declared by a class
lecoqlibre Mar 8, 2024
af9d3eb
TypeScript use queries to implement or declare operations in classes
lecoqlibre Mar 8, 2024
350a850
Update context IRIs from static.dfc.org
jgaehring Mar 5, 2024
bc3464f
Use Node's native test runner
jgaehring Mar 12, 2024
4f5c5c7
Remove Jest devDeps and config
jgaehring Mar 12, 2024
9c88cde
WIP: Remove unnecessary async keywords in tests
jgaehring Mar 12, 2024
0314c70
Use Semantizer alpha.3
lecoqlibre Mar 13, 2024
c29610a
Fix blank node, tests and features from previous ungenerated releases
lecoqlibre Mar 14, 2024
64dd677
Fix mistaken expected json for some tests
lecoqlibre Mar 14, 2024
9d59a40
Add test for PlannedTransformationLoop, fix Connector
lecoqlibre Mar 15, 2024
db4a2e3
Update commit hash on semantizer in package-lock
jgaehring Mar 15, 2024
7876dc6
Fix missing narrower and top concepts in vocabulary and product types
lecoqlibre Mar 18, 2024
565deea
Add transformation loop import test
lecoqlibre Mar 19, 2024
bb0fecd
Store objects in constructor
lecoqlibre Mar 20, 2024
695adde
Allow several consumption/production flows in PlannedTransformation
lecoqlibre Mar 20, 2024
26ccb96
Fix extra async and add DefinedProduct:image
lecoqlibre Mar 20, 2024
d7821b0
Use factory to create objects, update Readme and Changelog
lecoqlibre Mar 21, 2024
69a5636
Generate TS tests for concrete class constructors.
jgaehring Apr 1, 2024
533f5e5
Add type annotations to TS import/export methods
jgaehring Oct 30, 2024
295d57d
Fix CHANGELOG.md
lecoqlibre Nov 18, 2024
9498d97
Add gitignore file from connector-typescript repo.
jgaehring Feb 28, 2025
bc5f7c5
Generate src/index.ts as main entry point.
jgaehring Mar 4, 2025
c148535
Fix TS setters for array properties.
jgaehring Feb 26, 2025
c25e75a
Upgrade jsonld-streaming-parser to v4.
jgaehring Mar 26, 2025
34b02dd
Update TS changelog for variants, fixes, upgrades.
jgaehring Mar 25, 2025
63a785d
Update TS static CHANGELOG file for alpha-10.
jgaehring Mar 25, 2025
90d6e97
Update TS npm package info for alpha.10 release.
jgaehring Feb 19, 2025
7aacc53
Update CHANGELOG for TS alpha.10 release.
jgaehring Apr 28, 2025
e25f9db
Merge branch 'v1.2.0' of github.com:datafoodconsortium/connector-code…
lecoqlibre Apr 20, 2026
29b3b7e
Merge branch 'main' into v1.2.0
lecoqlibre Apr 21, 2026
7ebda5e
Ruby v2.0.0-beta2
lecoqlibre Apr 28, 2026
2e76ede
Ruby v2.0.0-beta3, TypeScript in progress
lecoqlibre Apr 29, 2026
3b037d5
Add Ruby v2.0.0-beta.4
lecoqlibre May 7, 2026
1efcd69
Update changelog
lecoqlibre May 8, 2026
d658903
Add TypeScript (merge commit 7aacc533f6d2713397c23c71455bd2b0a8a4764e)
lecoqlibre May 8, 2026
00c7122
TS: add getSemanticPropertyLiteralAll (add all)
lecoqlibre May 7, 2026
308e478
Init v1.2.0
lecoqlibre May 9, 2026
f834025
Add TypeScript static assets to generate 1.0.0
lecoqlibre May 21, 2026
1972615
Make Ruby v1.4.0-beta.6
lecoqlibre May 21, 2026
6745840
Update Ruby and TypeScript changelogs
lecoqlibre May 26, 2026
41fab09
Update changelog release date
lecoqlibre Jun 10, 2026
342ecbf
Ruby v2.0.0-beta6 and TypeScript v2.0.0-beta.1
lecoqlibre Jun 12, 2026
2907cd3
Add Ruby test for catalog, certification, delivery option and deliver…
lecoqlibre Jun 12, 2026
6cf6c63
Add Ruby test for LocalizedProduct
lecoqlibre Jun 14, 2026
2b4f522
Ruby v1.4.0-beta8 and TypeScript 1.0.0-beta.2
lecoqlibre Jun 15, 2026
d57d03f
Changelog Ruby and Typescript now refers to codegen 3.5.0
lecoqlibre Jun 15, 2026
2ea15bb
Update changelog and Ruby and TS changelogs to target codegen v1.3.0
lecoqlibre Jun 15, 2026
edf94ca
Merge main
lecoqlibre Jun 15, 2026
264ff98
Ruby 2.0.0-beta7 and TypeScript 2.0.0-beta.2
lecoqlibre Jun 15, 2026
fda3af7
Merge branch 'main' into v1
lecoqlibre Jun 15, 2026
ffb32a9
Merge v1
lecoqlibre Jun 15, 2026
ba7143d
Ruby: Replace old static context by JSDelivr CDN
lecoqlibre Jun 16, 2026
a75d092
Ruby spec: remove unused vars, rename importer v1.8 to v2
lecoqlibre Jun 16, 2026
06ececb
Ruby: fix importer old context prefix
lecoqlibre Jun 16, 2026
80c92a5
Ruby v2.0.0-beta8
lecoqlibre Jun 16, 2026
7ed6adc
Ruby: remove duplicate context preload
lecoqlibre Jun 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0] - 2026-06-15

To generate Ruby and TypeScript version based on the UML model version 4.0.0.

## [1.3.0] - 2026-06-15

To generate Ruby and TypeScript version based on the UML model version 3.5.0.
Expand All @@ -24,12 +28,10 @@ To generate Ruby and TypeScript version based on the UML model version 3.4.0.
- `getOperationsToImplementOrDeclare`.

### Changed

TypeScript:
- Ensure the entry point, `src/index.ts`, is always regenerated on fresh builds.

### Fixed

TypeScript:
- Fix setters for array properties so that all items are replaced.

Expand Down Expand Up @@ -94,7 +96,8 @@ This release requires [data-model-uml version 2.1.0](https://github.com/datafood
- Update dfc prefix in skos_parser and change dfc-b:hasName.
- Change dfc-b:hasName to dfc-b:name in tests.

[unreleased]: https://github.com/datafoodconsortium/connector-codegen/compare/v1.3.0...HEAD
[unreleased]: https://github.com/datafoodconsortium/connector-codegen/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/datafoodconsortium/connector-codegen/compare/v1.3.0...v2.0.0
[1.3.0]: https://github.com/datafoodconsortium/connector-codegen/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/datafoodconsortium/connector-codegen/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/datafoodconsortium/connector-codegen/compare/v1.0.1...v1.1.0
Expand Down
8 changes: 4 additions & 4 deletions src/org/datafoodconsortium/connector/codegen/ruby/class.mtl
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
[import org::datafoodconsortium::connector::codegen::ruby::classifier /]

[template public generateClass(model: Model, aClass : Class)]
[file (getProperty('ruby_outputFolder_src') + 'connector_v1/' + generateFileName(aClass.name).concat('.rb'), false, 'UTF-8')]
[file (getProperty('ruby_outputFolder_src') + 'connector/' + generateFileName(aClass.name).concat('.rb'), false, 'UTF-8')]
[generateLicence()/]

[generateImports(aClass)/]
class DataFoodConsortium::ConnectorV1::[aClass.name.toUpperFirst()/][generateGeneralization(aClass)/]
class DataFoodConsortium::Connector::[aClass.name.toUpperFirst()/][generateGeneralization(aClass)/]
[if (aClass.isSemantic() and aClass.generalization->isEmpty())]
include VirtualAssembly::Semantizer::SemanticObject
[/if]
[if (aClass.isSKOSConceptClass())]
include DataFoodConsortium::ConnectorV1::SKOSHelper
include DataFoodConsortium::Connector::SKOSHelper
[/if]
[if (aClass.isSemantic())]

Expand All @@ -41,5 +41,5 @@ end
[/template]

[template public generateGeneralization(classifier: Classifier)]
[if (not (classifier.generalization->isEmpty()))] < [for (generalization: Generalization | classifier.generalization) separator(', ')]DataFoodConsortium::ConnectorV1::[generalization.general.name/][/for][/if]
[if (not (classifier.generalization->isEmpty()))] < [for (generalization: Generalization | classifier.generalization) separator(', ')]DataFoodConsortium::Connector::[generalization.general.name/][/for][/if]
[/template]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[template public generateImports(classifier: Classifier)]
[for (ei: ElementImport | classifier.elementImport->sortedBy(i: ElementImport | i.importedElement.name)) separator('\n')][if (ei.importedElement.oclIsTypeOf(Class))][generateImport(ei)/][/if][/for]
[if (classifier.oclIsTypeOf(Class))]require "virtual_assembly/semantizer"[/if]
[if (classifier.isSKOSConceptClass())]require 'datafoodconsortium/connector_v1/skos_helper'[/if]
[if (classifier.isSKOSConceptClass())]require 'datafoodconsortium/connector/skos_helper'[/if]
[/template]

[template public generateImport(ei: ElementImport)]require "datafoodconsortium/connector_v1/[generateFileName(ei.importedElement.name) /]"[/template]
[template public generateImport(ei: ElementImport)]require "datafoodconsortium/connector/[generateFileName(ei.importedElement.name) /]"[/template]
14 changes: 7 additions & 7 deletions src/org/datafoodconsortium/connector/codegen/ruby/generate.mtl
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
[template public generateRuby(model: Model)]
[for (aClass: Class | model.getClasses())][generateClass(model, aClass)/][/for]

[file (getProperty('ruby_outputFolder_src') + 'connector_v1.rb', false, 'UTF-8')]
[file (getProperty('ruby_outputFolder_src') + 'connector.rb', false, 'UTF-8')]
module DataFoodConsortium
module ConnectorV1
require 'datafoodconsortium/connector_v1/connector'
require 'datafoodconsortium/connector_v1/json_ld_serializer'
require 'datafoodconsortium/connector_v1/skos_parser_element'
require 'datafoodconsortium/connector_v1/skos_parser'
module Connector
require 'datafoodconsortium/connector/connector'
require 'datafoodconsortium/connector/json_ld_serializer'
require 'datafoodconsortium/connector/skos_parser_element'
require 'datafoodconsortium/connector/skos_parser'
[for (ip: PackageImport | model.packageImport->select(pi: PackageImport | pi.importedPackage.name <> 'org.datafoodconsortium.semantizer')->sortedBy(i: PackageImport | i.importedPackage.name))]
[for (member: NamedElement | ip.importedPackage.ownedMember->addAll(model.ownedMember)->select(ne: NamedElement | ne.oclIsTypeOf(Class))->sortedBy(m: NamedElement | m.name))]
require 'datafoodconsortium/connector_v1/[generateFileName(member.name) /].rb'
require 'datafoodconsortium/connector/[generateFileName(member.name) /].rb'
[/for]
[/for]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.2', '3.3', '3.4']
ruby-version: ['3.3', '3.4', '4.0']

steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.4.0] - 2026-06-15
## [2.0.0] - 2026-06-16

This version has been generated using:

- [Connector code generator v2 branch](https://github.com/datafoodconsortium/connector-codegen/tree/v2).
- [UML data model PR 29](https://github.com/datafoodconsortium/data-model-uml/pull/29).

**This version contains breaking changes introduced by the ontology, see below.**

### Added

Classes:
- Add `ical:Vevent`
- Add `ical:Value_RECUR`
- Add `geo:Feature`
- Add `geo:Properties`
- Add `geo:Geometry`
- Add `geo:Point`
- Add `geo:Polygon`
- Add `Certification`
- Add `DeliveryStep`
- Add `Organization`
- Add `PickUpStep`
- Add `ProductOption`
- Add `ProductOptionValue`
- Add `Route`
- Add `TemplateSaleSession`
- Add `Variant`
- Add `VariantCaracteristic`

Properties:
- Add `Catalog:startDate`
- Add `PlannedLocalTransformation:startDate`
- Add `RealizedTransformation:startDate`
- Add `SuppliedProduct:referenceOf`.
- Add `TechnicalProduct:referenceOf`.

### Changed

- `Stock:availabilityDate` is now a 1-1 property (**BREAKING CHANGE**)
- `PaymentMethod:paymentMethodProvider` is now a 1-1 property (**BREAKING CHANGE**)
- `PaymentMethod:paymentMethodType` is now a 1-1 property (**BREAKING CHANGE**)
- `Variant:isVariantOf is now a `Variant` instead of `DefinedProduct` (**BREAKING CHANGE**)

### Removed

- Removed the `Enterprise` class. It was renamed to `Organization` (**BREAKING CHANGE**)

## [1.4.0] - 2026-05-21

Generated from [UML model 3.5.0](https://github.com/datafoodconsortium/data-model-uml/releases/tag/v3.5.0) using the [Connector codegen 1.3.0](https://github.com/datafoodconsortium/connector-codegen/releases/tag/v1.3.0).

Expand Down Expand Up @@ -63,16 +111,16 @@ Tests:

### Changed

- `Address:country` is now a `ISKOSConcept` to reflect ontology v1.16 state (**breaking change**).
- Rename `hasIncome` -> `hasInput` and `hasOutcome` -> `hasOutput` in `PlannedTransformation` (**breaking change**).
- Rename `incomeOf` > `inputOf` in `PlannedConsumptionFlow` (**breaking change**).
- Rename `outcomeOf` -> `outpufOf` in `PlannedProductionFlow` (**breaking change**).
- Rename `PhysicalPlace:addresses` to `PhysicalPlace:address` (singular) to support correct cardinatility (**breaking change**).
- Rename `PhysicalPlace:mainContact` to `PhysicalPlace:mainContacts` (plural) to support correct cardinatility (**breaking change**).
- `Address:country` is now a `ISKOSConcept` to reflect ontology v1.16 state (**BREAKING CHANGE**).
- Rename `hasIncome` -> `hasInput` and `hasOutcome` -> `hasOutput` in `PlannedTransformation` (**BREAKING CHANGE**).
- Rename `incomeOf` > `inputOf` in `PlannedConsumptionFlow` (**BREAKING CHANGE**).
- Rename `outcomeOf` -> `outpufOf` in `PlannedProductionFlow` (**BREAKING CHANGE**).
- Rename `PhysicalPlace:addresses` to `PhysicalPlace:address` (singular) to support correct cardinatility (**BREAKING CHANGE**).
- Rename `PhysicalPlace:mainContact` to `PhysicalPlace:mainContacts` (plural) to support correct cardinatility (**BREAKING CHANGE**).

### Removed

- Remove the `Quantity` class as there is no such class in the ontology. We should use `QuantitativeValue` (**breaking change**).
- Remove the `Quantity` class as there is no such class in the ontology. We should use `QuantitativeValue` (**BREAKING CHANGE**).

## [1.3.0] - 2025-12-17

Expand Down Expand Up @@ -258,7 +306,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.4.0...HEAD
[unreleased]: https://github.com/datafoodconsortium/connector-ruby/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.4.0...v2.0.0
[1.4.0]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.1.0...v1.2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
datafoodconsortium-connector-v1 (1.4.0.pre.beta8)
datafoodconsortium-connector (2.0.0.pre.beta8)
virtual_assembly-semantizer (~> 1.0, >= 1.0.5)

GEM
Expand Down Expand Up @@ -59,13 +59,13 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
datafoodconsortium-connector-v1!
datafoodconsortium-connector!
rspec

CHECKSUMS
bcp47_spec (0.2.1) sha256=3fd62edf96c126bd9624e4319ac74082a966081859d1ee0ef3c3041640a37810
bigdecimal (3.3.1) sha256=eaa01e228be54c4f9f53bf3cc34fe3d5e845c31963e7fcc5bedb05a4e7d52218
datafoodconsortium-connector-v1 (1.4.0.pre.beta8)
datafoodconsortium-connector (2.0.0.pre.beta8)
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
htmlentities (4.4.2) sha256=bbafbdf69f2eca9262be4efef7e43e6a1de54c95eb600f26984f71d2fe96c5c3
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,6 @@ The Pull Requests should be made on our [source code generator repository](https

To make the lockfile (*Gemfile.lock*), type `bundler lock`.

To generate the *.gem*, type `gem build connector_v1.gemspec`.
To generate the *.gem*, type `gem build connector.gemspec`.

To push the generated gem to rubygem.org, type `gem push -k dfc datafoodconsortium-connector-<...>.gem` where *dfc* is your credential key.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Gem::Specification.new do |s|
s.name = "datafoodconsortium-connector-v1"
s.version = "1.4.0-beta8"
s.summary = "Data Food Consortium connector version 1 (legacy)"
s.name = "datafoodconsortium-connector"
s.version = "2.0.0-beta8"
s.summary = "Data Food Consortium connector"
s.description = "A library to easily integrate the DFC standard within your application."
s.authors = ["Maxime Lecoq", "Maikel Linke"]
s.email = "maxime@lecoqlibre.fr"
s.files = Dir["lib/**/*.*"]
s.homepage = "https://github.com/datafoodconsortium/connector-ruby/releases/tag/v1.4.0"
s.homepage = "https://github.com/datafoodconsortium/connector-ruby/"
s.license = "MIT"

s.metadata = {
"changelog_uri" =>
"https://github.com/datafoodconsortium/connector-ruby/releases/tag/v1.4.0/blob/main/CHANGELOG.md",
"https://github.com/datafoodconsortium/connector-ruby/blob/main/CHANGELOG.md",
"source_code_uri" =>
"https://github.com/datafoodconsortium/connector-ruby/releases/tag/v1.4.0/",
"https://github.com/datafoodconsortium/connector-ruby/",
}

s.add_runtime_dependency "virtual_assembly-semantizer", "~> 1.0", ">= 1.0.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
# SOFTWARE.

require 'singleton'
require 'datafoodconsortium/connector_v1/context'
require 'datafoodconsortium/connector_v1/importer'
require 'datafoodconsortium/connector_v1/json_ld_serializer'
require 'datafoodconsortium/connector/context'
require 'datafoodconsortium/connector/importer'
require 'datafoodconsortium/connector/json_ld_serializer'

module DataFoodConsortium::ConnectorV1
module DataFoodConsortium::Connector
class Connector
include Singleton

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
require 'json/ld'

module DataFoodConsortium
module ConnectorV1
module Connector
# Preload the DFC context.
#
# Similar to: https://github.com/ruby-rdf/json-ld-preloaded/
class Context < JSON::LD::Context
URL = "https://w3id.org/dfc/ontology/context/context_1.16.0.json"
URL_NORMALISED = "http://w3id.org/dfc/ontology/context/context_1.16.0.json"
URL = "https://w3id.org/dfc/ontology/context/context_2.0.0.json"
URL_NORMALISED = "http://w3id.org/dfc/ontology/context/context_2.0.0.json"

# All context URIs have to use http because https is normalised to http
# All context URIs have to use http because https is normalised to http
# during the lookup of preloaded contexts.
# And if the URI doesn't have a path, it must end with `/`.
add_preloaded(URL_NORMALISED) { parse(json) }
Expand All @@ -21,20 +21,12 @@ class Context < JSON::LD::Context

# This is the current file the DFC website refers to in a link header.
alias_preloaded(
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_1.16.0.jsonld",
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_2.0.0.jsonld",
URL_NORMALISED
)

# This was the file the DFC website refers to in a link header.
alias_preloaded(
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context.jsonld",
URL_NORMALISED
)

# This is the old URL that's not online anymore.
# Keep it for compatiblity with all versions before 1.8.
alias_preloaded(
"http://static.datafoodconsortium.org/ontologies/context.json",
"https://cdn.jsdelivr.net/gh/datafoodconsortium/ontology/context/context_2.0.0.json",
URL_NORMALISED
)

Expand All @@ -44,8 +36,8 @@ def self.inputContext
end

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