Fix DFC context in spec example

This commit is contained in:
Maikel Linke
2023-08-31 17:06:20 +10:00
parent 514b8fa6ab
commit 57b4f615e8
3 changed files with 7 additions and 2 deletions

View File

@@ -110,7 +110,7 @@ class QuantitativeValueBuilder < DfcBuilder
else
# Labels may be provided one day:
# https://github.com/datafoodconsortium/connector-ruby/issues/18
label = unit.semanticId.split("#").last || "items"
label = unit.try(:semanticId)&.split("#")&.last || "items"
["items", label, 1]
end
end

View File

@@ -32,6 +32,9 @@ describe "SuppliedProducts", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml
'dfc-b': "http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#",
'dfc-m': "http://static.datafoodconsortium.org/data/measures.rdf#",
'dfc-pt': "http://static.datafoodconsortium.org/data/productTypes.rdf#",
'dfc-b:hasUnit': {
'@type': "@id"
},
},
'@id': "http://test.host/api/dfc-v1.7/enterprises/6201/supplied_products/0",
'@type': "dfc-b:SuppliedProduct",

View File

@@ -330,7 +330,7 @@ paths:
dfc-b:hasType: http://static.datafoodconsortium.org/data/productTypes.rdf#non-local-vegetable
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: dfc-m:Piece
dfc-b:hasUnit: dfc-m:Gram
dfc-b:value: 3.0
dfc-b:alcoholPercentage: 0.0
dfc-b:lifetime: ''
@@ -345,6 +345,8 @@ paths:
dfc-b: http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#
dfc-m: http://static.datafoodconsortium.org/data/measures.rdf#
dfc-pt: http://static.datafoodconsortium.org/data/productTypes.rdf#
dfc-b:hasUnit:
"@type": "@id"
"@id": http://test.host/api/dfc-v1.7/enterprises/6201/supplied_products/0
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple