Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Composed product with offers #170

Open
lecoqlibre opened this issue Jan 15, 2025 · 2 comments
Open

[FEATURE] Composed product with offers #170

lecoqlibre opened this issue Jan 15, 2025 · 2 comments

Comments

@lecoqlibre
Copy link
Member

For my CSA app I need the ability to save a share information. A share is composed by different sub products like for instance 3kg of tomato, 1kg of carrot, 1p salad. In addition the user must be able to save an offer for each sub product. This is required to compute and show the amount of each sub product of the share:

  • 3 x tomato (kg) @ 4€/kg = 12 €
  • 1 x carrot (kg) @ 2€/kg = 2 €
  • 1 x salad (p) @ 1€/p = 1 €

I was trying to implement this using the transformation loop (AsPlannedTransformation). However the transformation loop does not save offers but only products.

How could I save the offer part of each product contained in a share?

@lecoqlibre
Copy link
Member Author

We discussed with @Alcoz this afternoon and we found that what I'm searching for is probably an Offer composition: the ability for one offer to be made by sub offers.

I will try to implement it and provide feedback and we can discuss to include it in the ontology.

@lecoqlibre
Copy link
Member Author

lecoqlibre commented Jan 17, 2025

I need to save the quantity of the sub-offer. @Alcoz suggested to use the variant feature for that.

Here is an example of a catalog containing a share with sub-offers (I reused the dfc-b:constitutedBy property):

@prefix dfc-b: <https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#>.

<>
  dfc-b:lists <#share1CatalogItem>.

<#share1CatalogItem> a dfc-b:CatalogItem;
  dfc-b:offeredThrough <#share1Offer>;
  dfc-b:references <../../supplied-products/share1/index>.

<#share1Offer> a dfc-b:Offer;
  dfc-b:offers <#share1CatalogItem>;
  dfc-b:hasPrice [ a dfc-b:Price;
      dfc-b:value 10.00;
      dfc-b:vatRate 5.5
    ];
  dfc-b:constitutedBy [
    a dfc-b:Offer;
    dfc-b:hasPrice [ a dfc-b:Price;
      dfc-b:value 4.0;
      dfc-b:vatRate 5.5
    ];
    dfc-b:offers [
        a dfc-b:CatalogItem;
        dfc-b:references [
          a dfc-b:SuppliedProduct;
          dfc-b:quantity 3.0;
          dfc-b:isVariantOf <../../supplied-products/tomato/index>;
        ];
    ]
  ], [
    a dfc-b:Offer;
    dfc-b:hasPrice [ a dfc-b:Price;
      dfc-b:value 2.20;
      dfc-b:vatRate 5.5
    ];
    dfc-b:offers [
        a dfc-b:CatalogItem;
        dfc-b:references [
          a dfc-b:SuppliedProduct;
          dfc-b:quantity 1.25;
          dfc-b:isVariantOf <../../supplied-products/carrot/index>;
        ];
    ]
  ].

I used blank nodes to avoid to create many variants (in the supplied-products container) which are only changing the quantity.

We can also factorize using the existing offers in another catalog:

@prefix dfc-b: <https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#>.

<>
  dfc-b:lists <#share1CatalogItem>.

<#share1CatalogItem> a dfc-b:CatalogItem;
  dfc-b:offeredThrough <#share1Offer>;
  dfc-b:references <../../supplied-products/share1/index>.

<#share1Offer> a dfc-b:Offer;
  dfc-b:offers <#share1CatalogItem>;
  dfc-b:hasPrice [ a dfc-b:Price;
      dfc-b:value 10.00;
      dfc-b:vatRate 5.5
    ];
  dfc-b:constitutedBy <../catalogDefault/index#tomatoOffer>, <../catalogDefault/index#carrotOffer>.

<../catalogDefault/index#tomatoOffer> dfc-b:offers [
        a dfc-b:CatalogItem;
        dfc-b:references [
          a dfc-b:SuppliedProduct;
          dfc-b:quantity 3.0;
          dfc-b:isVariantOf <../../supplied-products/tomato/index>;
        ];
    ].

<../catalogDefault/index#carrotOffer> dfc-b:offers [
        a dfc-b:CatalogItem;
        dfc-b:references [
          a dfc-b:SuppliedProduct;
          dfc-b:quantity 1.25;
          dfc-b:isVariantOf <../../supplied-products/carrot/index>;
        ];
    ].

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

No branches or pull requests

1 participant