Skip to content

Version 2.0.0#30

Open
lecoqlibre wants to merge 15 commits into
mainfrom
v2.0.0
Open

Version 2.0.0#30
lecoqlibre wants to merge 15 commits into
mainfrom
v2.0.0

Conversation

@lecoqlibre

Copy link
Copy Markdown
Member

Created from closed #29.

@lecoqlibre lecoqlibre requested a review from mkllnk April 24, 2026 10:50

@mkllnk mkllnk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI build is broken due to an old bundler version. Are you planning to fix that or should I have a look?

Comment thread lib/datafoodconsortium/connector/context.rb Outdated
@lecoqlibre lecoqlibre self-assigned this Apr 27, 2026
@lecoqlibre

Copy link
Copy Markdown
Member Author

The CI build is broken due to an old bundler version. Are you planning to fix that or should I have a look?

OK I let you have a look, thanks @mkllnk.

@lecoqlibre lecoqlibre requested a review from mkllnk April 27, 2026 12:57
@mkllnk

mkllnk commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

I updated the Ruby versions. Bundler is installing now but the specs are still out of date and it's not compatible with Ruby 4 yet.

@lecoqlibre

Copy link
Copy Markdown
Member Author

OK, I've added the w3id and jsdeliver aliases and deleted the Enterprise class.

Released as https://rubygems.org/gems/datafoodconsortium-connector/versions/2.0.0.pre.beta2.

@lecoqlibre

Copy link
Copy Markdown
Member Author

I've just released a new version containing some fixes: https://rubygems.org/gems/datafoodconsortium-connector/versions/2.0.0.pre.beta3.

There are still some fixes to do.

@lecoqlibre

lecoqlibre commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

I've just released https://rubygems.org/gems/datafoodconsortium-connector/versions/2.0.0.pre.beta4.

It should be complete now in term of feature.

Still have to make the tests to pass.

@mkllnk

mkllnk commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Should we add a class for an LDP container to the library? Containers are part of the standard now. I just created this within OFN:

# frozen_string_literal: true

module DfcProvider
  # The DFC v2 mandates the use of LDP containers to list resources.
  # The Connector didn't provide a class for that, so we add it here.
  class Container
    include VirtualAssembly::Semantizer::SemanticObject

    SEMANTIC_TYPE = "ldp:Container"

    attr_accessor :members

    def initialize(semantic_id, members: [])
      super(semantic_id)
      self.semanticType = SEMANTIC_TYPE

      @members = members
      registerSemanticProperty("ldp:contains", &method("members")).valueSetter = method("members=")
    end
  end
end

@lecoqlibre

Copy link
Copy Markdown
Member Author

@mkllnk I've released v2.0.0-beta6 which fixes the tests. Ready for testing. We should add more tests to test new classes.

There is still one error in the tests which might be related to a taxonomy URL issue: the context links dfc-m to http://w3id.org/dfc/taxonomies/v2.0.0/measures.rdf# but the URI of the taxons in that file is http://w3id.org/dfc/taxonomies/measures.rdf# (missing the /v2.0.0).

@lecoqlibre lecoqlibre marked this pull request as ready for review June 10, 2026 17:42
@mkllnk

mkllnk commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

the context links dfc-m to http://w3id.org/dfc/taxonomies/v2.0.0/measures.rdf# but the URI of the taxons in that file is http://w3id.org/dfc/taxonomies/measures.rdf# (missing the /v2.0.0).

Do we want the ids of taxons to include versions? In that case Vegetables v1 != Vegetables v2 which sounds like a major compatibility hurdle.

Comment thread lib/datafoodconsortium/connector/context.rb Outdated
@lecoqlibre lecoqlibre requested a review from mkllnk June 16, 2026 08:10
@lecoqlibre

Copy link
Copy Markdown
Member Author

the context links dfc-m to http://w3id.org/dfc/taxonomies/v2.0.0/measures.rdf# but the URI of the taxons in that file is http://w3id.org/dfc/taxonomies/measures.rdf# (missing the /v2.0.0).

Do we want the ids of taxons to include versions? In that case Vegetables v1 != Vegetables v2 which sounds like a major compatibility hurdle.

You're right, there was a URI to change in the lib/importer.rb file, see 37a589d.


id = object.value.sub(
"http://static.datafoodconsortium.org/data/measures.rdf#", "dfc-m:"
"http://w3id.org/dfc/taxonomies/v2.0.0/measures.rdf#", "dfc-m:"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any file referencing this? When I visit the URL, I'm redirected to https://cdn.jsdelivr.net/gh/datafoodconsortium/taxonomies@v2.0.0/measures.rdf which contains the right ids without /v2.0.0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently there are. Fixing this allowed to pass the test "imports a graph including anonymous objects" from the file spec/importer_spec.rb.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You introduced the spec/importer.rb containing this code snippet in the connector-codegen repo on Jan 7, 2024 with this commit stating:

This was copied from Open Food Network and only changes static files. The next commits will improve this by leveraging the code generator.

In the ruby-connector repo it has been introduced by this commit

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original spec was for the original context referencing https://github.com/datafoodconsortium/taxonomies/releases/latest/download/. You updated that spec to include the v2.0.0 string but that's not real data. The new context would not contain the version string, right?

I think that this code for backwards-compatibility can be removed now. We just use the new context in v2.

-  let(:product_data_with_context_v1_8) do
+  let(:product_data_with_context_v2) do
    <<~JSON
      {
        "@context": {
-          "dfc-b": "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.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-b": "http://w3id.org/dfc/ontology/v2.0.0/src/DFC_BusinessOntology.owl#",
+          "dfc-m": "http://w3id.org/dfc/taxonomies/v2.0.0/measures.rdf#",
+          "dfc-pt": "http://w3id.org/dfc/taxonomies/v2.0.0/productTypes.rdf#",

Comment on lines +24 to +30
"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",
"http://www.datafoodconsortium.org/wp-content/plugins/wordpress-context-jsonld/context_2.0.0.jsonld",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate now. The context is only available with version number. We can remove one of these aliases.

Why do we still publish the context on the Wordpress site? Isn't the w3id.org URL the one everyone should use? It redirects to JSDelivr and it makes sense to add that alias, in case someone wants to avoid the redirect. But what's the use case for the Wordpress link now?

I guess that the link header points there but it could just point to the w3id URL, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, right, I've deleted the duplicate preload. Maybe it has been included when I merged manually.

OK I agree the WP link seems useless now. We should use the JSDelivr URL.

I don't know if we want to keep the Link: <...>; rel="alternate" to link the domain with the context? If so it would make more sense to add this link to the dfc-standard.org domain which should be used as the standard new official URL while datafoodconsortium.org is about the french-only project.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we want to keep the Link: <...>; rel="alternate" to link the domain with the context? If so it would make more sense to add this link to the dfc-standard.org domain which should be used as the standard new official URL while datafoodconsortium.org is about the french-only project.

That makes sense. But most implementations should link to a specific version on w3id anyway, I think. The dfc-standard.org reference would be for examples and applications that thrive for maximum compatibility with all versions (>= 2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants