Skip to content

Bidirectional OO-LD <-> SHACL converter #108

Description

@SimonStier

Convert between OO-LD schemas and SHACL shapes graphs in both directions, so schemas authored in either form can be used with the other stack.

Spec-side twin: OO-LD/oold-schema#76 (align x-oold-range / x-oold-ui-* with SHACL 1.2). That issue holds the crosswalk definition; this one is the implementation.

cc @durmaz07

OO-LD to SHACL

  • sh:NodeShape per object schema, sh:PropertyShape per property
  • type to sh:datatype/sh:nodeKind, required and array bounds to sh:minCount/sh:maxCount, pattern to sh:pattern, enum to sh:in, numeric bounds to sh:minInclusive/sh:maxInclusive
  • JSON-LD context resolves property IRIs for sh:path and the type IRI for sh:targetClass
  • Logical composition maps to SHACL Core: anyOf to sh:or, oneOf to sh:xone, allOf to sh:and, not to sh:not
  • Nested objects and $ref

SHACL to OO-LD

Shapes graph to JSON Schema plus @context, inverting the mappings above. Several constructs have
no direct counterpart but do have candidates to evaluate:

  • sh:closed to additionalProperties: false
  • inverse paths to x-oold-reverse-properties
  • sh:path sequence and alternative paths: no evident equivalent, needs a decision

Round-trip OO-LD to SHACL to OO-LD should be semantically stable on the reference schemas.

Open questions

  • if/then/else has no SHACL Core equivalent. SHACL-SPARQL (sh:sparql) could express it, as could SHACL 1.2 Node Expressions. Worth deciding whether to support it at all: conditional subschemas are also awkward for code generation, so the spec may prefer to discourage if/then rather than carry it through every converter. Coordinate with Align x-oold-range / x-oold-ui-* with SHACL 1.2 (Core, Node Expressions, User Interfaces) oold-schema#76.
  • Which SHACL subset is the primary target: Core only, or Core plus SHACL-SPARQL for the residue
  • SHACL 1.2 User Interfaces is a Working Draft and overlaps x-oold-ui-*; the converter should emit and consume UI annotations rather than dropping them
  • Whether SHACL validation results should be normalised against JSON Schema validator output

Acceptance

Metadata

Metadata

Labels

converterSchema conversion to/from another schema or modelling language

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions