apache / apache/ossie

Proposal: Adopt ontology-query as an Ontology Access Layer tool

Open
#107 1 comment 6 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.1k
Forks
267
Avg merge
4d 20h
Merged PRs (30d)
24

Description

# Proposal: Adopt `ontology-query` as an Ontology Access Layer tool for OSI

## Summary
I propose that the OSI project **adopt (or officially recommend)** a lightweight reference tool called **`ontology-query`** as an *Ontology Access Layer* for OSI semantic models.

`ontology-query` loads an OSI YAML file, builds a small knowledge graph, materializes **Datalog facts** (deterministic reasoning), and exposes:
- a **Python SDK** for other agents/tools
- a **CLI** for interactive ontology interrogation

This is intended to support **agent-to-agent** architectures (Ontology Agent ↔ Data/Service Agent) by providing a rigorous, deterministic way to query and reason over the ontology (datasets/fields/relationships/metrics/behavior), without relying on NL→SQL.

## Motivation
OSI standardizes semantic models, but many agent workflows need a *consistent “ontology access” interface*:
- Discoverability: list datasets/fields/metrics/actions
- Deterministic reasoning: relationship reachability / join-path discovery / impact analysis
- Attribution & planning support: determine which actions can change which fields (via `behavior.actions[].effects`)
- Enable an Ontology Agent to request data from a Data/Service Agent using a stable, machine-readable query plan

While tools can implement this independently, a small reference implementation would accelerate adoption and reduce fragmentation.

## Proposed scope (initial)
### Supported OSI concepts
- datasets + fields
- relationships (transitive reachability)
- metrics (names; expressions are not interpreted by this tool)
- behavior layer:
- preferred: `semantic_model.behavior`
- legacy: behavior embedded under `custom_extensions` JSON
- `actions` (preferred) + `action_types` (alias)
- `effects` (impact annotations)

### Example queries
- “List datasets”
- “List fields of suppliers”
- “Which actions can change suppliers.status?”
- “Show effects of suppliers/block”
- “Is dataset A reachable to dataset B through relationships?”

## Repository
Reference implementation: https://github.com/zljie/ontology-query

## Why Datalog (rigor)
The core requirement is **rigorous logical inference** with reproducible results. Datalog provides:
- deterministic evaluation
- transitive closure / rule-based derivations
- a foundation for explainability (proof-style traces can be added incrementally)

## Suggested next steps
1) If maintainers agree with the direction, we can:
- add `ontology-query` under an OSI org repository (or list as an official companion tool)
- align naming/packaging and CI expectations
2) Add a small “ontology access layer” section to OSI docs referencing the tool.

## Questions
1) Would OSI maintainers accept an official companion tool for ontology access?
2) Preference: keep it as a separate repo under OSI org, or under `tools/` in the main repo?
3) Any constraints on dependencies (e.g., allow `pyDatalog`) or target Python versions?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.