-
-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Labels
coreCore Semantica logic and abstractionsCore Semantica logic and abstractionsenhancementNew feature or requestNew feature or request
Description
Map and connect different ontologies together so Semantica can unify data across systems, standards, and domains.
Modules and Folders Involved
- Alignment logic builds on:
semantica/ontology/(public APIs, namespace handling, reuse).semantica/triplet_store/(storage of alignment triples and queries).
- Tests should be added to:
tests/ontology/tests/triplet_store/
- Use only the existing
semantica/andtests/directories; no new top‑level folders.
Feature Behaviour
- Represents alignments between ontology entities (classes, properties, concepts) using standard predicates.
- Stores alignments as RDF triples in the existing triplet store.
- Exposes APIs to create, list, and query alignments.
- Allows query and validation engines to optionally use alignment information when reasoning over data.
Why Alignment Matters
- Enables cross‑system interoperability and semantic integration.
- Lets a single semantic layer span multiple standards (e.g. internal model + industry models).
- Supports multi‑domain knowledge graphs where different ontologies must co‑exist.
- Critical for complex enterprise environments with many data sources and schemas.
Existing Code and Tests
- Ontology
- semantica/ontology/engine.py
- semantica/ontology/namespace_manager.py
- semantica/ontology/module_manager.py
- semantica/ontology/reuse_manager.py
- Triplet store
- semantica/triplet_store/triplet_store.py
- semantica/triplet_store/query_engine.py
- Docs and tests
- docs/reference/ontology.md
- docs/reference/triplet_store.md
- tests/ontology/test_ontology_advanced.py
- tests/triplet_store/test_triplet_store.py
New Functionality to Add
- Alignment representation
- Use owl:equivalentClass, owl:equivalentProperty, skos:exactMatch, etc., stored as triples in TripletStore.
- Namespace support
- In semantica/ontology/namespace_manager.py:
- Confirm OWL and SKOS namespaces, and expose helpers if helpful.
- In semantica/ontology/namespace_manager.py:
- Alignment APIs
- In semantica/ontology/engine.py (or a small helper inside ontology package):
- Implement create_alignment, get_alignments, list_alignments methods that call TripletStore.
- In semantica/ontology/engine.py (or a small helper inside ontology package):
- Import‑time alignment suggestions
- In semantica/ontology/reuse_manager.py:
- Optionally compute suggested alignments when importing external ontologies.
- In semantica/ontology/reuse_manager.py:
- Alignment‑aware queries
- In semantica/triplet_store/query_engine.py:
- Add helpers to expand entity URIs to include aligned entities when use_alignments=True.
- In semantica/triplet_store/query_engine.py:
- Documentation and tests
- Extend the docs and tests listed above with:
- Examples of alignment creation.
- Queries that use alignments to retrieve cross‑ontology results.
- Extend the docs and tests listed above with:
Implementation Walkthrough
-
Alignment representation in RDF
- Use standard predicates such as:
- owl:equivalentClass
- owl:equivalentProperty
- skos:exactMatch, skos:closeMatch
- In ontology/namespace_manager.py:
- Confirm namespaces are defined for OWL and SKOS.
- Use standard predicates such as:
-
Alignment management API
- In ontology/engine.py (or a small helper within the ontology package):
- Implement public methods:
- create_alignment(source_uri: str, target_uri: str, predicate: str) -> None
- get_alignments(entity_uri: str) -> List[Dict[str, Any]]
- list_alignments(ontology_uri: Optional[str] = None) -> List[Dict[str, Any]]
- These methods should:
- Use TripletStore APIs to write and read alignment triples.
- Implement public methods:
- In ontology/engine.py (or a small helper within the ontology package):
-
Integration with reuse_manager
- In ontology/reuse_manager.py:
- When importing external ontologies or mapping them into a project:
- Optionally create suggested alignments (e.g. based on identical URIs, labels, or provided mapping configs).
- When importing external ontologies or mapping them into a project:
- In ontology/reuse_manager.py:
-
Query helpers using alignments
- In triplet_store/query_engine.py:
- Add helper functions that:
- Given an entity URI, expand it into a set including aligned entities when a flag use_alignments=True is passed.
- Allow higher‑level components to build queries that respect alignments.
- Add helper functions that:
- In triplet_store/query_engine.py:
-
Documentation
- In docs/reference/ontology.md:
- Add “Ontology Alignment” section demonstrating:
- Creating alignments between two ontologies.
- Running a query or validation that uses alignments.
- Add “Ontology Alignment” section demonstrating:
- Link from docs/reference/triplet_store.md where SPARQL helpers are documented.
- In docs/reference/ontology.md:
Finished When
- Contributors can programmatically:
- Create alignments between ontology entities.
- List and query alignments for a given entity or ontology.
- Triplet store helpers can expand queries using alignment information when requested.
- Tests cover:
- Creating and retrieving alignment triples.
- Using alignment‑aware queries to retrieve instances across aligned classes.
- Documentation makes it clear how ontology alignment fits into Semantica’s data integration story.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreCore Semantica logic and abstractionsCore Semantica logic and abstractionsenhancementNew feature or requestNew feature or request
Type
Projects
Status
Todo