Backlinks
Define the vocabulary that describes your domain
Each dataspace has a namespace ontology where you define the classes and properties of your domain. It lives in the admin dataspace, which shares your base URI with an admin. subdomain prefix: for the end-user app at https://localhost:4443/, the ontology document is https://admin.localhost:4443/ontologies/namespace/.
Northwind reuses Schema.org terms rather than inventing its own, so modeling here means little more than declaring which classes the app uses and how they are labeled:
@prefix : <#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix schema: <https://schema.org/> .
: a owl:Ontology .
schema:ProductGroup a owl:Class ;
rdfs:label "Category" ;
rdfs:isDefinedBy : .
schema:Product a owl:Class ;
rdfs:label "Product" ;
rdfs:isDefinedBy : .
schema:Order a owl:Class ;
rdfs:label "Order" ;
rdfs:isDefinedBy : .Source (full model): admin/model/ns.ttl
The finished model goes further than labels. It declares the domain's properties with
their domains and ranges, a couple of owl:Restrictions,
and a constructor that drives the Product create form.
It also attaches views directly to properties with ldh:inverseView. That is why every customer page shows its orders and every supplier page its
products, with no per-page configuration.
Open the admin dataspace and edit the namespace ontology document directly, or follow the Change model guide, which also shows how to add SPIN constructors to classes — the templates that drive the create-instance forms in the UI.
Install ns.ttl as the namespace ontology with one command. ldh finds the admin dataspace and the ontology IRI from the links
$LDH_BASE advertises, resolves the file against ${LDH_BASE}ns# so the : prefix names the end-user namespace, replaces the
ontology document and reloads the cached ontology:
ldh admin import ontology --file ns.ttl
Re-running it converges: a class removed from ns.ttl is removed from the ontology too.
What you now see¶
The ontology document in the admin app now renders your classes with their labels.
The visible payoff on the end-user side comes in the next stage: resources imported
as
schema:Product or schema:Order arrive typed and labeled, and the model is what the UI uses to render and create
them.
How this works¶
- Ontologies — namespace ontologies, imports and caching
- Change model — classes, constructors and constraints from the UI
Next: Data