diff --git a/engines/dfc_provider/app/controllers/dfc_provider/supplied_products_controller.rb b/engines/dfc_provider/app/controllers/dfc_provider/supplied_products_controller.rb index e2da4c46b7..3dddc7cb6e 100644 --- a/engines/dfc_provider/app/controllers/dfc_provider/supplied_products_controller.rb +++ b/engines/dfc_provider/app/controllers/dfc_provider/supplied_products_controller.rb @@ -37,9 +37,8 @@ module DfcProvider description: dfc_request["dfc-b:description"], ) - # This input is DFC v1.6 currently sent by the DFC Prototype. variant.update!( - unit_value: dfc_request["dfc-b:quantity"], + unit_value: dfc_request["dfc-b:hasQuantity"]["dfc-b:value"], ) end diff --git a/engines/dfc_provider/spec/fixtures/files/patch_supplied_product.json b/engines/dfc_provider/spec/fixtures/files/patch_supplied_product.json deleted file mode 100644 index 86230c7e7a..0000000000 --- a/engines/dfc_provider/spec/fixtures/files/patch_supplied_product.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "@context": { - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "skos": "http://www.w3.org/2004/02/skos/core#", - "dfc": "http://static.datafoodconsortium.org/ontologies/DFC_FullModel.owl#", - "dc": "http://purl.org/dc/elements/1.1/#", - "dfc-b": "http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#", - "dfc-p": "http://static.datafoodconsortium.org/ontologies/DFC_ProductOntology.owl#", - "dfc-t": "http://static.datafoodconsortium.org/ontologies/DFC_TechnicalOntology.owl#", - "dfc-m": "http://static.datafoodconsortium.org/data/measures.rdf#", - "dfc-pt": "http://static.datafoodconsortium.org/data/productTypes.rdf#", - "dfc-f": "http://static.datafoodconsortium.org/data/facets.rdf#", - "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: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:hasNutrimentDimension": { - "@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" - } - }, - "dfc-b:description": "DFC-Pesto updated", - "dfc-b:quantity": 17 -} diff --git a/engines/dfc_provider/spec/fixtures/files/put_supplied_product.json b/engines/dfc_provider/spec/fixtures/files/put_supplied_product.json new file mode 100644 index 0000000000..cc081912bb --- /dev/null +++ b/engines/dfc_provider/spec/fixtures/files/put_supplied_product.json @@ -0,0 +1,105 @@ +{ + "@context": { + "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" + } + }, + "@id": "https://staging.coopcircuits.fr/api/dfc-v1.7/enterprises/2731/supplied_products/56790", + "@type": "dfc-b:SuppliedProduct", + "dfc-b:alcoholPercentage": 0, + "dfc-b:description": "DFC-Pesto updated", + "dfc-b:hasQuantity": { + "@type": "dfc-b:QuantitativeValue", + "dfc-b:hasUnit": "dfc-m:Piece", + "dfc-b:value": 17 + }, + "dfc-b:hasType": "dfc-pt:non-local-vegetable", + "dfc-b:lifetime": "", + "dfc-b:name": "Pesto novo", + "dfc-b:totalTheoreticalStock": 0, + "dfc-b:usageOrStorageCondition": "", + "dfc:owner": "http://proto.datafoodconsortium.org:3000/ldp/user/64c1d30351ecb4367037a9f6", + "dfc-b:hasPhysicalCharacteristic": [], + "dfc-b:hasNutrientCharacteristic": [], + "dfc-b:hasAllergenCharacteristic": [] +} diff --git a/engines/dfc_provider/spec/requests/supplied_products_spec.rb b/engines/dfc_provider/spec/requests/supplied_products_spec.rb index 689487bddb..23d5a96117 100644 --- a/engines/dfc_provider/spec/requests/supplied_products_spec.rb +++ b/engines/dfc_provider/spec/requests/supplied_products_spec.rb @@ -128,7 +128,7 @@ describe "SuppliedProducts", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml consumes "application/json" parameter name: :supplied_product, in: :body, schema: { - example: ExampleJson.read("patch_supplied_product") + example: ExampleJson.read("put_supplied_product") } let(:id) { variant.id } diff --git a/swagger/dfc-v1.7/swagger.yaml b/swagger/dfc-v1.7/swagger.yaml index 9ca116cf4f..8ef4ceba5d 100644 --- a/swagger/dfc-v1.7/swagger.yaml +++ b/swagger/dfc-v1.7/swagger.yaml @@ -412,14 +412,15 @@ paths: "@context": rdfs: http://www.w3.org/2000/01/rdf-schema# skos: http://www.w3.org/2004/02/skos/core# - dfc: http://static.datafoodconsortium.org/ontologies/DFC_FullModel.owl# + dfc: https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_FullModel.owl# dc: http://purl.org/dc/elements/1.1/# - dfc-b: http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl# - dfc-p: http://static.datafoodconsortium.org/ontologies/DFC_ProductOntology.owl# - dfc-t: http://static.datafoodconsortium.org/ontologies/DFC_TechnicalOntology.owl# - dfc-m: http://static.datafoodconsortium.org/data/measures.rdf# - dfc-pt: http://static.datafoodconsortium.org/data/productTypes.rdf# - dfc-f: http://static.datafoodconsortium.org/data/facets.rdf# + 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: @@ -442,6 +443,8 @@ paths: "@type": "@id" dfc-b:affiliates: "@type": "@id" + dfc-b:hasCertification: + "@type": "@id" dfc-b:manages: "@type": "@id" dfc-b:offeredThrough: @@ -454,7 +457,7 @@ paths: "@type": "@id" dfc-b:hasAllergenDimension: "@type": "@id" - dfc-b:hasNutrimentDimension: + dfc-b:hasNutrientDimension: "@type": "@id" dfc-b:hasPhysicalDimension: "@type": "@id" @@ -466,7 +469,22 @@ paths: "@type": "@id" dfc-t:represent: "@type": "@id" + "@id": https://staging.coopcircuits.fr/api/dfc-v1.7/enterprises/2731/supplied_products/56790 + "@type": dfc-b:SuppliedProduct + dfc-b:alcoholPercentage: 0 dfc-b:description: DFC-Pesto updated - dfc-b:quantity: 17 + dfc-b:hasQuantity: + "@type": dfc-b:QuantitativeValue + dfc-b:hasUnit: dfc-m:Piece + dfc-b:value: 17 + dfc-b:hasType: dfc-pt:non-local-vegetable + dfc-b:lifetime: '' + dfc-b:name: Pesto novo + dfc-b:totalTheoreticalStock: 0 + dfc-b:usageOrStorageCondition: '' + dfc:owner: http://proto.datafoodconsortium.org:3000/ldp/user/64c1d30351ecb4367037a9f6 + dfc-b:hasPhysicalCharacteristic: [] + dfc-b:hasNutrientCharacteristic: [] + dfc-b:hasAllergenCharacteristic: [] servers: - url: "/"