mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #11263 from mkllnk/dfc-connector-context
Dfc connector context
This commit is contained in:
18
Gemfile.lock
18
Gemfile.lock
@@ -231,8 +231,8 @@ GEM
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
datafoodconsortium-connector (1.0.0.pre.alpha.6)
|
||||
virtual_assembly-semantizer (~> 1.0, >= 1.0.4)
|
||||
datafoodconsortium-connector (1.0.0.pre.alpha.8)
|
||||
virtual_assembly-semantizer (~> 1.0, >= 1.0.5)
|
||||
date (3.3.3)
|
||||
debug (1.8.0)
|
||||
irb (>= 1.5.0)
|
||||
@@ -352,20 +352,20 @@ GEM
|
||||
jquery-ui-rails (4.2.1)
|
||||
railties (>= 3.2.16)
|
||||
json (2.6.3)
|
||||
json-canonicalization (0.3.1)
|
||||
json-canonicalization (0.3.2)
|
||||
json-jwt (1.16.3)
|
||||
activesupport (>= 4.2)
|
||||
aes_key_wrap
|
||||
bindata
|
||||
faraday (~> 2.0)
|
||||
faraday-follow_redirects
|
||||
json-ld (3.2.3)
|
||||
json-ld (3.2.5)
|
||||
htmlentities (~> 4.3)
|
||||
json-canonicalization (~> 0.3)
|
||||
json-canonicalization (~> 0.3, >= 0.3.2)
|
||||
link_header (~> 0.0, >= 0.0.8)
|
||||
multi_json (~> 1.15)
|
||||
rack (~> 2.2)
|
||||
rdf (~> 3.2, >= 3.2.9)
|
||||
rack (>= 2.2, < 4)
|
||||
rdf (~> 3.2, >= 3.2.10)
|
||||
json-schema (3.0.0)
|
||||
addressable (>= 2.8)
|
||||
json_spec (1.1.5)
|
||||
@@ -556,7 +556,7 @@ GEM
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rdf (3.2.9)
|
||||
rdf (3.2.11)
|
||||
link_header (~> 0.0, >= 0.0.8)
|
||||
redcarpet (3.6.0)
|
||||
redis (4.8.1)
|
||||
@@ -737,7 +737,7 @@ GEM
|
||||
rails (>= 5.2, < 8.0)
|
||||
stimulus_reflex (>= 3.5.0.pre2)
|
||||
view_component (>= 2.28.0)
|
||||
virtual_assembly-semantizer (1.0.4)
|
||||
virtual_assembly-semantizer (1.0.5)
|
||||
json-ld (~> 3.2, >= 3.2.3)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
|
||||
@@ -6,14 +6,12 @@ Openfoodnetwork::Application.routes.draw do
|
||||
|
||||
# Mount DFC API endpoints
|
||||
#
|
||||
# We're using the DFC Connector which produces DFC v1.7 data but the
|
||||
# DFC prototype is still pointing to the old URL. We keep it for
|
||||
# testing.
|
||||
mount DfcProvider::Engine, at: '/dfc-v1.6/', as: :legacy_dfc_provider_engine
|
||||
# Latest implemented version:
|
||||
mount DfcProvider::Engine, at: '/dfc/'
|
||||
|
||||
# The DFC API version depends on the version of the
|
||||
# datafoodconsortium-connector gem.
|
||||
mount DfcProvider::Engine, at: '/dfc-v1.7/'
|
||||
# The DFC prototype is still pointing to the old URL though:
|
||||
mount DfcProvider::Engine, at: '/dfc-v1.6/', as: :legacy_dfc_provider_engine
|
||||
mount DfcProvider::Engine, at: '/dfc-v1.7/', as: :v1_7_dfc_provider_engine
|
||||
|
||||
namespace :v0 do
|
||||
resources :products do
|
||||
|
||||
@@ -8,7 +8,7 @@ module DfcProvider
|
||||
|
||||
def index
|
||||
person = PersonBuilder.person(current_user)
|
||||
render json: DfcLoader.connector.export(
|
||||
render json: DfcIo.export(
|
||||
person,
|
||||
*person.affiliatedOrganizations,
|
||||
*person.affiliatedOrganizations.flat_map(&:catalogItems),
|
||||
@@ -20,7 +20,7 @@ module DfcProvider
|
||||
def show
|
||||
catalog_item = DfcBuilder.catalog_item(variant)
|
||||
offers = catalog_item.offers
|
||||
render json: DfcLoader.connector.export(catalog_item, *offers)
|
||||
render json: DfcIo.export(catalog_item, *offers)
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -7,7 +7,7 @@ module DfcProvider
|
||||
|
||||
def show
|
||||
enterprise = EnterpriseBuilder.enterprise(current_enterprise)
|
||||
render json: DfcLoader.connector.export(
|
||||
render json: DfcIo.export(
|
||||
enterprise,
|
||||
*enterprise.suppliedProducts,
|
||||
*enterprise.catalogItems,
|
||||
|
||||
@@ -7,7 +7,7 @@ module DfcProvider
|
||||
|
||||
def show
|
||||
person = PersonBuilder.person(user)
|
||||
render json: DfcLoader.connector.export(person)
|
||||
render json: DfcIo.export(person)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -23,12 +23,12 @@ module DfcProvider
|
||||
supplied_product = SuppliedProductBuilder.supplied_product(
|
||||
product.variants.first
|
||||
)
|
||||
render json: DfcLoader.connector.export(supplied_product)
|
||||
render json: DfcIo.export(supplied_product)
|
||||
end
|
||||
|
||||
def show
|
||||
product = SuppliedProductBuilder.supplied_product(variant)
|
||||
render json: DfcLoader.connector.export(product)
|
||||
render json: DfcIo.export(product)
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
65
engines/dfc_provider/app/services/dfc_io.rb
Normal file
65
engines/dfc_provider/app/services/dfc_io.rb
Normal file
@@ -0,0 +1,65 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Our interface to the DFC Connector library.
|
||||
module DfcIo
|
||||
CONTEXT = JSON.parse <<~JSON
|
||||
{
|
||||
"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" }
|
||||
}
|
||||
JSON
|
||||
|
||||
# The HashSerializer expects only string values.
|
||||
# This context is only used to shorten URIs.
|
||||
SERIALIZER_CONTEXT = CONTEXT.select { |_key, value| value.is_a?(String) }.freeze
|
||||
|
||||
# Serialise DFC Connector subjects as JSON-LD string.
|
||||
#
|
||||
# This is a re-implementation of the Connector.export to provide our own context.
|
||||
def self.export(*subjects)
|
||||
return "" if subjects.empty?
|
||||
|
||||
serializer = VirtualAssembly::Semantizer::HashSerializer.new(SERIALIZER_CONTEXT)
|
||||
|
||||
hashes = subjects.map do |subject|
|
||||
# JSON::LD needs a context on every input using prefixes.
|
||||
subject.serialize(serializer).merge("@context" => CONTEXT)
|
||||
end
|
||||
|
||||
json_ld = JSON::LD::API.compact(hashes, CONTEXT)
|
||||
JSON.generate(json_ld)
|
||||
end
|
||||
end
|
||||
37
engines/dfc_provider/spec/services/dfc_io_spec.rb
Normal file
37
engines/dfc_provider/spec/services/dfc_io_spec.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require DfcProvider::Engine.root.join("spec/spec_helper")
|
||||
|
||||
describe DfcIo do
|
||||
let(:person) do
|
||||
DataFoodConsortium::Connector::Person.new("Pete")
|
||||
end
|
||||
let(:enterprise) do
|
||||
DataFoodConsortium::Connector::Enterprise.new("Pete's Pumpkins")
|
||||
end
|
||||
|
||||
describe ".export" do
|
||||
it "exports nothing" do
|
||||
expect(DfcIo.export).to eq ""
|
||||
end
|
||||
|
||||
it "embeds the context" do
|
||||
json = DfcIo.export(person)
|
||||
result = JSON.parse(json)
|
||||
|
||||
expect(result["@context"]).to be_a Hash
|
||||
end
|
||||
|
||||
it "uses the context to shorten URIs" do
|
||||
person.affiliatedOrganizations << enterprise
|
||||
|
||||
json = DfcIo.export(person, enterprise)
|
||||
result = JSON.parse(json)
|
||||
|
||||
expect(result["@graph"].count).to eq 2
|
||||
expect(result["@graph"].first.keys).to include(
|
||||
*%w(@id @type dfc-b:affiliates)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,8 +4,6 @@ require DfcProvider::Engine.root.join("spec/spec_helper")
|
||||
|
||||
describe DfcLoader do
|
||||
it "prepares the DFC Connector to provide DFC object classes for export" do
|
||||
connector = DfcLoader.connector
|
||||
|
||||
tomato = DataFoodConsortium::Connector::SuppliedProduct.new(
|
||||
"https://openfoodnetwork.org/tomato",
|
||||
name: "Tomato",
|
||||
@@ -15,7 +13,7 @@ describe DfcLoader do
|
||||
expect(tomato.name).to eq "Tomato"
|
||||
expect(tomato.description).to eq "Awesome tomato"
|
||||
|
||||
json = connector.export(tomato)
|
||||
json = DfcIo.export(tomato)
|
||||
result = JSON.parse(json)
|
||||
|
||||
expect(result.keys).to include(
|
||||
|
||||
@@ -23,10 +23,10 @@ module DataFoodConsortium
|
||||
type_uri = clazz.new(*args).semanticType
|
||||
result[type_uri] = clazz
|
||||
|
||||
# Add support for the new DFC v1.8 URLs:
|
||||
# Add support for the old DFC v1.7 URLs:
|
||||
new_type_uri = type_uri.gsub(
|
||||
"http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#",
|
||||
"https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#"
|
||||
"https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
|
||||
"http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#"
|
||||
)
|
||||
result[new_type_uri] = clazz
|
||||
end
|
||||
@@ -80,16 +80,16 @@ module DataFoodConsortium
|
||||
property_id = statement.predicate.value
|
||||
value = resolve_object(statement.object)
|
||||
|
||||
# Hacky support of new DFC v1.8 ids:
|
||||
# Backwards-compatibility with old DFC v1.7 ids:
|
||||
unless subject.hasSemanticProperty?(property_id)
|
||||
property_id = property_id.gsub(
|
||||
"https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
|
||||
"http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#"
|
||||
"http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#",
|
||||
"https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#"
|
||||
)
|
||||
end
|
||||
return unless subject.hasSemanticProperty?(property_id)
|
||||
|
||||
property = subject.__send__(:findSemanticProperty, property_id)
|
||||
property = subject.semanticProperty(property_id)
|
||||
|
||||
if property.value.is_a?(Enumerable)
|
||||
property.value << value
|
||||
|
||||
@@ -91,7 +91,7 @@ RSpec.configure do |config|
|
||||
expectations.syntax = :expect
|
||||
end
|
||||
|
||||
config.around(:each) do |example|
|
||||
config.around(:each, vcr: true) do |example|
|
||||
# The DFC Connector fetches the context when loaded.
|
||||
VCR.use_cassette("dfc-context") do
|
||||
example.run
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: http://static.datafoodconsortium.org/ontologies/context.json
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/ld+json;profile=http://www.w3.org/ns/json-ld#context, application/ld+json;q=0.9,
|
||||
text/html;q=0.8, application/xhtml+xml;q=0.8, application/json;q=0.5
|
||||
User-Agent:
|
||||
- Ruby RDF.rb/3.2.11
|
||||
Accept-Encoding:
|
||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '2287'
|
||||
Server:
|
||||
- GitHub.com
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
Last-Modified:
|
||||
- Fri, 30 Jun 2023 11:40:56 GMT
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Etag:
|
||||
- W/"649ebf48-8ef"
|
||||
Expires:
|
||||
- Mon, 24 Jul 2023 04:38:43 GMT
|
||||
Cache-Control:
|
||||
- max-age=600
|
||||
X-Proxy-Cache:
|
||||
- MISS
|
||||
X-Github-Request-Id:
|
||||
- 24DC:04FB:2AEA02:31C021:64BDFDF3
|
||||
Accept-Ranges:
|
||||
- bytes
|
||||
Date:
|
||||
- Mon, 24 Jul 2023 05:44:37 GMT
|
||||
Via:
|
||||
- 1.1 varnish
|
||||
Age:
|
||||
- '0'
|
||||
X-Served-By:
|
||||
- cache-mel11282-MEL
|
||||
X-Cache:
|
||||
- HIT
|
||||
X-Cache-Hits:
|
||||
- '1'
|
||||
X-Timer:
|
||||
- S1690177478.716470,VS0,VE228
|
||||
Vary:
|
||||
- Accept-Encoding
|
||||
X-Fastly-Request-Id:
|
||||
- 4abc71bc0dad77693c85526b60655799fab0500a
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: |
|
||||
{
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
}
|
||||
recorded_at: Mon, 24 Jul 2023 05:44:37 GMT
|
||||
recorded_with: VCR 6.2.0
|
||||
213
spec/fixtures/vcr_cassettes/dfc-context.yml
vendored
213
spec/fixtures/vcr_cassettes/dfc-context.yml
vendored
File diff suppressed because one or more lines are too long
@@ -112,7 +112,7 @@ describe DataFoodConsortium::Connector::Importer, vcr: true do
|
||||
result = connector.import(product_data)
|
||||
|
||||
expect(result.class).to eq DataFoodConsortium::Connector::SuppliedProduct
|
||||
expect(result.semanticType).to eq "http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#SuppliedProduct"
|
||||
expect(result.semanticType).to eq "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#SuppliedProduct"
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
expect(result.description).to eq "Awesome tomato"
|
||||
@@ -123,7 +123,7 @@ describe DataFoodConsortium::Connector::Importer, vcr: true do
|
||||
result = connector.import(product_data_with_context)
|
||||
|
||||
expect(result.class).to eq DataFoodConsortium::Connector::SuppliedProduct
|
||||
expect(result.semanticType).to eq "http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#SuppliedProduct"
|
||||
expect(result.semanticType).to eq "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#SuppliedProduct"
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
expect(result.description).to eq "Awesome tomato"
|
||||
@@ -134,7 +134,7 @@ describe DataFoodConsortium::Connector::Importer, vcr: true do
|
||||
result = connector.import(product_data_with_context_v1_8)
|
||||
|
||||
expect(result.class).to eq DataFoodConsortium::Connector::SuppliedProduct
|
||||
expect(result.semanticType).to eq "http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#SuppliedProduct"
|
||||
expect(result.semanticType).to eq "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#SuppliedProduct"
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
expect(result.description).to eq "Awesome tomato"
|
||||
|
||||
@@ -57,7 +57,66 @@ paths:
|
||||
examples:
|
||||
test_example:
|
||||
value:
|
||||
"@context": http://static.datafoodconsortium.org/ontologies/context.json
|
||||
"@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"
|
||||
"@graph":
|
||||
- "@id": http://test.host/api/dfc-v1.7/persons/12345
|
||||
"@type": dfc-b:Person
|
||||
@@ -79,7 +138,7 @@ paths:
|
||||
"@type": dfc-b:SuppliedProduct
|
||||
dfc-b:name: Apple
|
||||
dfc-b:description: Red
|
||||
dfc-b:hasType: dfc-pt:non-local-vegetable
|
||||
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:Gram
|
||||
@@ -116,7 +175,66 @@ paths:
|
||||
examples:
|
||||
test_example:
|
||||
value:
|
||||
"@context": http://static.datafoodconsortium.org/ontologies/context.json
|
||||
"@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"
|
||||
"@graph":
|
||||
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000/catalog_items/10001
|
||||
"@type": dfc-b:CatalogItem
|
||||
@@ -217,7 +335,66 @@ paths:
|
||||
examples:
|
||||
test_example:
|
||||
value:
|
||||
"@context": http://static.datafoodconsortium.org/ontologies/context.json
|
||||
"@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"
|
||||
"@graph":
|
||||
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000
|
||||
"@type": dfc-b:Enterprise
|
||||
@@ -230,7 +407,7 @@ paths:
|
||||
"@type": dfc-b:SuppliedProduct
|
||||
dfc-b:name: Apple
|
||||
dfc-b:description: Round
|
||||
dfc-b:hasType: dfc-pt:non-local-vegetable
|
||||
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:Gram
|
||||
@@ -264,7 +441,66 @@ paths:
|
||||
examples:
|
||||
test_example:
|
||||
value:
|
||||
"@context": http://static.datafoodconsortium.org/ontologies/context.json
|
||||
"@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": http://test.host/api/dfc-v1.7/persons/10000
|
||||
"@type": dfc-b:Person
|
||||
'404':
|
||||
@@ -289,12 +525,71 @@ paths:
|
||||
examples:
|
||||
test_example:
|
||||
value:
|
||||
"@context": http://static.datafoodconsortium.org/ontologies/context.json
|
||||
"@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": http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001
|
||||
"@type": dfc-b:SuppliedProduct
|
||||
dfc-b:name: Apple
|
||||
dfc-b:description: A delicious heritage apple
|
||||
dfc-b:hasType: dfc-pt:non-local-vegetable
|
||||
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
|
||||
@@ -347,12 +642,71 @@ paths:
|
||||
examples:
|
||||
test_example:
|
||||
value:
|
||||
"@context": http://static.datafoodconsortium.org/ontologies/context.json
|
||||
"@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": http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001
|
||||
"@type": dfc-b:SuppliedProduct
|
||||
dfc-b:name: Pesto
|
||||
dfc-b:description: Basil Pesto
|
||||
dfc-b:hasType: dfc-pt:non-local-vegetable
|
||||
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:Gram
|
||||
|
||||
Reference in New Issue
Block a user