Skip to content

1/3 Connector behavior + generator fixes (official-format compat) - #12

Open
RaggedStaff wants to merge 7 commits into
mainfrom
pr/1-connector-generator-fixes
Open

RaggedStaff wants to merge 7 commits into
mainfrom
pr/1-connector-generator-fixes

Conversation

@RaggedStaff

Copy link
Copy Markdown
Contributor

Stacked PR 1 of 3 — merges after review; base for the other two.

Scope

Connector behavior + generator fixes, making our connectors import/export data compatible with the official DFC connectors (Ruby + TypeScript). This is the code-plane half of the data-plane parity work.

Commits:

  • 7003927 cross-connector compatibility — import/export round-trips, predicate mapping, reference resolution
  • 62a8707 Ruby gem generator — require paths, namespace prefixes, type registration, constructor param forwarding
  • 5822f4c emit official compacted JSON-LD predicates (dfc-b:VATnumber) in TS and Ruby connectors
  • b0b49a3 Ruby connector exports compacted JSON string, aligns with official gem
  • 8ac1131 generators preserve bundled context/taxonomy files and stay in sync with committed code

Review notes

Most of the diff is regenerated model files (the generators are the source of truth). Review the generator scripts (scripts/generate_ruby_gem.py, scripts/generate_typescript_connector.py) and the hand-authored core files; spot-check generated models. Key hand-authored files:

  • scripts/generate_ruby_gem.py, scripts/generate_typescript_connector.py
  • ruby-gem/lib/core/{connector,semantic_object,vocabulary_loader,json_ld_serializer}.rb
  • typescript-connector/src/core/{Connector,SemanticObject,VocabularyLoader}.ts
  • ruby-gem/spec/, typescript-connector/test/

Validation

  • python3 -m pytest tests/test_owl2linkml.py -v
  • cd typescript-connector && npm test && npm run build
  • cd ruby-gem && bundle exec rake spec

…cate mapping, reference resolution

- import(): pass entry params to constructors so own properties are set
- import(): always return SemanticObject[] (single object no longer unwrapped)
- import(): resolve @id-wrapped refs, bare URIs, and _: blank-node refs
- predicateToPropName(): restore colon-split + snake_case→camelCase mapping
- export(): @id-wrap SemanticObject references in JSON-LD output
- VocabularyLoader: handle array-wrapped JSON-LD and full-URI SKOS types
- regenerate connector from updated generator (source of truth)
…istration, constructor param forwarding

- require_relative '../core/semantic_object' (was 'semantic_object', wrong dir)
- Only prefix Core:: for SemanticObject parent; same-namespace parents are bare
- Replace broken inherited hook with explicit per-model type_registry registration
  (inherited fires before class body, so SEMANTIC_TYPE was never defined; classes
  were silently registered under ancestor types). Mirrors TS static {} block.
- Child constructors forward inherited keyword params to super so ancestor
  properties are set (super(semanticId, ...), not super(semanticId))
- Emit a constructor for every class so semanticType is always set
- Fix list-form domain matching in get_all_slots_for_class (schema uses
  domain: [Organization]; string-only match dropped all slots)
- Preserve static SKOS vocabulary files across regeneration instead of
  overwriting with empty stubs (enums use reachable_from, no inline values)

Verified: all 89 classes instantiate with correct semanticType; export/import
round-trip preserves inherited + own properties; TS 42 tests still pass.
…TS and Ruby connectors

Preserve the OWL property local name through the LinkML schema as slot
aliases, and use it to register the official short-form predicates instead
of the fake dfc-b:Class:snake_case keys.

- owl2linkml.py: slots carry aliases (OWL local name) + namespace; version
  dfc-b/dfc-t prefixes (https, v2.0.0); deterministic domain ordering
- generators: register predicates via predicate_for_slot() (dfc-b/dfc-t/
  skos prefixes, full URI for icaltzd/geojson/schema.org); generate a
  PREDICATE_MAP reverse map for import; legacy class-prefixed keys still
  import via local-name fallback
- ruby json_ld_serializer: serialize from registered predicates instead of
  instance variable names
- regenerate schema + TS/Ruby connectors; migrate TS fixtures/assertions
  to compacted predicate forms
…ial gem

- JsonLdSerializer compacts via JSON::LD::API.expand/compact with the official
  context; @context set to context URL string (matches TS and official gem)
- Connector#export returns a compacted JSON string (was a plain Hash)
- _fetch_context follows HTTP redirects (w3id.org returns 302)
- gemspec declares json-ld/rdf runtime deps + rake/rspec dev deps
- generator preserves hand-written spec/ across regeneration
- adds 15 rspec tests covering export/import round-trips, @graph handling,
  legacy predicate keys, and object-ref resolution
…ync with committed code

- Both generators previously rmtree'd the whole output tree, destroying the
  hand-maintained bundled SKOS taxonomies and JSON-LD contexts (src/context/,
  src/taxonomies/, ruby-gem/contexts/) that the generated core imports at
  build/runtime. They now preserve and restore those files across regeneration.
- Ruby generator was already preserving vocabularies/ and spec/; add contexts/.
- Bring all six generator core templates in sync with the committed generated
  files (commit 780f025 added the bundled-context feature by hand):
  - SemanticObject: getRegisteredPredicates/getRegisteredValue,
    registered_predicates/registered_value
  - VocabularyLoader: bundled imports + BUNDLED map/loadBundled/bundledData,
    BUNDLED_DIR/BUNDLED_FILES/load_bundled, ontology_version + dfc-version header
  - Connector: default jsonld import, bundledContextV200 + loadBundledContext,
    loadBundledTaxonomies, dfc-version header on context/taxonomy fetches
- gemspec generator now includes contexts/**/*.json in spec.files.
- Fixed a latent template bug: contextUrl emitted literal $this instead of
  ${this.ontologyVersion}.
- Verified: regenerating both connectors is now idempotent and produces
  byte-identical output to the committed tree; TS/Ruby/Python test suites pass.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This stacked PR updates the generated TypeScript connector and Ruby gem (plus a few core/hand-authored files and tests/fixtures) to align JSON-LD import/export behavior and predicate formats with the official DFC connectors, aiming for round-trip compatibility and consistent compacted JSON-LD output.

Changes:

  • Regenerated TS/Ruby model layers to register official compacted predicates (e.g., dfc-b:VATnumber, dfc-b:name) instead of the prior dfc-b:Class:prop style.
  • Updated connector/core behavior and fixtures around JSON-LD serialization/import assumptions (notably reference handling and taxonomy/vocabulary loading).
  • Added/updated Ruby gem test harness (RSpec + rake task) and adjusted gem metadata/dependencies to match the connector’s runtime needs.

Reviewed changes

Copilot reviewed 188 out of 270 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
typescript-connector/test/integration/fixtures/simple-enterprise.json Updates fixture predicates to official compact form
typescript-connector/test/integration/fixtures/enterprise-supplied-product.json Updates fixture predicates to official compact form
typescript-connector/src/models/WhoSubject.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/WhereSubject.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/WhatSubject.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/VirtualPlace.ts Regenerated model predicate registration to official predicates (e.g., dfc-b:URL)
typescript-connector/src/models/Vevent.ts Regenerated model predicate registration incl. full-IRI predicates for iCal terms
typescript-connector/src/models/Vehicle.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/VariantCaracteristic.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Variant.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ValueRECUR.ts Regenerated model predicate registration incl. full-IRI predicates for iCal terms
typescript-connector/src/models/Transaction.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/TheoriticalStock.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/TemplateSaleSession.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Temperature.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/TechnicalProduct.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/SuppliedProduct.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Stock.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Step.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/SocialMedia.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ShippingOption.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Shipment.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Route.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/RealStock.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/QuantitativeValue.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Properties.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ProductOption.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ProductionFlow.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ProductBatch.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Price.ts Regenerated model predicate registration to official predicate casing (dfc-b:VATrate)
typescript-connector/src/models/Place.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/PickupOption.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/PhysicalProduct.ts Regenerated model predicate registration incl. official dfc-b:Image
typescript-connector/src/models/PhysicalPlace.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/PhysicalCharacteristic.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/PhoneNumber.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Person.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/PaymentMethod.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/OrderLine.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/OpeningHoursSpecification.ts Regenerated model predicate registration incl. schema.org IRIs
typescript-connector/src/models/Offer.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/NutrientCharacteristic.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/LocalizedProduct.ts Regenerated model predicate registration incl. official dfc-b:Image
typescript-connector/src/models/LabellingCharacteristic.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Ingredient.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Individual.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/index.ts Exports regenerated/added models (incl. Enterprise)
typescript-connector/src/models/HowSubject.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Geometry.ts Regenerated model predicate registration incl. GeoJSON IRIs
typescript-connector/src/models/FunctionalProduct.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Feature.ts Regenerated model predicate registration incl. GeoJSON IRIs
typescript-connector/src/models/Enterprise.ts Adds Enterprise model for official-type coverage
typescript-connector/src/models/DitributedRepresentation.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/DeliveryOption.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/CustomerCategory.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Coordination.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ConsumptionFlow.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/ConceptScheme.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Concept.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Collection.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Certfication.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Catalog.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Brand.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/AsRealizedTransformation.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/AsPlannedTransformation.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/AsPlannedLocalTransformation.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/AllergenCharacteristic.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Agent.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/models/Address.ts Regenerated model predicate registration to compact predicates
typescript-connector/src/index.ts Public exports updated to include regenerated/added models
typescript-connector/src/core/VocabularyLoader.ts Adjusts taxonomy vocabulary loading behavior used by connector
typescript-connector/dist/models/WhoSubject.js Built output updated for regenerated predicates
typescript-connector/dist/models/WhereSubject.js Built output updated for regenerated predicates
typescript-connector/dist/models/WhatSubject.js Built output updated for regenerated predicates
typescript-connector/dist/models/VirtualPlace.js Built output updated for regenerated predicates
typescript-connector/dist/models/Vevent.js Built output updated for regenerated predicates
typescript-connector/dist/models/Vehicle.js Built output updated for regenerated predicates
typescript-connector/dist/models/VariantCaracteristic.js Built output updated for regenerated predicates
typescript-connector/dist/models/Variant.js Built output updated for regenerated predicates
typescript-connector/dist/models/ValueRECUR.js Built output updated for regenerated predicates
typescript-connector/dist/models/Transaction.js Built output updated for regenerated predicates
typescript-connector/dist/models/TheoriticalStock.js Built output updated for regenerated predicates
typescript-connector/dist/models/TemplateSaleSession.js Built output updated for regenerated predicates
typescript-connector/dist/models/Temperature.js Built output updated for regenerated predicates
typescript-connector/dist/models/TechnicalProduct.js Built output updated for regenerated predicates
typescript-connector/dist/models/SuppliedProduct.js Built output updated for regenerated predicates
typescript-connector/dist/models/Stock.js Built output updated for regenerated predicates
typescript-connector/dist/models/Step.js Built output updated for regenerated predicates
typescript-connector/dist/models/SocialMedia.js Built output updated for regenerated predicates
typescript-connector/dist/models/ShippingOption.js Built output updated for regenerated predicates
typescript-connector/dist/models/Shipment.js Built output updated for regenerated predicates
typescript-connector/dist/models/Route.js Built output updated for regenerated predicates
typescript-connector/dist/models/RealStock.js Built output updated for regenerated predicates
typescript-connector/dist/models/QuantitativeValue.js Built output updated for regenerated predicates
typescript-connector/dist/models/Properties.js Built output updated for regenerated predicates
typescript-connector/dist/models/ProductOption.js Built output updated for regenerated predicates
typescript-connector/dist/models/ProductionFlow.js Built output updated for regenerated predicates
typescript-connector/dist/models/ProductBatch.js Built output updated for regenerated predicates
typescript-connector/dist/models/Price.js Built output updated for regenerated predicates
typescript-connector/dist/models/Place.js Built output updated for regenerated predicates
typescript-connector/dist/models/PickupOption.js Built output updated for regenerated predicates
typescript-connector/dist/models/PhysicalProduct.js Built output updated for regenerated predicates
typescript-connector/dist/models/PhysicalPlace.js Built output updated for regenerated predicates
typescript-connector/dist/models/PhysicalCharacteristic.js Built output updated for regenerated predicates
typescript-connector/dist/models/PhoneNumber.js Built output updated for regenerated predicates
typescript-connector/dist/models/Person.js Built output updated for regenerated predicates
typescript-connector/dist/models/PaymentMethod.js Built output updated for regenerated predicates
typescript-connector/dist/models/Organization.d.ts Type output updated for renamed/realigned fields
typescript-connector/dist/models/OrderLine.js Built output updated for regenerated predicates
typescript-connector/dist/models/OpeningHoursSpecification.js Built output updated for regenerated predicates
typescript-connector/dist/models/Offer.js Built output updated for regenerated predicates
typescript-connector/dist/models/NutrientCharacteristic.js Built output updated for regenerated predicates
typescript-connector/dist/models/LocalizedProduct.js Built output updated for regenerated predicates
typescript-connector/dist/models/LabellingCharacteristic.js Built output updated for regenerated predicates
typescript-connector/dist/models/Ingredient.js Built output updated for regenerated predicates
typescript-connector/dist/models/Individual.js Built output updated for regenerated predicates
typescript-connector/dist/models/index.js Built output exports updated (incl. Enterprise)
typescript-connector/dist/models/index.d.ts Built output type exports updated (incl. Enterprise)
typescript-connector/dist/models/HowSubject.js Built output updated for regenerated predicates
typescript-connector/dist/models/Geometry.js Built output updated for regenerated predicates
typescript-connector/dist/models/FunctionalProduct.js Built output updated for regenerated predicates
typescript-connector/dist/models/Feature.js Built output updated for regenerated predicates
typescript-connector/dist/models/Enterprise.js Built output for added Enterprise model
typescript-connector/dist/models/Enterprise.d.ts Built output types for added Enterprise model
typescript-connector/dist/models/DitributedRepresentation.js Built output updated for regenerated predicates
typescript-connector/dist/models/DeliveryOption.js Built output updated for regenerated predicates
typescript-connector/dist/models/CustomerCategory.js Built output updated for regenerated predicates
typescript-connector/dist/models/Coordination.js Built output updated for regenerated predicates
typescript-connector/dist/models/ConsumptionFlow.js Built output updated for regenerated predicates
typescript-connector/dist/models/ConceptScheme.js Built output updated for regenerated predicates
typescript-connector/dist/models/Concept.js Built output updated for regenerated predicates
typescript-connector/dist/models/Collection.js Built output updated for regenerated predicates
typescript-connector/dist/models/Certfication.js Built output updated for regenerated predicates
typescript-connector/dist/models/Catalog.js Built output updated for regenerated predicates
typescript-connector/dist/models/Brand.js Built output updated for regenerated predicates
typescript-connector/dist/models/AsRealizedTransformation.js Built output updated for regenerated predicates
typescript-connector/dist/models/AsPlannedTransformation.js Built output updated for regenerated predicates
typescript-connector/dist/models/AsPlannedLocalTransformation.js Built output updated for regenerated predicates
typescript-connector/dist/models/AllergenCharacteristic.js Built output updated for regenerated predicates
typescript-connector/dist/models/Agent.js Built output updated for regenerated predicates
typescript-connector/dist/models/Address.js Built output updated for regenerated predicates
typescript-connector/dist/index.js Built output public exports updated (incl. Enterprise)
typescript-connector/dist/index.d.ts Built output public type exports updated (incl. Enterprise)
typescript-connector/dist/core/VocabularyLoader.js Built output updated for vocabulary-loading changes
typescript-connector/dist/core/VocabularyLoader.d.ts Built output types updated for vocabulary-loading changes
typescript-connector/dist/core/SemanticObject.js Built output updated for JSON-LD reference encoding
ruby-gem/spec/spec_helper.rb Adds RSpec configuration for Ruby connector tests
ruby-gem/README.md Updates generated schema counts to reflect regeneration
ruby-gem/Rakefile Adds RSpec rake task and defaults to spec
ruby-gem/lib/models/who_subject.rb Regenerated Ruby model base w/ compact predicate registration
ruby-gem/lib/models/where_subject.rb Regenerated Ruby model base w/ compact predicate registration
ruby-gem/lib/models/what_subject.rb Regenerated Ruby model base w/ compact predicate registration
ruby-gem/lib/models/weight.rb Regenerated model init + type registration
ruby-gem/lib/models/volume.rb Regenerated model init + type registration
ruby-gem/lib/models/virtual_place.rb Regenerated model predicate registration (incl. dfc-b:URL)
ruby-gem/lib/models/variant_caracteristic.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/transformation.rb Regenerated model init + type registration
ruby-gem/lib/models/transaction.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/theoritical_stock.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/temperature.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/subject.rb Removes legacy subject base class (superseded by regenerated bases)
ruby-gem/lib/models/step.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/social_media.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/route.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/represented_thing.rb Refactors inheritance to regenerated representation base
ruby-gem/lib/models/representation_pivot.rb Adds regenerated RepresentationPivot model
ruby-gem/lib/models/relation.rb Removes legacy relation base class (superseded by regenerated bases)
ruby-gem/lib/models/real_stock.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/quantitative_value.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/properties.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/product_option.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/product_option_value.rb Regenerated model (drops/realigns properties per schema)
ruby-gem/lib/models/polygon.rb Regenerated model init + type registration
ruby-gem/lib/models/point.rb Regenerated model (realigns geometry fields per schema)
ruby-gem/lib/models/platform.rb Adds regenerated Platform model
ruby-gem/lib/models/place.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/pickup_option.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/pick_up_step.rb Regenerated model init + type registration
ruby-gem/lib/models/phone_number.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/person.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/payment_method.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/length.rb Regenerated model init + type registration
ruby-gem/lib/models/ingredient.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/individual.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/how_subject.rb Regenerated model base w/ compact predicate registration
ruby-gem/lib/models/geometry.rb Regenerated model predicate registration incl. GeoJSON IRIs
ruby-gem/lib/models/enterprise.rb Regenerated model (aligns class/property layout with schema)
ruby-gem/lib/models/ditributed_representation.rb Adds regenerated representation base class
ruby-gem/lib/models/delivery_step.rb Regenerated model init + type registration
ruby-gem/lib/models/customer_category.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/concept_scheme.rb Adds regenerated ConceptScheme model
ruby-gem/lib/models/collection.rb Adds regenerated Collection model
ruby-gem/lib/models/characteristic.rb Removes legacy characteristic base class (superseded by regenerated bases)
ruby-gem/lib/models/certfication.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/catalog.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/brand.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/as_realized_transformation.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/as_realized_production_flow.rb Regenerated model init + type registration
ruby-gem/lib/models/as_realized_consumption_flow.rb Regenerated model init + type registration
ruby-gem/lib/models/as_planned_transformation.rb Regenerated model predicate registration to compact predicates
ruby-gem/lib/models/as_planned_production_flow.rb Regenerated model init + type registration
ruby-gem/lib/models/as_planned_local_production_flow.rb Regenerated model init + type registration
ruby-gem/lib/models/as_planned_local_consumption_flow.rb Regenerated model init + type registration
ruby-gem/lib/models/as_planned_consumption_flow.rb Regenerated model init + type registration
ruby-gem/lib/dfc_linkml_connector.rb Updates requires to match regenerated model set and new bases
ruby-gem/lib/core/vocabulary_loader.rb Updates taxonomy URL handling used by Ruby connector
ruby-gem/lib/core/semantic_object.rb Adjusts type registry mechanics (models now self-register)
ruby-gem/lib/core/json_ld_serializer.rb Provides compacted JSON-LD serialization aligned with official behavior
ruby-gem/dfc-linkml-connector.gemspec Updates gem metadata and runtime/dev dependencies
ruby-gem/.gitignore Ignores rspec persistence file and lockfile per updated tooling
Suppressed comments (1)

ruby-gem/lib/core/vocabulary_loader.rb:16

  • VocabularyLoader now hardcodes TAXONOMY_BASE_URL to a specific version (.../v2.0.0) while still accepting taxonomy_version: in initialize. As a result, taxonomy_version is ignored and load_from_url cannot fetch other versions.

Use an unversioned base URL and incorporate @taxonomy_version when building the URL (consistent with Core::Connector).

      TAXONOMY_BASE_URL = "https://w3id.org/dfc/taxonomies/v2.0.0".freeze

      def initialize(taxonomy_version: "2.0.0")
        @taxonomy_version = taxonomy_version
        @vocabularies = {}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread typescript-connector/src/core/VocabularyLoader.ts
…rcion, and bundled load caching

- TS VocabularyLoader: taxonomyBaseUrl uses ${this.taxonomyVersion} and
  loadFromUrl keeps the URL name as-is while mapping it to the internal
  vocabulary key (fixes empty Facet lookups and productTypes URL casing).
- TS VocabularyLoader: extractConceptKey coerces SKOS notation/prefLabel
  (plain string, arrays, and @value wrappers) to a stable string key.
- Ruby: load_bundled_taxonomies caches each _bundled_json read instead of
  parsing every bundled taxonomy twice.

Addresses Copilot review on #12/#13.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 188 out of 270 changed files in this pull request and generated no new comments.

Suppressed comments (3)

typescript-connector/src/core/VocabularyLoader.ts:32

  • Vocabulary key extraction casts skos:notation/prefLabel to string, but in the provided thesaurus JSON-LD these fields are often arrays of { "@value": ... } objects. Casting those to string produces "[object Object]", collapsing many concepts under the same key and making lookups unreliable.
    typescript-connector/src/core/VocabularyLoader.ts:42
  • loadFromUrl() relies on taxonomyBaseUrl, but taxonomyBaseUrl currently returns a literal v$this.taxonomyVersion (no ${...} interpolation), so the constructed URL is invalid and remote taxonomy loading will fail.
    ruby-gem/lib/core/vocabulary_loader.rb:12
  • VocabularyLoader#load currently only recognizes @type values containing "skos:Concept" and only reads skos:notation / skos:prefLabel. The bundled test thesaurus JSON-LD uses full SKOS IRIs (e.g. http://www.w3.org/2004/02/skos/core#Concept and ...#prefLabel) and represents labels/notations as arrays of { "@value": ... }. As written, this loader will skip most entries and/or produce nil / non-string keys.
      TAXONOMY_BASE_URL = "https://w3id.org/dfc/taxonomies/v2.0.0".freeze

…from_url

- TS: Connector.loadBundledTaxonomies() now builds nested hashes straight from
  the already-parsed VocabularyLoader vocabularies instead of re-loading the
  bundled JSON-LD through loadFacets/loadMeasures/... (fixes duplicate startup
  parse of the bundled taxonomies).
- Ruby: VocabularyLoader.load_from_url keeps the URL name as-is (so
  productTypes.json is requested) and maps it to the internal vocabulary key
  via URL_TO_KEY, matching the TS loader.

Addresses suppressed Copilot comments on #13.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 188 out of 270 changed files in this pull request and generated 1 comment.

Suppressed comments (4)

Previously missed (3) — in code that hasn't changed since the last review.

scripts/generate_typescript_connector.py:723

  • The import contract is inconsistent with the official/Ruby connector: a one-entry document must return the object itself, but this always returns an array. Consumers relying on single-object imports therefore receive the wrong shape; return instances[0] when the length is one and update the TypeScript return type/tests accordingly.
    scripts/generate_typescript_connector.py:305
  • Emitting references as {"@id": ...} breaks the advertised TypeScript-to-Ruby round trip because Ruby Connector#import currently resolves only string IDs; wrapped scalar and array references remain raw hashes. Update the Ruby importer in the same change to resolve this representation (including blank nodes).
    typescript-connector/test/integration/conformance.test.ts:174
  • The added conformance suite cannot load: its import at line 3 uses ../src/index.js, which resolves to nonexistent test/src/index.js from this nested directory. Change it to ../../src/index.js; otherwise none of these new integration assertions run.

scripts/generate_ruby_gem.py:432

  • The Ruby loader only recognizes compact skos:Concept types and assumes notation/labels are scalar strings. Official JSON-LD taxonomy exports can use the full SKOS URI and array/@value wrappers, causing concepts to be skipped or keyed by arrays instead of their notation. Normalize the type and value shapes here as the TypeScript generator does.

Comment thread scripts/generate_typescript_connector.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 188 out of 270 changed files in this pull request and generated 3 comments.

Comment thread ruby-gem/lib/core/json_ld_serializer.rb
Comment thread typescript-connector/src/core/Connector.ts
Comment thread typescript-connector/test/connector.test.ts
RaggedStaff added a commit that referenced this pull request Aug 31, 2026
… IRIs, run_matrix, adapters

- ruby-gem/lib/core/json_ld_serializer.rb + generator: preserve booleans
  (true/false) as native JSON, not "true"/"false" strings — fixes
  vatStatus/frozen/refrigerated. (3889266828)
- ruby-gem/lib/core/connector.rb + generator: import always returns
  SemanticObject[] (was single-object unwrap) and resolves both
  string and {"@id":...} refs including blank nodes "_:" — aligns
  TS→Ruby round-trip. (3889266843, 3889266848, 5059067089)
- scripts/generate_ruby_gem.py: sync get_all_slots_for_class with TS
  (check explicit slots list + domain) + fix load() for full IRI/array
  and URL_TO_KEY plural mapping. (review 4)
- typescript-connector/src/taxonomies/*.ts + ruby vocabularies: add
  missing dfc-f/m/pt/v prefixes to bundled taxonomy contexts so
  bundled IRIs expand; note IDs still need canonical regeneration
  (facet/measure/product_type/scope/vocabulary_term). (3887548466-8508)
- contexts: fix dc namespace # → / (3889296612/6623) and re-add
  loadBundled() in Connector.loadBundledTaxonomies(). (3887548517)
- tests/cross_connector/run_matrix.py: treat node-loss as failure,
  wrap baseline export, guard drop_in_pairs requires both ours+official,
  fix docstring exit codes. (3887537781, 7801, 8525, 9067089)
- tests/cross_connector/runner.py: catch FileNotFoundError/OSError as
  RuntimeError so available_connectors() doesn't crash. (5060751555)
- adapters: official-typescript use outputContext not context, and
  handle promise rejections; our-typescript importData .catch.
  (5059067089 suppressed, 3889296585/6599)
- AGENTS.md: correct import returns to sync SemanticObject[] (was
  Promise) (3887537810, 5060748632).

Addresses 13 latest copilot comments across #12/13/14.
@RaggedStaff
RaggedStaff requested a balanced review from Copilot September 12, 2026 06:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Ruby predicate collisions can lose relationship data, and both generators emit contextless fallback JSON-LD.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 188/270 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment on lines +482 to +484
predicate_map_lines = []
for slot_name, slot_data in schema_data.get('slots', {}).items():
predicate_map_lines.append(f' "{predicate_for_slot(slot_name, slot_data)}" => "{ruby_property_name(slot_name)}",')
Comment on lines +799 to +801
doc["@context"] = _context_iri
end
JSON.pretty_generate(doc)
Comment on lines 658 to +660
}} catch {{
// Context fetch failed — export without @context
// Context fetch failed — export without compaction
return JSON.stringify(new JsonLdSerializer(undefined).serialize(...objects), null, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants