mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #12101 from openfoodfoundation/dependabot/bundler/datafoodconsortium-connector-1.0.0.pre.alpha.10
chore(deps): bump datafoodconsortium-connector from 1.0.0.pre.alpha.9 to 1.0.0.pre.alpha.10
This commit is contained in:
@@ -235,7 +235,7 @@ GEM
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
datafoodconsortium-connector (1.0.0.pre.alpha.9)
|
||||
datafoodconsortium-connector (1.0.0.pre.alpha.10)
|
||||
virtual_assembly-semantizer (~> 1.0, >= 1.0.5)
|
||||
date (3.3.4)
|
||||
debug (1.9.1)
|
||||
@@ -359,7 +359,7 @@ GEM
|
||||
jquery-ui-rails (4.2.1)
|
||||
railties (>= 3.2.16)
|
||||
json (2.7.1)
|
||||
json-canonicalization (0.4.0)
|
||||
json-canonicalization (1.0.0)
|
||||
json-jwt (1.16.5)
|
||||
activesupport (>= 4.2)
|
||||
aes_key_wrap
|
||||
@@ -367,9 +367,9 @@ GEM
|
||||
bindata
|
||||
faraday (~> 2.0)
|
||||
faraday-follow_redirects
|
||||
json-ld (3.3.0)
|
||||
json-ld (3.3.1)
|
||||
htmlentities (~> 4.3)
|
||||
json-canonicalization (~> 0.3, >= 0.3.2)
|
||||
json-canonicalization (~> 1.0)
|
||||
link_header (~> 0.0, >= 0.0.8)
|
||||
multi_json (~> 1.15)
|
||||
rack (>= 2.2, < 4)
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Load the original library first:
|
||||
require "datafoodconsortium/connector"
|
||||
|
||||
# Then our tools for monky-patching:
|
||||
require_relative "importer"
|
||||
require_relative "context"
|
||||
require_relative "skos_parser_element"
|
||||
require_relative "skos_concept"
|
||||
require_relative "skos_parser"
|
||||
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class Connector
|
||||
def import(json_string_or_io)
|
||||
Importer.new.import(json_string_or_io)
|
||||
end
|
||||
|
||||
# Monkey patch private method until fixed upstream:
|
||||
# https://github.com/datafoodconsortium/connector-ruby/issues/19
|
||||
def loadThesaurus(data) # rubocop:disable Naming/MethodName
|
||||
# The root element may be an array or the ontology.
|
||||
data = data[0] if data.is_a?(Array)
|
||||
@parser.parse(data["@graph"])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,56 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Preload the DFC context.
|
||||
#
|
||||
# Similar to: https://github.com/ruby-rdf/json-ld-preloaded/
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class Context < JSON::LD::Context
|
||||
VERSION_1_8 = 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
|
||||
|
||||
add_preloaded("http://www.datafoodconsortium.org/") { parse(VERSION_1_8) }
|
||||
alias_preloaded(
|
||||
"http://static.datafoodconsortium.org/ontologies/context.json",
|
||||
"http://www.datafoodconsortium.org/"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,161 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative "skos_parser"
|
||||
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class Importer # rubocop:disable Metrics/ClassLength
|
||||
TYPES = [
|
||||
DataFoodConsortium::Connector::CatalogItem,
|
||||
DataFoodConsortium::Connector::Enterprise,
|
||||
DataFoodConsortium::Connector::Offer,
|
||||
DataFoodConsortium::Connector::Person,
|
||||
DataFoodConsortium::Connector::QuantitativeValue,
|
||||
DataFoodConsortium::Connector::SuppliedProduct,
|
||||
].freeze
|
||||
|
||||
def self.type_map
|
||||
unless @type_map
|
||||
@type_map = {}
|
||||
TYPES.each(&method(:register_type))
|
||||
end
|
||||
|
||||
@type_map
|
||||
end
|
||||
|
||||
def self.register_type(clazz)
|
||||
# Methods with variable arguments have a negative arity of -n-1
|
||||
# where n is the number of required arguments.
|
||||
number_of_required_args = -1 * (clazz.instance_method(:initialize).arity + 1)
|
||||
args = Array.new(number_of_required_args)
|
||||
type_uri = clazz.new(*args).semanticType
|
||||
type_map[type_uri] = clazz
|
||||
end
|
||||
|
||||
def self.prefixed_name(uri)
|
||||
# When we skip backwards compatibility, we can just do this:
|
||||
#
|
||||
# key = RDF::URI.new(uri).pname(prefixes: Context::VERSION_1_8)
|
||||
#
|
||||
# But for now we do it manually.
|
||||
uri.gsub(
|
||||
"https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
|
||||
"dfc-b:"
|
||||
).gsub(
|
||||
# legacy URI
|
||||
"http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl#",
|
||||
"dfc-b:"
|
||||
)
|
||||
end
|
||||
|
||||
def import(json_string_or_io)
|
||||
@subjects = {}
|
||||
|
||||
graph = parse_rdf(json_string_or_io)
|
||||
build_subjects(graph)
|
||||
apply_statements(graph)
|
||||
|
||||
if @subjects.size > 1
|
||||
@subjects.values
|
||||
else
|
||||
@subjects.values.first
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# The `io` parameter can be a String or an IO instance.
|
||||
def parse_rdf(io)
|
||||
io = StringIO.new(io) if io.is_a?(String)
|
||||
RDF::Graph.new << JSON::LD::API.toRdf(io)
|
||||
end
|
||||
|
||||
def build_subjects(graph)
|
||||
graph.query({ predicate: RDF.type }).each do |statement|
|
||||
@subjects[statement.subject] = build_subject(statement)
|
||||
end
|
||||
end
|
||||
|
||||
def build_subject(type_statement)
|
||||
# Not all subjects have an id, some are anonymous.
|
||||
id = type_statement.subject.try(:value)
|
||||
type = type_statement.object.value
|
||||
key = self.class.prefixed_name(type)
|
||||
clazz = self.class.type_map[key]
|
||||
|
||||
clazz.new(*[id].compact)
|
||||
end
|
||||
|
||||
def apply_statements(statements)
|
||||
statements.each do |statement|
|
||||
apply_statement(statement)
|
||||
end
|
||||
end
|
||||
|
||||
def apply_statement(statement)
|
||||
subject = subject_of(statement)
|
||||
property_uri = statement.predicate.value
|
||||
value = resolve_object(statement.object)
|
||||
|
||||
property_id = self.class.prefixed_name(property_uri)
|
||||
|
||||
return unless subject.hasSemanticProperty?(property_id)
|
||||
|
||||
property = subject.semanticProperty(property_id)
|
||||
|
||||
if property.value.is_a?(Enumerable)
|
||||
property.value << value
|
||||
else
|
||||
setter = guess_setter_name(statement)
|
||||
subject.try(setter, value) if setter
|
||||
end
|
||||
end
|
||||
|
||||
def subject_of(statement)
|
||||
@subjects[statement.subject]
|
||||
end
|
||||
|
||||
def resolve_object(object)
|
||||
@subjects[object] || skos_concept(object) || object.object
|
||||
end
|
||||
|
||||
def skos_concept(object)
|
||||
return unless object.uri?
|
||||
|
||||
id = object.value.sub(
|
||||
"http://static.datafoodconsortium.org/data/measures.rdf#", "dfc-m:"
|
||||
).sub(
|
||||
"https://github.com/datafoodconsortium/taxonomies/releases/latest/download/measures.rdf#",
|
||||
"dfc-m:"
|
||||
)
|
||||
|
||||
SKOSParser.concepts[id]
|
||||
end
|
||||
|
||||
def guess_setter_name(statement)
|
||||
predicate = statement.predicate
|
||||
|
||||
# Ideally the product models would be consitent with the rule below and use "type"
|
||||
# instead of "productType" but alast they are not so we need this exception
|
||||
return "productType=" if predicate.fragment == "hasType" && product_type?(statement)
|
||||
|
||||
name =
|
||||
# Some predicates are named like `hasQuantity`
|
||||
# but the attribute name would be `quantity`.
|
||||
predicate.fragment&.sub(/^has/, "")&.camelize(:lower) ||
|
||||
# And sometimes the URI looks like `ofn:spree_product_id`.
|
||||
predicate.to_s.split(":").last
|
||||
|
||||
"#{name}="
|
||||
end
|
||||
|
||||
def product_type?(statement)
|
||||
return true if statement.object.literal? && statement.object.value.match("dfc-pt")
|
||||
|
||||
return true if statement.object.path.match("productTypes")
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Patch: Improve parsing of SKOS Concept. Will be fixed upstream
|
||||
require_relative 'skos_helper'
|
||||
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class SKOSConcept
|
||||
include DataFoodConsortium::Connector::SKOSHelper
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Patch: Improve parsing of SKOS Concept. Will be fixed upstream
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
module SKOSHelper
|
||||
def addAttribute(name, value) # rubocop:disable Naming/MethodName
|
||||
instance_variable_set("@#{name}", value)
|
||||
define_singleton_method(name) do
|
||||
instance_variable_get("@#{name}")
|
||||
end
|
||||
end
|
||||
|
||||
def hasAttribute(name) # rubocop:disable Naming/MethodName
|
||||
methods.include?(:"#{name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,144 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# patches :
|
||||
# - Maikel: Overriding the current implementation to store all parsed concepts for
|
||||
# lookup later. Otherwise the importer can't associate these.
|
||||
# This is just a workaround and needs to be solved upstream.
|
||||
|
||||
# - Gaetan: Improve parsing of SKOS Concept. Will be fixed upstream
|
||||
|
||||
require_relative 'skos_helper'
|
||||
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class SKOSInstance
|
||||
include DataFoodConsortium::Connector::SKOSHelper
|
||||
|
||||
# Return a list of singelton methods, ie the list of Concept available
|
||||
def topConcepts # rubocop:disable Naming/MethodName
|
||||
methods(false).sort
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Naming/VariableName
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class SKOSParser
|
||||
CONCEPT_SCHEMES = ["Facet", "productTypes"].freeze
|
||||
|
||||
def initialize
|
||||
@results = DataFoodConsortium::Connector::SKOSInstance.new
|
||||
@skosConcepts = {}
|
||||
@rootElements = []
|
||||
@broaders = {}
|
||||
# Flag used to tell the parser to use SkosConcept object when parsing data from
|
||||
# Concept Scheme.
|
||||
# defined in CONCEPT_SCHEMES
|
||||
@useSkosConcept = false
|
||||
end
|
||||
|
||||
def parse(data) # rubocop:disable Metrics/CyclomaticComplexity
|
||||
init
|
||||
|
||||
data.each do |element|
|
||||
current = DataFoodConsortium::Connector::SKOSParserElement.new(element)
|
||||
|
||||
setSkosConceptFlag(current)
|
||||
|
||||
next unless current.isConcept? || current.isCollection?
|
||||
|
||||
if !@skosConcepts.key?(current.id)
|
||||
concept = createSKOSConcept(current)
|
||||
@skosConcepts[current.id] = concept
|
||||
end
|
||||
|
||||
if current.hasBroader
|
||||
current.broader.each do |broader_id|
|
||||
if !@broaders.key?(broader_id)
|
||||
@broaders[broader_id] = []
|
||||
end
|
||||
|
||||
@broaders[broader_id].push(current.id)
|
||||
end
|
||||
# No broader, save the concept to the root
|
||||
else
|
||||
@rootElements.push(current.id)
|
||||
end
|
||||
end
|
||||
|
||||
@rootElements.each do |root_element_id|
|
||||
setResults(@results, root_element_id)
|
||||
end
|
||||
|
||||
@results
|
||||
end
|
||||
|
||||
# Maikel's patch
|
||||
def self.concepts
|
||||
@concepts ||= {}
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def createSKOSConcept(element) # rubocop:disable Naming/MethodName
|
||||
skosConcept = DataFoodConsortium::Connector::SKOSConcept.new(
|
||||
element.id,
|
||||
broaders: element.broader,
|
||||
narrowers: element.narrower,
|
||||
prefLabels: element.label
|
||||
)
|
||||
skosConcept.semanticType = element.type
|
||||
# Maikel's patch
|
||||
self.class.concepts[element.id] = skosConcept
|
||||
skosConcept
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def init
|
||||
@results = DataFoodConsortium::Connector::SKOSInstance.new
|
||||
@skosConcepts = {}
|
||||
@rootElements = []
|
||||
@broaders = {}
|
||||
@useSkosConcept = false
|
||||
end
|
||||
|
||||
def setResults(parent, id) # rubocop:disable Naming/MethodName
|
||||
name = getValueWithoutPrefix(id)
|
||||
|
||||
if !parent.hasAttribute(name)
|
||||
if @useSkosConcept && @skosConcepts[id]
|
||||
parent.addAttribute(name, @skosConcepts[id])
|
||||
else
|
||||
parent.addAttribute(name, DataFoodConsortium::Connector::SKOSInstance.new)
|
||||
end
|
||||
end
|
||||
|
||||
# Leaf concepts, stop the process
|
||||
if !@broaders.key?(id)
|
||||
parent.instance_variable_set("@#{name}", @skosConcepts[id])
|
||||
return
|
||||
end
|
||||
|
||||
@broaders[id].each do |narrower|
|
||||
parentSkosInstance = parent.instance_variable_get("@#{name}")
|
||||
|
||||
setResults(parentSkosInstance, narrower) # recursive call
|
||||
end
|
||||
end
|
||||
|
||||
def setSkosConceptFlag(current) # rubocop:disable Naming/MethodName
|
||||
@useSkosConcept = true if current.isConceptScheme? && matchingConceptSchemes(current)
|
||||
end
|
||||
|
||||
def matchingConceptSchemes(current) # rubocop:disable Naming/MethodName
|
||||
regex = /#{CONCEPT_SCHEMES.join('|')}/
|
||||
|
||||
current.id =~ regex
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Naming/VariableName
|
||||
@@ -1,47 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Patch: Improve parsing of SKOS Concept. Will be fixed upstream
|
||||
module DataFoodConsortium
|
||||
module Connector
|
||||
class SKOSParserElement
|
||||
attr_reader :narrower, :label
|
||||
|
||||
def initialize(element) # rubocop:disable Metrics/CyclomaticComplexity
|
||||
@broader = []
|
||||
@narrower = []
|
||||
@label = {}
|
||||
|
||||
if element
|
||||
@id = element["@id"]
|
||||
|
||||
@type = if element["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
||||
extractId(element["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"])
|
||||
elsif element["@type"]
|
||||
extractId(element["@type"])
|
||||
else
|
||||
"undefined"
|
||||
end
|
||||
|
||||
element["http://www.w3.org/2004/02/skos/core#broader"]&.each do |broader|
|
||||
@broader.push(broader["@id"])
|
||||
end
|
||||
|
||||
element["http://www.w3.org/2004/02/skos/core#narrower"]&.each do |narrower|
|
||||
@narrower.push(narrower["@id"])
|
||||
end
|
||||
|
||||
element["http://www.w3.org/2004/02/skos/core#prefLabel"]&.each do |label|
|
||||
@label[label["@language"].to_sym] = label["@value"]
|
||||
end
|
||||
else
|
||||
@id = ""
|
||||
@type = ""
|
||||
end
|
||||
end
|
||||
|
||||
def isConceptScheme? # rubocop:disable Naming/MethodName
|
||||
@type == "http://www.w3.org/2004/02/skos/core#ConceptScheme"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Load our monkey-patches of the DFC Connector:
|
||||
require "data_food_consortium/connector/connector"
|
||||
# Load the DFC Connector:
|
||||
require "datafoodconsortium/connector"
|
||||
|
||||
# Our Rails engine
|
||||
require "dfc_provider/engine"
|
||||
|
||||
@@ -10,13 +10,14 @@ module DfcProvider
|
||||
self.spree_product_id = spree_product_id
|
||||
self.image = image_url
|
||||
|
||||
registerSemanticProperty("ofn:spree_product_id") do
|
||||
self.spree_product_id
|
||||
end
|
||||
register_ofn_property("spree_product_id")
|
||||
# Temporary solution, will be replaced by "dfc_b:image" in future version of the DFC connector
|
||||
registerSemanticProperty("ofn:image") do
|
||||
image
|
||||
end
|
||||
register_ofn_property("image")
|
||||
end
|
||||
|
||||
def register_ofn_property(name)
|
||||
registerSemanticProperty("ofn:#{name}", &method(name))
|
||||
.valueSetter = method("#{name}=")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative "../../../spec_helper"
|
||||
require "data_food_consortium/connector/connector"
|
||||
|
||||
describe DataFoodConsortium::Connector::Connector, vcr: true do
|
||||
subject(:connector) { described_class.instance }
|
||||
let(:product) do
|
||||
DataFoodConsortium::Connector::SuppliedProduct.new(
|
||||
"https://example.net/tomato",
|
||||
name: "Tomato",
|
||||
description: "Awesome tomato"
|
||||
)
|
||||
end
|
||||
|
||||
it "exports" do
|
||||
json = connector.export(product)
|
||||
expect(json).to match '"dfc-b:name":"Tomato"'
|
||||
end
|
||||
|
||||
it "imports" do
|
||||
json = connector.export(product)
|
||||
result = connector.import(json)
|
||||
expect(result).to be_a product.class
|
||||
expect(result.semanticType).to eq product.semanticType
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
end
|
||||
|
||||
it "imports from IO like Rails supplies it" do
|
||||
json = connector.export(product)
|
||||
io = StringIO.new(json)
|
||||
result = connector.import(io)
|
||||
|
||||
expect(result).to be_a product.class
|
||||
expect(result.semanticType).to eq product.semanticType
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
end
|
||||
end
|
||||
@@ -1,175 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative "../../../spec_helper"
|
||||
require "data_food_consortium/connector/connector"
|
||||
|
||||
describe DataFoodConsortium::Connector::Importer do
|
||||
let(:connector) { DataFoodConsortium::Connector::Connector.instance }
|
||||
let(:enterprise) do
|
||||
DataFoodConsortium::Connector::Enterprise.new(
|
||||
"https://example.net/foo-food-inc",
|
||||
suppliedProducts: [product, second_product],
|
||||
)
|
||||
end
|
||||
let(:catalog_item) do
|
||||
DataFoodConsortium::Connector::CatalogItem.new(
|
||||
"https://example.net/tomatoItem",
|
||||
product:,
|
||||
)
|
||||
end
|
||||
let(:product) do
|
||||
DataFoodConsortium::Connector::SuppliedProduct.new(
|
||||
"https://example.net/tomato",
|
||||
name: "Tomato",
|
||||
description: "Awesome tomato",
|
||||
totalTheoreticalStock: 3,
|
||||
productType: non_local_vegetable,
|
||||
)
|
||||
end
|
||||
let(:product_data) do
|
||||
<<~JSON
|
||||
{
|
||||
"@context":"http://static.datafoodconsortium.org/ontologies/context.json",
|
||||
"@id":"https://example.net/tomato",
|
||||
"@type":"dfc-b:SuppliedProduct",
|
||||
"dfc-b:name":"Tomato",
|
||||
"dfc-b:description":"Awesome tomato",
|
||||
"dfc-b:alcoholPercentage":0.0,
|
||||
"dfc-b:lifetime":"",
|
||||
"dfc-b:usageOrStorageCondition":"",
|
||||
"dfc-b:totalTheoreticalStock":3,
|
||||
"dfc-b:hasType": "dfc-pt:non-local-vegetable"
|
||||
}
|
||||
JSON
|
||||
end
|
||||
let(:product_data_with_context_v1_8) 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:hasType":{"@type":"@id"}
|
||||
},
|
||||
"@id":"https://example.net/tomato",
|
||||
"@type":"dfc-b:SuppliedProduct",
|
||||
"dfc-b:name":"Tomato",
|
||||
"dfc-b:description":"Awesome tomato",
|
||||
"dfc-b:alcoholPercentage":0.0,
|
||||
"dfc-b:lifetime":"",
|
||||
"dfc-b:usageOrStorageCondition":"",
|
||||
"dfc-b:totalTheoreticalStock":3,
|
||||
"dfc-b:hasType": "dfc-pt:non-local-vegetable"
|
||||
}
|
||||
JSON
|
||||
end
|
||||
let(:second_product) do
|
||||
DataFoodConsortium::Connector::SuppliedProduct.new(
|
||||
"https://example.net/ocra",
|
||||
name: "Ocra",
|
||||
)
|
||||
end
|
||||
let(:quantity) do
|
||||
DataFoodConsortium::Connector::QuantitativeValue.new(
|
||||
unit: piece,
|
||||
value: 5,
|
||||
)
|
||||
end
|
||||
let(:piece) do
|
||||
unless connector.MEASURES.respond_to?(:UNIT)
|
||||
connector.loadMeasures(read_file("measures"))
|
||||
end
|
||||
connector.MEASURES.PIECE
|
||||
end
|
||||
let(:non_local_vegetable) do
|
||||
connector.PRODUCT_TYPES.VEGETABLE.NON_LOCAL_VEGETABLE
|
||||
end
|
||||
|
||||
before { connector.loadProductTypes(read_file("productTypes")) }
|
||||
|
||||
it "imports a single object with simple properties" do
|
||||
result = import(product)
|
||||
|
||||
expect(result).to be_a product.class
|
||||
expect(result.semanticType).to eq product.semanticType
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
expect(result.description).to eq "Awesome tomato"
|
||||
expect(result.productType).to eq non_local_vegetable
|
||||
expect(result.totalTheoreticalStock).to eq 3
|
||||
end
|
||||
|
||||
it "imports an object with referenced context" do
|
||||
result = connector.import(product_data)
|
||||
|
||||
expect(result).to be_a DataFoodConsortium::Connector::SuppliedProduct
|
||||
expect(result.semanticType).to eq "dfc-b:SuppliedProduct"
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
expect(result.description).to eq "Awesome tomato"
|
||||
expect(result.productType).to eq non_local_vegetable
|
||||
expect(result.totalTheoreticalStock).to eq 3
|
||||
end
|
||||
|
||||
it "imports an object with DFC v1.8 context" do
|
||||
result = connector.import(product_data_with_context_v1_8)
|
||||
|
||||
expect(result).to be_a DataFoodConsortium::Connector::SuppliedProduct
|
||||
expect(result.semanticType).to eq "dfc-b:SuppliedProduct"
|
||||
expect(result.semanticId).to eq "https://example.net/tomato"
|
||||
expect(result.name).to eq "Tomato"
|
||||
expect(result.description).to eq "Awesome tomato"
|
||||
expect(result.productType).to eq non_local_vegetable
|
||||
expect(result.totalTheoreticalStock).to eq 3
|
||||
end
|
||||
|
||||
it "imports a graph with multiple objects" do
|
||||
result = import(catalog_item, product)
|
||||
|
||||
expect(result).to be_a Array
|
||||
expect(result.size).to eq 2
|
||||
|
||||
item, tomato = result
|
||||
|
||||
expect(item).to be_a catalog_item.class
|
||||
expect(item.semanticType).to eq catalog_item.semanticType
|
||||
expect(item.semanticId).to eq "https://example.net/tomatoItem"
|
||||
expect(tomato.name).to eq "Tomato"
|
||||
expect(tomato.description).to eq "Awesome tomato"
|
||||
expect(tomato.productType).to eq non_local_vegetable
|
||||
expect(tomato.totalTheoreticalStock).to eq 3
|
||||
end
|
||||
|
||||
it "imports a graph including anonymous objects" do
|
||||
product.quantity = quantity
|
||||
|
||||
tomato, items = import(product)
|
||||
|
||||
expect(tomato.name).to eq "Tomato"
|
||||
expect(tomato.quantity).to eq items
|
||||
expect(tomato.productType).to eq non_local_vegetable
|
||||
expect(items.value).to eq 5
|
||||
expect(items.unit).to eq piece
|
||||
end
|
||||
|
||||
it "imports properties with lists" do
|
||||
result = import(enterprise, product, second_product)
|
||||
|
||||
expect(result.size).to eq 3
|
||||
|
||||
enterprise, tomato, ocra = result
|
||||
|
||||
expect(enterprise.suppliedProducts).to eq [tomato, ocra]
|
||||
end
|
||||
|
||||
def import(*args)
|
||||
json = connector.export(*args)
|
||||
connector.import(json)
|
||||
end
|
||||
|
||||
def read_file(name)
|
||||
JSON.parse(
|
||||
Rails.root.join("engines/dfc_provider/vendor/#{name}.json").read
|
||||
)
|
||||
end
|
||||
end
|
||||
212
engines/dfc_provider/vendor/facets.json
vendored
212
engines/dfc_provider/vendor/facets.json
vendored
@@ -104,7 +104,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PartOrigin"
|
||||
} ],
|
||||
@@ -127,10 +127,10 @@
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Pig"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Quail"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Roster"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Sheep"
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Rooster"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
@@ -218,7 +218,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bee",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -245,7 +245,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#BeeHoney",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bee"
|
||||
} ],
|
||||
@@ -261,7 +261,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#BeePollen",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bee"
|
||||
} ],
|
||||
@@ -277,7 +277,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#BeePropolis",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bee"
|
||||
} ],
|
||||
@@ -293,7 +293,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#BeeVenom",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bee"
|
||||
} ],
|
||||
@@ -309,7 +309,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#BeeWax",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bee"
|
||||
} ],
|
||||
@@ -424,7 +424,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bulb",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -440,7 +440,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bull",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -459,7 +459,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#BullBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Bull"
|
||||
} ],
|
||||
@@ -530,6 +530,22 @@
|
||||
"http://www.w3.org/2004/02/skos/core#topConceptOf" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#ChickenBody",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#c_99fce7e0"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "fr",
|
||||
"@value" : "Partie du poulet"
|
||||
}, {
|
||||
"@language" : "en",
|
||||
"@value" : "Chicken's body"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Claim",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
@@ -555,6 +571,19 @@
|
||||
"http://www.w3.org/2004/02/skos/core#topConceptOf" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#ContainerInformation",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Container Information"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#topConceptOf" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#ContainsNutrientOrSubstance",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
@@ -599,7 +628,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Cow",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -620,7 +649,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#CowBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Cow"
|
||||
} ],
|
||||
@@ -636,7 +665,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#CowMilk",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Cow"
|
||||
} ],
|
||||
@@ -830,7 +859,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Ewe",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -851,7 +880,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#EweBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Ewe"
|
||||
} ],
|
||||
@@ -867,7 +896,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#EweMilk",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Ewe"
|
||||
} ],
|
||||
@@ -958,7 +987,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Flower",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -1027,7 +1056,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Fruit",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -1094,7 +1123,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Goat",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -1115,7 +1144,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#GoatBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Goat"
|
||||
} ],
|
||||
@@ -1131,7 +1160,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#GoatMilk",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Goat"
|
||||
} ],
|
||||
@@ -1231,7 +1260,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Hen",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -1252,7 +1281,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#HenBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Hen"
|
||||
} ],
|
||||
@@ -1268,7 +1297,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#HenEgg",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Hen"
|
||||
} ],
|
||||
@@ -1565,7 +1594,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Leaf",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -1880,7 +1909,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#MultiOrigin",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PartOrigin"
|
||||
} ],
|
||||
@@ -2409,9 +2438,22 @@
|
||||
"@language" : "fr",
|
||||
"@value" : "Statut géographique protégé"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Package",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#ContainerInformation"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Package"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PartOrigin",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://purl.org/dc/elements/1.1/description" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Part of natural \"living\" origin concerned"
|
||||
@@ -2490,7 +2532,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Pig",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -2509,7 +2551,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PigBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Pig"
|
||||
} ],
|
||||
@@ -2541,7 +2583,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PartOrigin"
|
||||
} ],
|
||||
@@ -2640,7 +2682,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Quail",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -2659,7 +2701,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#QuailEgg",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Quail"
|
||||
} ],
|
||||
@@ -2738,9 +2780,44 @@
|
||||
"@language" : "fr",
|
||||
"@value" : "Réduit en nutriment"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Rooster",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#narrower" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#RoosterBody"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "fr",
|
||||
"@value" : "Coq"
|
||||
}, {
|
||||
"@language" : "en",
|
||||
"@value" : "Rooster"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#RoosterBody",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Rooster"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "fr",
|
||||
"@value" : "Partie de coq"
|
||||
}, {
|
||||
"@language" : "en",
|
||||
"@value" : "Rooster's body"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Root",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -2754,41 +2831,6 @@
|
||||
"@language" : "en",
|
||||
"@value" : "Root"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Roster",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#narrower" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#RosterBody"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "fr",
|
||||
"@value" : "Coq"
|
||||
}, {
|
||||
"@language" : "en",
|
||||
"@value" : "Rooster"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#RosterBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Roster"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "fr",
|
||||
"@value" : "Partie de coq"
|
||||
}, {
|
||||
"@language" : "en",
|
||||
"@value" : "Rooster's body"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#SaturatedFatFree",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
@@ -2833,7 +2875,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Seed",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -2849,7 +2891,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Sheep",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
@@ -2868,7 +2910,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#SheepBody",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Sheep"
|
||||
} ],
|
||||
@@ -3037,7 +3079,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Stem",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -3151,7 +3193,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#Tuber",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -3250,7 +3292,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#UnknownPartOrigin",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PartOrigin"
|
||||
} ],
|
||||
@@ -3356,7 +3398,7 @@
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#WholePlant",
|
||||
"@type" : [ "skos:Concept" ],
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#PlantPartOrigin"
|
||||
} ],
|
||||
@@ -3370,6 +3412,22 @@
|
||||
"@language" : "en",
|
||||
"@value" : "Whole plant"
|
||||
} ]
|
||||
}, {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#c_99fce7e0",
|
||||
"@type" : [ "http://www.w3.org/2004/02/skos/core#Concept" ],
|
||||
"http://www.w3.org/2004/02/skos/core#broader" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#AnimalPartOrigin"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#inScheme" : [ {
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf#DFC_ProductGlossary_Facet"
|
||||
} ],
|
||||
"http://www.w3.org/2004/02/skos/core#prefLabel" : [ {
|
||||
"@language" : "en",
|
||||
"@value" : "Chicken"
|
||||
}, {
|
||||
"@language" : "fr",
|
||||
"@value" : "Poulet"
|
||||
} ]
|
||||
} ],
|
||||
"@id" : "https://github.com/datafoodconsortium/taxonomies/releases/latest/download/facets.rdf"
|
||||
} ]
|
||||
Reference in New Issue
Block a user