Skip to content

Commit

Permalink
Release alpha.9
Browse files Browse the repository at this point in the history
Fixed:
- Loading concepts was failing because the parser tried to create a concept without giving it its mandatory semantic id.
  • Loading branch information
lecoqlibre committed Nov 6, 2023
1 parent c50cc84 commit 330d97f
Show file tree
Hide file tree
Showing 35 changed files with 1,640 additions and 1,318 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

None.

## [1.0.0-alpha.8] - 2023-07-11
## [1.0.0-alpha.9] - 2023-11-06

This version has been generated using the [code generator](https://github.com/datafoodconsortium/connector-codegen) [version 1.0.1](https://github.com/datafoodconsortium/connector-codegen/releases/tag/v1.0.1). See its release for more info.

### Fixed

- The `dfc-b` prefix points to the business ontology, not the full model.
- Loading concepts was failing because the parser tried to create a concept without giving it its mandatory semantic id.

## [1.0.0-alpha.8] - 2023-07-11

### Fixed

- The dfc-b prefix points to the business ontology, not the full model.

## [1.0.0-alpha.7] - 2023-07-10

Expand Down Expand Up @@ -79,6 +86,7 @@ None.
- Initial version of this library.

[unreleased]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0...HEAD
[1.0.0-alpha.9]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.8...v1.0.0-alpha.9
[1.0.0-alpha.8]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.7...v1.0.0-alpha.8
[1.0.0-alpha.7]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.6...v1.0.0-alpha.7
[1.0.0-alpha.6]: https://github.com/datafoodconsortium/connector-ruby/compare/v1.0.0-alpha.5...v1.0.0-alpha.6
Expand Down
28 changes: 15 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
PATH
remote: .
specs:
datafoodconsortium-connector (1.0.0.pre.alpha.4)
virtual_assembly-semantizer (~> 1.0, >= 1.0.2)
datafoodconsortium-connector (1.0.0.pre.alpha.9)
virtual_assembly-semantizer (~> 1.0, >= 1.0.5)

GEM
remote: https://rubygems.org/
specs:
bcp47_spec (0.2.1)
htmlentities (4.3.4)
json-canonicalization (0.3.1)
json-ld (3.2.3)
json-canonicalization (0.3.2)
json-ld (3.3.0)
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.3)
link_header (0.0.8)
minitest (5.17.0)
minitest (5.20.0)
multi_json (1.15.0)
rack (2.2.6.2)
rake (13.0.6)
rdf (3.2.9)
rack (3.0.8)
rake (13.1.0)
rdf (3.3.1)
bcp47_spec (~> 0.2)
link_header (~> 0.0, >= 0.0.8)
virtual_assembly-semantizer (1.0.2)
virtual_assembly-semantizer (1.0.5)
json-ld (~> 3.2, >= 3.2.3)

PLATFORMS
Expand All @@ -35,4 +37,4 @@ DEPENDENCIES
rake

BUNDLED WITH
2.3.17
2.4.21
2 changes: 1 addition & 1 deletion connector.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "datafoodconsortium-connector"
s.version = "1.0.0-alpha.8"
s.version = "1.0.0-alpha.9"
s.summary = "Data Food Consortium connector"
s.description = "A library to easily integrate the DFC standard within your application."
s.authors = ["Maxime Lecoq"]
Expand Down
37 changes: 17 additions & 20 deletions lib/datafoodconsortium/connector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,29 @@ module Connector
require 'datafoodconsortium/connector/json_ld_serializer'
require 'datafoodconsortium/connector/skos_parser_element'
require 'datafoodconsortium/connector/skos_parser'
require 'datafoodconsortium/connector/social_media.rb'
require 'datafoodconsortium/connector/agent.rb'
require 'datafoodconsortium/connector/enterprise.rb'
require 'datafoodconsortium/connector/person.rb'
require 'datafoodconsortium/connector/phone_number.rb'
require 'datafoodconsortium/connector/customer_category.rb'
require 'datafoodconsortium/connector/offer.rb'
require 'datafoodconsortium/connector/repository.rb'
require 'datafoodconsortium/connector/price.rb'
require 'datafoodconsortium/connector/order.rb'
require 'datafoodconsortium/connector/catalog_item.rb'
require 'datafoodconsortium/connector/order_line.rb'
require 'datafoodconsortium/connector/allergen_dimension.rb'
require 'datafoodconsortium/connector/enterprise.rb'
require 'datafoodconsortium/connector/technical_product.rb'
require 'datafoodconsortium/connector/defined_product.rb'
require 'datafoodconsortium/connector/supplied_product.rb'
require 'datafoodconsortium/connector/physical_characteristic.rb'
require 'datafoodconsortium/connector/nutrient_characteristic.rb'
require 'datafoodconsortium/connector/characteristic.rb'
require 'datafoodconsortium/connector/quantity.rb'
require 'datafoodconsortium/connector/allergen_characteristic.rb'
require 'datafoodconsortium/connector/address.rb'
require 'datafoodconsortium/connector/characteristic_dimension.rb'
require 'datafoodconsortium/connector/nutrient_characteristic.rb'
require 'datafoodconsortium/connector/part_origin.rb'
require 'datafoodconsortium/connector/unit.rb'
require 'datafoodconsortium/connector/quantitative_value.rb'
require 'datafoodconsortium/connector/certification.rb'
require 'datafoodconsortium/connector/product_type.rb'
require 'datafoodconsortium/connector/physical_characteristic.rb'
require 'datafoodconsortium/connector/allergen_characteristic.rb'
require 'datafoodconsortium/connector/geographical_origin.rb'
require 'datafoodconsortium/connector/nature_origin.rb'
require 'datafoodconsortium/connector/defined_product.rb'
require 'datafoodconsortium/connector/supplied_product.rb'
require 'datafoodconsortium/connector/catalog.rb'
require 'datafoodconsortium/connector/order.rb'
require 'datafoodconsortium/connector/order_line.rb'
require 'datafoodconsortium/connector/offer.rb'
require 'datafoodconsortium/connector/catalog_item.rb'
require 'datafoodconsortium/connector/price.rb'
require 'datafoodconsortium/connector/sale_session.rb'
require 'datafoodconsortium/connector/skos_concept.rb'
end
end
10 changes: 5 additions & 5 deletions lib/datafoodconsortium/connector/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def initialize(semanticId, street: "", postalCode: "", city: "", country: "")
@postalCode = postalCode
@city = city
@country = country
self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#Address"
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#hasStreet") { self.street }
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#hasPostalCode") { self.postalCode }
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#hasCity") { self.city }
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#hasCountry") { self.country }
self.semanticType = "dfc-b:Address"
registerSemanticProperty("dfc-b:hasStreet") { self.street }
registerSemanticProperty("dfc-b:hasPostalCode") { self.postalCode }
registerSemanticProperty("dfc-b:hasCity") { self.city }
registerSemanticProperty("dfc-b:hasCountry") { self.country }
end


Expand Down
60 changes: 29 additions & 31 deletions lib/datafoodconsortium/connector/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,48 @@




require "virtual_assembly/semantizer"

class DataFoodConsortium::Connector::Agent

include VirtualAssembly::Semantizer::SemanticObject

# @return [Contactable]
attr_accessor :contacts

# @return [Localizable]
# @return [IAddress]
attr_accessor :localizations

# @return [IPhoneNumber]
attr_accessor :phoneNumbers

# @return [String]
attr_accessor :emails

# @return [String]
attr_accessor :websites

# @return [ISocialMedia]
attr_accessor :socialMedias

# @param semanticId [String]
# @param contacts [Contactable]
# @param localizations [Localizable]
def initialize(semanticId, contacts: [], localizations: [])
# @param localizations [IAddress]
# @param phoneNumbers [IPhoneNumber]
# @param emails [String]
# @param websites [String]
# @param socialMedias [ISocialMedia]
def initialize(semanticId, localizations: [], phoneNumbers: [], emails: [], websites: [], socialMedias: [])
super(semanticId)
@contacts = contacts
@localizations = localizations
self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#Agent"
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#hasAddress") { self.localizations }
@phoneNumbers = phoneNumbers
@emails = emails
@websites = websites
@socialMedias = socialMedias
self.semanticType = "dfc-b:Agent"
registerSemanticProperty("dfc-b:hasAddress") { self.localizations }
registerSemanticProperty("dfc-b:hasPhoneNumber") { self.phoneNumbers }
registerSemanticProperty("dfc-b:email") { self.emails }
registerSemanticProperty("dfc-b:websitePage") { self.websites }
registerSemanticProperty("dfc-b:hasSocialMedia") { self.socialMedias }
end



def addContact(contact)
self.contacts.push(contact)
end


def addLocalization(localization)
self.localizations.push(localization)
end


def removeContact(contact)
raise "Not yet implemented."
end


def removeLocalization(localization)
raise "Not yet implemented."
end


end
11 changes: 5 additions & 6 deletions lib/datafoodconsortium/connector/allergen_characteristic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@

require "datafoodconsortium/connector/characteristic"


require "virtual_assembly/semantizer"

class DataFoodConsortium::Connector::AllergenCharacteristic < DataFoodConsortium::Connector::Characteristic



# @return [IAllergenDimension]
# @return [ISKOSConcept]
attr_accessor :allergenDimension

# @param allergenDimension [IAllergenDimension]
# @param unit [IUnit]
# @param allergenDimension [ISKOSConcept]
# @param unit [ISKOSConcept]
# @param value [Real]
def initialize(allergenDimension: nil, unit: nil, value: 0.0)
super(unit: unit, value: value)
@allergenDimension = allergenDimension
self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#AllergenCharacteristic"
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#hasAllergenDimension") { self.allergenDimension }
self.semanticType = "dfc-b:AllergenCharacteristic"
registerSemanticProperty("dfc-b:hasAllergenDimension") { self.allergenDimension }
end


Expand Down
53 changes: 53 additions & 0 deletions lib/datafoodconsortium/connector/catalog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# MIT License
#
# Copyright (c) 2023 Maxime Lecoq <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.





require "virtual_assembly/semantizer"

class DataFoodConsortium::Connector::Catalog

include VirtualAssembly::Semantizer::SemanticObject

# @return [ICatalogItem]
attr_accessor :items

# @return [IEnterprise]
attr_accessor :maintainers

# @param semanticId [String]
# @param items [ICatalogItem]
# @param maintainers [IEnterprise]
def initialize(semanticId, items: [], maintainers: [])
super(semanticId)
@items = items
@maintainers = maintainers
self.semanticType = "dfc-b:Catalog"
registerSemanticProperty("dfc-b:lists") { self.items }
registerSemanticProperty("dfc-b:maintainedBy") { self.maintainers }
end



end
23 changes: 13 additions & 10 deletions lib/datafoodconsortium/connector/catalog_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@




require "virtual_assembly/semantizer"

class DataFoodConsortium::Connector::CatalogItem
Expand All @@ -41,28 +42,30 @@ class DataFoodConsortium::Connector::CatalogItem
# @return [IOffer]
attr_accessor :offers

# @return [ICatalog]
attr_accessor :catalogs

# @param semanticId [String]
# @param product [IDefinedProduct]
# @param sku [String]
# @param stockLimitation [Real]
# @param offers [IOffer]
def initialize(semanticId, product: nil, sku: "", stockLimitation: 0.0, offers: [])
# @param catalogs [ICatalog]
def initialize(semanticId, product: nil, sku: "", stockLimitation: 0.0, offers: [], catalogs: [])
super(semanticId)
@product = product
@sku = sku
@stockLimitation = stockLimitation
@offers = offers
self.semanticType = "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#CatalogItem"
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#references") { self.product }
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#sku") { self.sku }
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#stockLimitation") { self.stockLimitation }
registerSemanticProperty("https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#offeredThrough") { self.offers }
@catalogs = catalogs
self.semanticType = "dfc-b:CatalogItem"
registerSemanticProperty("dfc-b:references") { self.product }
registerSemanticProperty("dfc-b:sku") { self.sku }
registerSemanticProperty("dfc-b:stockLimitation") { self.stockLimitation }
registerSemanticProperty("dfc-b:offeredThrough") { self.offers }
registerSemanticProperty("dfc-b:listedIn") { self.catalogs }
end







end
3 changes: 1 addition & 2 deletions lib/datafoodconsortium/connector/characteristic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# SOFTWARE.



require "datafoodconsortium/connector/quantitative_value"

require "virtual_assembly/semantizer"
Expand All @@ -31,7 +30,7 @@ class DataFoodConsortium::Connector::Characteristic < DataFoodConsortium::Connec



# @param unit [IUnit]
# @param unit [ISKOSConcept]
# @param value [Real]
def initialize(unit: nil, value: 0.0)
super(unit: unit, value: value)
Expand Down
4 changes: 2 additions & 2 deletions lib/datafoodconsortium/connector/connector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def initialize()
# See https://github.com/datafoodconsortium/connector-ruby/issues/11.
inputContext = {
"dfc-b" => "https://github.com/datafoodconsortium/ontology/releases/latest/download/DFC_BusinessOntology.owl#",
#"dfc-p" => "http://static.datafoodconsortium.org/ontologies/DFC_ProductOntology.owl#",
#"dfc-t" => "http://static.datafoodconsortium.org/ontologies/DFC_TechnicalOntology.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#"
Expand Down
Loading

0 comments on commit 330d97f

Please sign in to comment.