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.
Append the class definitions from ns.ttl to the namespace ontology document with POST. The prepended @base makes the : prefix resolve to
${LDH_BASE}ns# — the terms belong to the end-user namespace even though the ontology document lives
in the admin app:
admin_base="https://admin.localhost:4443/" # $LDH_BASE with the admin. subdomain prefix
{ echo "@base <${LDH_BASE}ns> ."; cat ns.ttl; } | ldh post \
-t text/turtle \
"${admin_base}ontologies/namespace/"The ontology is cached in memory, so tell the dataspace to reload it:
ldh admin clear ontology \
-b "$admin_base" \
--ontology "${LDH_BASE}ns#"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