Skip to content

Add SAP Business Partner example for the ontology layer - #310

Open
marioapiphani wants to merge 1 commit into
apache:mainfrom
marioapiphani:example-sap-bp-ontology
Open

Add SAP Business Partner example for the ontology layer#310
marioapiphani wants to merge 1 commit into
apache:mainfrom
marioapiphani:example-sap-bp-ontology

Conversation

@marioapiphani

Copy link
Copy Markdown

examples/ has one ontology-layer example today (flights.yaml). This adds a second, drawn from an enterprise ERP domain, that exercises ontology constructs the existing example does not reach:

  • entity subtypingCustomer declares extends: [ BusinessPartner ]; flights.yaml has no EntityType subtyping
  • a derived populationCustomer uses concept-level derived_by to define its population as exactly those business partners carrying a customer number, rather than asserting it. flights.yaml uses derived_by only on relationships, for derived attributes.
  • four-part compound identityCustomerSalesArea is identified by customer + sales organization + distribution channel + division. The existing example tops out at two parts.

It also covers ground shared with flights.yaml — value types with requires, associations with and without functional multiplicity, verbalizations in both reading directions, and ontology_mappings down to a logical model — so it stands alone as a reading example.

Source-system provenance (SAP Data Dictionary domains and check tables) is recorded in the descriptions, showing one way to keep technical origin alongside a business-level model.

The README's examples/ entry is updated to name both ontology-layer models.

The file validates against ontology/ontology.json as shipped, with core-spec/osi-schema.json registered to resolve the remote $ref from the checkout:

import json, re, yaml
from jsonschema import Draft202012Validator
from referencing import Registry, Resource
onto = open("ontology/ontology.json").read()
core = Resource.from_contents(json.load(open("core-spec/osi-schema.json")))
reg = Registry().with_resources([(u, core) for u in set(re.findall(r'"\$ref": "(https://[^"#]+)', onto))])
v = Draft202012Validator(json.loads(onto), registry=reg)
print(sorted(v.iter_errors(yaml.safe_load(open("examples/sap_business_partner_ontology.yaml"))), key=lambda e: list(e.path)) or "VALID")

Prints VALID. No code changes.

🤖 Generated with Claude Code

An ontology-layer model of a Business Partner domain, exercising entity
subtyping with a derived population, four-part compound identity, value
types with requires constraints, associations with and without functional
multiplicity, verbalizations, and ontology_mappings to a logical model.

Validates against ontology/ontology.json as shipped.
@jbonofre
jbonofre self-requested a review August 9, 2026 13:26
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