You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/naas-abi-core/naas_abi_core/services/event/README.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,11 @@ The contract `EventService` cares about:
23
23
24
24
### 1. Write a TTL
25
25
26
-
Create a `.ttl` file in your domain's `ontologies/modules/` directory. The two things that matter: an `owl:imports` pointing at the EventOntology TTL, and a `rdfs:subClassOf abi:LogProcess` on each event class.
26
+
Create a `.ttl` file in your domain's `ontologies/modules/` directory. Three things matter:
27
+
28
+
1.`owl:imports <http://ontology.naas.ai/abi/EventService>` so `LogProcess` is pulled from the canonical EventOntology (not regenerated locally).
29
+
2.`rdfs:subClassOf abi:LogProcess` on each event class.
30
+
3. The `abi:pythonPackage` / `abi:ontologyResource` / `abi:pythonResource` locator annotations on your own `owl:Ontology` declaration, so any *other* module can in turn `owl:imports` your ontology by its canonical IRI.
@@ -55,7 +62,7 @@ mydomain:source a owl:DatatypeProperty ;
55
62
rdfs:range xsd:string .
56
63
```
57
64
58
-
**Why `python://`?**It's an `importlib.resources`-based locator that works the same in editable installs, wheels, and zipped packages — it doesn't break the moment your TTL lives inside a `.venv`. Plain relative paths (e.g. `<../other/Foo.ttl>`) also work for intra-package references. Remote HTTP IRIs (BFO, etc.) are deliberately skipped — they're RDF-level references, not codegen inputs.
65
+
**Why `<http://ontology.naas.ai/abi/EventService>`?**That's the canonical IRI of the EventOntology — a normal, spec-compliant `owl:imports` target. onto2py keeps an index of every ontology declared by an installed `naas_abi*` package; when an `owl:imports` IRI matches one in the index, the TTL is loaded through `importlib.resources` (via the `abi:pythonPackage` / `abi:ontologyResource` annotations on that ontology), so it works the same in editable installs, wheels, and zipped packages. Plain relative paths (e.g. `<../other/Foo.ttl>`) also work for intra-package references. Remote HTTP IRIs that no installed package declares (BFO, etc.) are skipped — they're RDF-level references, not codegen inputs.
Copy file name to clipboardExpand all lines: libs/naas-abi-core/naas_abi_core/services/event/ontologies/modules/EventOntology.ttl
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,30 @@
8
8
@prefix bfo: <http://purl.obolibrary.org/obo/> .
9
9
@prefix abi: <http://ontology.naas.ai/abi/> .
10
10
11
+
# Locator annotations: tell onto2py where this ontology lives in the Python
12
+
# package tree so downstream ontologies can import it by its canonical IRI
13
+
# (a spec-compliant owl:imports target) and still resolve correctly inside
14
+
# editable installs, wheels, and zipped packages.
15
+
abi:pythonPackage a owl:AnnotationProperty ;
16
+
rdfs:label "python package"@en ;
17
+
rdfs:comment "Dotted Python package used as the importlib.resources root for this ontology's files."@en .
18
+
19
+
abi:ontologyResource a owl:AnnotationProperty ;
20
+
rdfs:label "ontology resource"@en ;
21
+
rdfs:comment "Path to this ontology's .ttl file, relative to abi:pythonPackage."@en .
22
+
23
+
abi:pythonResource a owl:AnnotationProperty ;
24
+
rdfs:label "python resource"@en ;
25
+
rdfs:comment "Path to this ontology's generated .py file, relative to abi:pythonPackage. Used to build the dotted module for `from <module> import <Class>`."@en .
26
+
11
27
abi:EventService a owl:Ontology ;
12
28
dc:title "Event Service Ontology"@en ;
13
29
dc:description "Base ontology for engine events. Defines LogProcess as the root class for all events published through the EventService."@en ;
Copy file name to clipboardExpand all lines: libs/naas-abi-core/naas_abi_core/services/object_storage/ontologies/modules/ObjectStorageEventOntology.ttl
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,10 @@ os:ObjectStorageEventOntology a owl:Ontology ;
12
12
dc:title "Object Storage Event Ontology"@en ;
13
13
dc:description "Events emitted by the ObjectStorageService when objects are written to or removed from the store."@en ;
0 commit comments