From a85d3459a58f6f64a90e7b821081b29b4088c2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Tue, 28 Oct 2025 15:14:00 +0100 Subject: [PATCH 01/14] Documentation fixes --- linkeddatahub/docs/reference/administration.ttl | 2 +- linkeddatahub/docs/reference/stylesheets.ttl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/linkeddatahub/docs/reference/administration.ttl b/linkeddatahub/docs/reference/administration.ttl index abb81c1..ea3022f 100644 --- a/linkeddatahub/docs/reference/administration.ttl +++ b/linkeddatahub/docs/reference/administration.ttl @@ -17,7 +17,7 @@ <#content> a ldh:XHTML ; rdf:value """

Access control and domain model management

-

Administration is provided in a separate LDT application, which is paired with each end-user +

Administration is provided in a separate LinkedDataHub application, which is paired with each end-user application.

"""^^rdf:XMLLiteral . diff --git a/linkeddatahub/docs/reference/stylesheets.ttl b/linkeddatahub/docs/reference/stylesheets.ttl index 67ff584..9c834fe 100644 --- a/linkeddatahub/docs/reference/stylesheets.ttl +++ b/linkeddatahub/docs/reference/stylesheets.ttl @@ -117,8 +117,8 @@ lapp: https://w3id.org/atomgraph/linkeddatahub/apps# - AtomGraph Platform - LDT application concepts + LinkedDataHub application ontology + LinkedDataHub application concepts lacl: @@ -150,7 +150,7 @@
$ac:forClass
The URI of the class whose instance is being created.
$lapp:Application
-
RDF/XML document with the metadata of the current LDT application
+
RDF/XML document with the metadata of the current LinkedDataHub application
$foaf:Agent
RDF/XML document with the metadata of the currently authenticated agent (if any)
From 86fb0a61d4c106d62a2951c29791437ca15f7878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Fri, 28 Nov 2025 14:06:39 +0100 Subject: [PATCH 02/14] Script fixes --- demo/city-graph/admin/clear-ontologies.sh | 12 +++- demo/city-graph/admin/model/add-classes.sh | 62 +++++++++++-------- demo/city-graph/create-charts.sh | 4 +- .../admin/clear-ontologies.sh | 12 +++- .../admin/model/add-imports.sh | 12 +++- .../admin/model/import-ontologies.sh | 22 ++++--- demo/northwind-traders/create-charts.sh | 8 +-- demo/northwind-traders/create-containers.sh | 55 ++++++++-------- demo/skos/admin/acl/create-authorizations.sh | 16 +++-- demo/skos/admin/clear-ontologies.sh | 14 ++++- demo/skos/admin/model/add-constraints.sh | 14 ++++- demo/skos/admin/model/collection-template.ttl | 13 ++-- .../admin/model/concept-scheme-template.ttl | 13 ++-- demo/skos/admin/model/concept-template.ttl | 25 ++++---- demo/skos/admin/model/import-ontologies.sh | 26 +++++--- demo/skos/admin/model/post-class-templates.sh | 36 +++++++---- demo/skos/create-containers.sh | 22 ++++--- demo/skos/files/skos.xsl | 2 +- 18 files changed, 229 insertions(+), 139 deletions(-) diff --git a/demo/city-graph/admin/clear-ontologies.sh b/demo/city-graph/admin/clear-ontologies.sh index 8461c17..c25f666 100755 --- a/demo/city-graph/admin/clear-ontologies.sh +++ b/demo/city-graph/admin/clear-ontologies.sh @@ -17,9 +17,17 @@ else proxy="$base" fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + clear-ontology.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - -b "${base}admin/" \ - --proxy "$proxy" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ --ontology "${base}ns#" diff --git a/demo/city-graph/admin/model/add-classes.sh b/demo/city-graph/admin/model/add-classes.sh index 49fb29b..12f97e3 100755 --- a/demo/city-graph/admin/model/add-classes.sh +++ b/demo/city-graph/admin/model/add-classes.sh @@ -17,92 +17,100 @@ else proxy="$base" fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#BicycleParking" \ --label "Bicycle parking" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#ChargingStation" \ --label "Charging station" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#Library" \ --label "Library" \ --sub-class-of "https://schema.org/Library" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#ParkingFacility" \ --label "Parking facility" \ --sub-class-of "https://schema.org/ParkingFacility" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#Place" \ --label "Place" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#Playground" \ --label "Playground" \ --sub-class-of "https://schema.org/Playground" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#School" \ --label "School" \ --sub-class-of "https://schema.org/School" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#SportsCenter" \ --label "Sports center" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#PublicToilet" \ --label "Toilet" \ --sub-class-of "http://schema.org/PublicToilet" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" diff --git a/demo/city-graph/create-charts.sh b/demo/city-graph/create-charts.sh index 2819572..3c4be6a 100755 --- a/demo/city-graph/create-charts.sh +++ b/demo/city-graph/create-charts.sh @@ -37,7 +37,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Largest parking facilities" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/charts/parking-facilities-by-spaces.rq" \ "$chart_doc" @@ -47,7 +47,7 @@ add-result-set-chart.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Largest parking facilities" \ - --fragment this \ + --uri "#this" \ --query "${chart_doc}#${query_id}" \ --chart-type "https://w3id.org/atomgraph/client#BarChart" \ --category-var-name "name" \ diff --git a/demo/northwind-traders/admin/clear-ontologies.sh b/demo/northwind-traders/admin/clear-ontologies.sh index 8461c17..c25f666 100755 --- a/demo/northwind-traders/admin/clear-ontologies.sh +++ b/demo/northwind-traders/admin/clear-ontologies.sh @@ -17,9 +17,17 @@ else proxy="$base" fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + clear-ontology.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - -b "${base}admin/" \ - --proxy "$proxy" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ --ontology "${base}ns#" diff --git a/demo/northwind-traders/admin/model/add-imports.sh b/demo/northwind-traders/admin/model/add-imports.sh index ec52718..ff73042 100755 --- a/demo/northwind-traders/admin/model/add-imports.sh +++ b/demo/northwind-traders/admin/model/add-imports.sh @@ -7,6 +7,11 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file=$(realpath "$2") cert_password="$3" @@ -17,9 +22,12 @@ else proxy="$base" fi +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + add-ontology-import.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --import "https://schema.org/" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" diff --git a/demo/northwind-traders/admin/model/import-ontologies.sh b/demo/northwind-traders/admin/model/import-ontologies.sh index 8c16a5d..aa6830a 100755 --- a/demo/northwind-traders/admin/model/import-ontologies.sh +++ b/demo/northwind-traders/admin/model/import-ontologies.sh @@ -7,6 +7,11 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file=$(realpath "$2") cert_password="$3" @@ -17,25 +22,28 @@ else proxy="$base" fi +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + pwd=$(realpath "$PWD") printf "\n### Creating ontology item\n\n" -ont_doc=$(create-item.sh \ - -b "${base}admin/" \ +target=$(create-item.sh \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --title "Northwind Traders" \ --slug "northwind-traders" \ - --container "${base}admin/ontologies/" + --container "${admin_base}ontologies/" ) printf "\n### Appending ontology document\n\n" -cat "$pwd"/northwind-traders.ttl | turtle --base="$ont_doc" | post.sh \ +cat "$pwd"/northwind-traders.ttl | turtle --base="$target" | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ -t "application/n-triples" \ - "$ont_doc" + "$target" diff --git a/demo/northwind-traders/create-charts.sh b/demo/northwind-traders/create-charts.sh index e238993..8a45a9f 100755 --- a/demo/northwind-traders/create-charts.sh +++ b/demo/northwind-traders/create-charts.sh @@ -39,7 +39,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Products by sales" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/charts/select-products-by-sales.rq" \ "$query_doc" @@ -59,7 +59,7 @@ add-result-set-chart.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Top selling products" \ - --fragment this \ + --uri "#this" \ --query "${query_doc}#${query_id}" \ --chart-type "https://w3id.org/atomgraph/client#BarChart" \ --category-var-name "productName" \ @@ -86,7 +86,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Sales by region per year" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/charts/select-sales-by-regions-by-year.rq" \ "$query_doc" @@ -106,7 +106,7 @@ add-result-set-chart.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Sales by region per year" \ - --fragment this \ + --uri "#this" \ --query "${query_doc}#${query_id}" \ --chart-type "https://w3id.org/atomgraph/client#Table" \ --category-var-name "year" \ diff --git a/demo/northwind-traders/create-containers.sh b/demo/northwind-traders/create-containers.sh index e9b6a4f..65da35d 100755 --- a/demo/northwind-traders/create-containers.sh +++ b/demo/northwind-traders/create-containers.sh @@ -45,7 +45,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select categories" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-categories.rq" \ "$container" @@ -56,7 +56,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#GridMode" \ "$container" @@ -68,7 +68,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -98,7 +98,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select customers" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-customers.rq" \ "$container" @@ -109,7 +109,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -121,7 +121,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -151,7 +151,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select employees" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-employees.rq" \ "$container" @@ -162,7 +162,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#GridMode" \ "$container" @@ -174,7 +174,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -204,7 +204,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select orders" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-orders.rq" \ "$container" @@ -215,7 +215,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -227,7 +227,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -257,7 +257,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select products" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-products.rq" \ "$container" @@ -268,7 +268,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -280,7 +280,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -310,7 +310,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select regions" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-regions.rq" \ "$container" @@ -321,7 +321,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -332,7 +332,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -362,7 +362,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select shippers" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-shippers.rq" \ "$container" @@ -373,7 +373,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -384,7 +384,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -414,7 +414,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select suppliers" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-suppliers.rq" \ "$container" @@ -425,7 +425,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -437,7 +437,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -467,7 +467,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select territories" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-territories.rq" \ "$container" @@ -478,7 +478,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -490,7 +490,6 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" diff --git a/demo/skos/admin/acl/create-authorizations.sh b/demo/skos/admin/acl/create-authorizations.sh index f7773f3..0c75b68 100755 --- a/demo/skos/admin/acl/create-authorizations.sh +++ b/demo/skos/admin/acl/create-authorizations.sh @@ -7,6 +7,11 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file=$(realpath "$2") cert_password="$3" @@ -17,25 +22,28 @@ else proxy="$base" fi +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + pwd=$(realpath "$PWD") sha1sum=$(sha1sum "$pwd"/../../files/skos.xsl | cut -d ' ' -f 1) create-authorization.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --label "Public SKOS XSLT stylesheet" \ --agent-class http://xmlns.com/foaf/0.1/Agent \ --to "${base}uploads/${sha1sum}/" \ --read create-authorization.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --label "Read access to graph items" \ --agent-class "http://www.w3.org/ns/auth/acl#AuthenticatedAgent" \ --to-all-in "https://www.w3.org/ns/ldt/document-hierarchy#Item" \ diff --git a/demo/skos/admin/clear-ontologies.sh b/demo/skos/admin/clear-ontologies.sh index 04f0ef8..e090341 100755 --- a/demo/skos/admin/clear-ontologies.sh +++ b/demo/skos/admin/clear-ontologies.sh @@ -2,11 +2,16 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/admin/ ../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 + echo "Example: $0" 'https://localhost:4443/ ../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 echo "Note: special characters such as $ need to be escaped in passwords!" >&2 exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file="$(realpath $2)" cert_password="$3" @@ -17,9 +22,12 @@ else proxy="$base" fi +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + clear-ontology.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - -b "${base}admin/" \ - --proxy "$proxy" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ --ontology "${base}ns#" diff --git a/demo/skos/admin/model/add-constraints.sh b/demo/skos/admin/model/add-constraints.sh index 1817060..2d28631 100755 --- a/demo/skos/admin/model/add-constraints.sh +++ b/demo/skos/admin/model/add-constraints.sh @@ -7,6 +7,11 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file=$(realpath "$2") cert_password="$3" @@ -17,12 +22,15 @@ else proxy="$base" fi +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + add-property-constraint.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#MissingPrefLabel" \ --label "Missing skos:prefLabel" \ --property "http://www.w3.org/2004/02/skos/core#prefLabel" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" diff --git a/demo/skos/admin/model/collection-template.ttl b/demo/skos/admin/model/collection-template.ttl index 9954f41..d358cde 100644 --- a/demo/skos/admin/model/collection-template.ttl +++ b/demo/skos/admin/model/collection-template.ttl @@ -1,4 +1,5 @@ @prefix : <#> . +@prefix ns: . @prefix ldh: . @prefix rdfs: . @prefix sp: . @@ -6,14 +7,14 @@ @prefix dct: . @prefix skos: . -skos:Collection ldh:template <../../../ns#CollectionMembers>. +skos:Collection ldh:template ns:CollectionMembers. -<../../../ns#CollectionMembers> a ldh:View ; +ns:CollectionMembers a ldh:View ; dct:title "Collection members" ; - spin:query <../../../ns#SelectCollectionMembers> ; - rdfs:isDefinedBy <../../../ns#> . + spin:query ns:SelectCollectionMembers ; + rdfs:isDefinedBy ns: . -<../../../ns#SelectCollectionMembers> a sp:Select ; +ns:SelectCollectionMembers a sp:Select ; rdfs:label "Select collection members" ; sp:text """ PREFIX skos: @@ -31,4 +32,4 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy <../../../ns#> . + rdfs:isDefinedBy ns: . diff --git a/demo/skos/admin/model/concept-scheme-template.ttl b/demo/skos/admin/model/concept-scheme-template.ttl index 286a49b..92507ef 100644 --- a/demo/skos/admin/model/concept-scheme-template.ttl +++ b/demo/skos/admin/model/concept-scheme-template.ttl @@ -1,4 +1,5 @@ @prefix : <#> . +@prefix ns: . @prefix ldh: . @prefix rdfs: . @prefix sp: . @@ -6,14 +7,14 @@ @prefix dct: . @prefix skos: . -skos:ConceptScheme ldh:template <../../../ns#ConceptsInScheme>. +skos:ConceptScheme ldh:template ns:ConceptsInScheme. -<../../../ns#ConceptsInScheme> a ldh:View ; +ns:ConceptsInScheme a ldh:View ; dct:title "Concepts in scheme" ; - spin:query <../../../ns#SelectConceptsInScheme> ; - rdfs:isDefinedBy <../../../ns#> . + spin:query ns:SelectConceptsInScheme ; + rdfs:isDefinedBy ns: . -<../../../ns#SelectConceptsInScheme> a sp:Select ; +ns:SelectConceptsInScheme a sp:Select ; rdfs:label "Select concepts in scheme" ; sp:text """ PREFIX skos: @@ -28,4 +29,4 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy <../../../ns#> . + rdfs:isDefinedBy ns: . diff --git a/demo/skos/admin/model/concept-template.ttl b/demo/skos/admin/model/concept-template.ttl index 28f576a..f94b5c7 100644 --- a/demo/skos/admin/model/concept-template.ttl +++ b/demo/skos/admin/model/concept-template.ttl @@ -1,4 +1,5 @@ @prefix : <#> . +@prefix ns: . @prefix ldh: . @prefix rdfs: . @prefix sp: . @@ -8,14 +9,14 @@ # narrower -skos:Concept ldh:template <../../../ns#NarrowerConcepts>. +skos:Concept ldh:template ns:NarrowerConcepts. -<../../../ns#NarrowerConcepts> a ldh:View ; +ns:NarrowerConcepts a ldh:View ; dct:title "Narrower concepts" ; - spin:query <../../../ns#SelectNarrowerConcepts> ; - rdfs:isDefinedBy <../../../ns#> . + spin:query ns:SelectNarrowerConcepts ; + rdfs:isDefinedBy ns: . -<../../../ns#SelectNarrowerConcepts> a sp:Select ; +ns:SelectNarrowerConcepts a sp:Select ; rdfs:label "Select narrower concepts" ; sp:text """ PREFIX skos: @@ -33,18 +34,18 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy <../../../ns#> . + rdfs:isDefinedBy ns: . # broader -skos:Concept ldh:template <../../../ns#BroaderConcepts>. +skos:Concept ldh:template ns:BroaderConcepts. -<../../../ns#BroaderConcepts> a ldh:View ; +ns:BroaderConcepts a ldh:View ; dct:title "Broader concepts" ; - spin:query <../../../ns#SelectBroaderConcepts> ; - rdfs:isDefinedBy <../../../ns#> . + spin:query ns:SelectBroaderConcepts ; + rdfs:isDefinedBy ns: . -<../../../ns#SelectBroaderConcepts> a sp:Select ; +ns:SelectBroaderConcepts a sp:Select ; rdfs:label "Select broader concepts" ; sp:text """ PREFIX skos: @@ -62,5 +63,5 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy <../../../ns#> . + rdfs:isDefinedBy ns: . diff --git a/demo/skos/admin/model/import-ontologies.sh b/demo/skos/admin/model/import-ontologies.sh index e9ea9d9..13761d0 100755 --- a/demo/skos/admin/model/import-ontologies.sh +++ b/demo/skos/admin/model/import-ontologies.sh @@ -7,6 +7,11 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file=$(realpath "$2") cert_password="$3" @@ -17,27 +22,30 @@ else proxy="$base" fi -skos_doc=$(create-item.sh \ - -b "${base}admin/" \ +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + +target=$(create-item.sh \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --title "SKOS" \ --slug "skos" \ - --container "${base}admin/ontologies/" + --container "${admin_base}ontologies/" ) import-ontology.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --source "http://www.w3.org/2004/02/skos/core" \ - --graph "$skos_doc" + --graph "$target" add-ontology-import.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --import "http://www.w3.org/2004/02/skos/core" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" diff --git a/demo/skos/admin/model/post-class-templates.sh b/demo/skos/admin/model/post-class-templates.sh index 3a3b33d..b641a45 100755 --- a/demo/skos/admin/model/post-class-templates.sh +++ b/demo/skos/admin/model/post-class-templates.sh @@ -17,33 +17,45 @@ else proxy="$base" fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + # clear the old contents of the namespace ontology -{ echo "BASE <${base}admin/ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ +{ echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ - "${base}admin/ontologies/namespace/" + --proxy "$admin_proxy" \ + "${admin_base}ontologies/namespace/" # append the new class templates to the namespace ontology +# prepend @base directive using end-user base URI so that the ns: prefix +# (defined as in the templates) resolves to the end-user namespace +# (e.g. https://swib.localhost:4443/ns#) instead of the admin namespace +# (e.g. https://admin.swib.localhost:4443/ns#) -cat concept-template.ttl | post.sh \ +{ echo "@base <${base}> ."; cat concept-template.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --content-type "text/turtle" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" -cat collection-template.ttl | post.sh \ +{ echo "@base <${base}> ."; cat collection-template.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --content-type "text/turtle" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" -cat concept-scheme-template.ttl | post.sh \ +{ echo "@base <${base}> ."; cat concept-scheme-template.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --content-type "text/turtle" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" diff --git a/demo/skos/create-containers.sh b/demo/skos/create-containers.sh index 2b42c60..865e653 100755 --- a/demo/skos/create-containers.sh +++ b/demo/skos/create-containers.sh @@ -45,7 +45,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select concepts" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/select-concepts.rq" \ "$container" @@ -56,21 +56,25 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" object_id="select-concepts" +echo "AAAA" + add-object-block.sh \ -b "$base" \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" +echo "BBB" + # collections container=$(create-container.sh \ @@ -97,7 +101,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select collections" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/select-collections.rq" \ "$container" @@ -108,7 +112,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -119,7 +123,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -149,7 +153,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select concept schemes" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/select-concept-schemes.rq" \ "$container" @@ -160,7 +164,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -171,6 +175,6 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" diff --git a/demo/skos/files/skos.xsl b/demo/skos/files/skos.xsl index 8c50e9f..bea9ee2 100644 --- a/demo/skos/files/skos.xsl +++ b/demo/skos/files/skos.xsl @@ -56,6 +56,6 @@ exclude-result-prefixes="#all"> - + \ No newline at end of file From 31225b9050a9aa3644ec0624535b549cc2d29a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Fri, 28 Nov 2025 16:32:18 +0100 Subject: [PATCH 03/14] Northwind Traders class templates --- .../admin/model/corporation-template.ttl | 54 +++++++++++++++ .../admin/model/northwind-traders.ttl | 15 ---- .../admin/model/patch-ontology.ru | 19 ++++++ .../admin/model/person-template.ttl | 31 +++++++++ .../admin/model/place-template.ttl | 31 +++++++++ .../admin/model/post-class-templates.sh | 68 +++++++++++++++++++ .../admin/model/product-template.ttl | 33 +++++++++ demo/northwind-traders/install.sh | 4 ++ 8 files changed, 240 insertions(+), 15 deletions(-) create mode 100644 demo/northwind-traders/admin/model/corporation-template.ttl create mode 100644 demo/northwind-traders/admin/model/patch-ontology.ru create mode 100644 demo/northwind-traders/admin/model/person-template.ttl create mode 100644 demo/northwind-traders/admin/model/place-template.ttl create mode 100755 demo/northwind-traders/admin/model/post-class-templates.sh create mode 100644 demo/northwind-traders/admin/model/product-template.ttl diff --git a/demo/northwind-traders/admin/model/corporation-template.ttl b/demo/northwind-traders/admin/model/corporation-template.ttl new file mode 100644 index 0000000..e99dbb1 --- /dev/null +++ b/demo/northwind-traders/admin/model/corporation-template.ttl @@ -0,0 +1,54 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix schema: . + +# orders from this customer + +schema:Corporation ldh:template ns:OrdersFromCustomer . + +ns:OrdersFromCustomer a ldh:View ; + dct:title "Orders from this customer" ; + spin:query ns:SelectOrdersFromCustomer ; + rdfs:isDefinedBy ns: . + +ns:SelectOrdersFromCustomer a sp:Select ; + rdfs:label "Select orders from customer" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:customer $about } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy ns: . + +# products supplied by this supplier + +schema:Corporation ldh:template ns:ProductsFromSupplier . + +ns:ProductsFromSupplier a ldh:View ; + dct:title "Products supplied by this supplier" ; + spin:query ns:SelectProductsFromSupplier ; + rdfs:isDefinedBy ns: . + +ns:SelectProductsFromSupplier a sp:Select ; + rdfs:label "Select products from supplier" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?product +WHERE + { GRAPH ?graph + { ?product schema:provider $about } + } +ORDER BY ?product +""" ; + rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/northwind-traders.ttl b/demo/northwind-traders/admin/model/northwind-traders.ttl index 406177b..18e4d5f 100644 --- a/demo/northwind-traders/admin/model/northwind-traders.ttl +++ b/demo/northwind-traders/admin/model/northwind-traders.ttl @@ -61,18 +61,3 @@ owl:minCardinality 1 ; owl:maxCardinality 1 ; rdfs:isDefinedBy : . - -# blocks - -@prefix ldh: . -@prefix sp: . -@prefix spin: . - -:Person ldh:template <#content-76b5d972-86e8-424b-83fb-d0d7abe3bb75> . - -<#content-76b5d972-86e8-424b-83fb-d0d7abe3bb75> a ldh:View ; - rdfs:label "Orders handled by this employee" ; - spin:query <#query-53e279eb-3c8c-42bd-8a81-fea183d2be01> . - -<#query-53e279eb-3c8c-42bd-8a81-fea183d2be01> a sp:Select ; - sp:text "SELECT DISTINCT ?instance { GRAPH ?g { ?instance $this } }" . \ No newline at end of file diff --git a/demo/northwind-traders/admin/model/patch-ontology.ru b/demo/northwind-traders/admin/model/patch-ontology.ru new file mode 100644 index 0000000..efa41e4 --- /dev/null +++ b/demo/northwind-traders/admin/model/patch-ontology.ru @@ -0,0 +1,19 @@ +PREFIX foaf: + +DELETE { + ?s ?p ?o +} +WHERE { + ?s ?p ?o + # Exclude triples about the main resource itself + MINUS { + <> ?p ?o + BIND(<> AS ?s) + } + # Exclude triples about the foaf:primaryTopic resource + MINUS { + <> foaf:primaryTopic ?primaryTopic . + ?primaryTopic ?p ?o + BIND(?primaryTopic AS ?s) + } +} diff --git a/demo/northwind-traders/admin/model/person-template.ttl b/demo/northwind-traders/admin/model/person-template.ttl new file mode 100644 index 0000000..6300015 --- /dev/null +++ b/demo/northwind-traders/admin/model/person-template.ttl @@ -0,0 +1,31 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix schema: . + +# orders handled by this employee + +schema:Person ldh:template ns:OrdersHandledByEmployee . + +ns:OrdersHandledByEmployee a ldh:View ; + dct:title "Orders handled by this employee" ; + spin:query ns:SelectOrdersHandledByEmployee ; + rdfs:isDefinedBy ns: . + +ns:SelectOrdersHandledByEmployee a sp:Select ; + rdfs:label "Select orders handled by employee" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:broker $about } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/place-template.ttl b/demo/northwind-traders/admin/model/place-template.ttl new file mode 100644 index 0000000..9398f06 --- /dev/null +++ b/demo/northwind-traders/admin/model/place-template.ttl @@ -0,0 +1,31 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix schema: . + +# cities in this region + +schema:Place ldh:template ns:CitiesInRegion . + +ns:CitiesInRegion a ldh:View ; + dct:title "Cities in this region" ; + spin:query ns:SelectCitiesInRegion ; + rdfs:isDefinedBy ns: . + +ns:SelectCitiesInRegion a sp:Select ; + rdfs:label "Select cities in region" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?city +WHERE + { GRAPH ?graph + { ?city schema:containedInPlace $about } + } +ORDER BY ?city +""" ; + rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/post-class-templates.sh b/demo/northwind-traders/admin/model/post-class-templates.sh new file mode 100755 index 0000000..3cb66d5 --- /dev/null +++ b/demo/northwind-traders/admin/model/post-class-templates.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then + echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 + echo "Example: $0" 'https://localhost:4443/demo/northwind-traders/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 + echo "Note: special characters such as $ need to be escaped in passwords!" >&2 + exit 1 +fi + +base="$1" +cert_pem_file=$(realpath "$2") +cert_password="$3" + +if [ -n "$4" ]; then + proxy="$4" +else + proxy="$base" +fi + +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + +# clear the old contents of the namespace ontology + +{ echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + "${admin_base}ontologies/namespace/" + +# append the new class templates to the namespace ontology +# prepend @base directive using end-user base URI so that the ns: prefix +# (defined as in the templates) resolves to the end-user namespace +# (e.g. https://northwind-traders.localhost:4443/ns#) instead of the admin namespace +# (e.g. https://admin.northwind-traders.localhost:4443/ns#) + +{ echo "@base <${base}> ."; cat person-template.ttl; } | post.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --content-type "text/turtle" \ + "${admin_base}ontologies/namespace/" + +{ echo "@base <${base}> ."; cat corporation-template.ttl; } | post.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --content-type "text/turtle" \ + "${admin_base}ontologies/namespace/" + +{ echo "@base <${base}> ."; cat place-template.ttl; } | post.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --content-type "text/turtle" \ + "${admin_base}ontologies/namespace/" + +{ echo "@base <${base}> ."; cat product-template.ttl; } | post.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --content-type "text/turtle" \ + "${admin_base}ontologies/namespace/" diff --git a/demo/northwind-traders/admin/model/product-template.ttl b/demo/northwind-traders/admin/model/product-template.ttl new file mode 100644 index 0000000..7914c18 --- /dev/null +++ b/demo/northwind-traders/admin/model/product-template.ttl @@ -0,0 +1,33 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix schema: . + +# orders containing this product + +schema:Product ldh:template ns:OrdersContainingProduct . + +ns:OrdersContainingProduct a ldh:View ; + dct:title "Orders containing this product" ; + spin:query ns:SelectOrdersContainingProduct ; + rdfs:isDefinedBy ns: . + +ns:SelectOrdersContainingProduct a sp:Select ; + rdfs:label "Select orders containing product" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:orderedItem ?orderItem . + ?orderItem schema:orderedItem $about + } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/install.sh b/demo/northwind-traders/install.sh index 3f369ca..e7fee21 100755 --- a/demo/northwind-traders/install.sh +++ b/demo/northwind-traders/install.sh @@ -33,6 +33,10 @@ printf "\n### Adding ontology import\n\n" ./add-imports.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" +printf "\n### Creating block templates\n\n" + +./post-class-templates.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" + printf "\n### Clearing ontologies\n\n" cd .. From 41f6f49168cbe43e9ffa70c6fe29659aa71395a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Sun, 30 Nov 2025 11:11:51 +0100 Subject: [PATCH 04/14] Extracted SKOS as LinkedDataHub package --- .../admin/model/corporation-template.ttl | 54 ---- .../admin/model/import-ontologies.sh | 12 +- .../admin/model/northwind-traders.ttl | 63 ----- demo/northwind-traders/admin/model/ns.ttl | 193 +++++++++++++++ .../admin/model/person-template.ttl | 31 --- .../admin/model/place-template.ttl | 31 --- .../{post-class-templates.sh => post-ns.sh} | 25 +- .../admin/model/product-template.ttl | 33 --- demo/northwind-traders/install.sh | 2 +- demo/skos/admin/acl/create-authorizations.sh | 4 +- demo/skos/admin/model/collection-template.ttl | 35 --- .../admin/model/concept-scheme-template.ttl | 32 --- .../model/{concept-template.ttl => ns.ttl} | 58 ++++- .../{post-class-templates.sh => post-ns.sh} | 18 +- demo/skos/files/{skos.xsl => layout.xsl} | 0 demo/skos/install.sh | 2 +- packages/README.md | 233 ++++++++++++++++++ packages/skos/layout.xsl | 61 +++++ packages/skos/ns.ttl | 123 +++++++++ packages/skos/package.ttl | 19 ++ 20 files changed, 695 insertions(+), 334 deletions(-) delete mode 100644 demo/northwind-traders/admin/model/corporation-template.ttl delete mode 100644 demo/northwind-traders/admin/model/northwind-traders.ttl create mode 100644 demo/northwind-traders/admin/model/ns.ttl delete mode 100644 demo/northwind-traders/admin/model/person-template.ttl delete mode 100644 demo/northwind-traders/admin/model/place-template.ttl rename demo/northwind-traders/admin/model/{post-class-templates.sh => post-ns.sh} (62%) delete mode 100644 demo/northwind-traders/admin/model/product-template.ttl delete mode 100644 demo/skos/admin/model/collection-template.ttl delete mode 100644 demo/skos/admin/model/concept-scheme-template.ttl rename demo/skos/admin/model/{concept-template.ttl => ns.ttl} (54%) rename demo/skos/admin/model/{post-class-templates.sh => post-ns.sh} (68%) rename demo/skos/files/{skos.xsl => layout.xsl} (100%) create mode 100644 packages/README.md create mode 100644 packages/skos/layout.xsl create mode 100644 packages/skos/ns.ttl create mode 100644 packages/skos/package.ttl diff --git a/demo/northwind-traders/admin/model/corporation-template.ttl b/demo/northwind-traders/admin/model/corporation-template.ttl deleted file mode 100644 index e99dbb1..0000000 --- a/demo/northwind-traders/admin/model/corporation-template.ttl +++ /dev/null @@ -1,54 +0,0 @@ -@prefix : <#> . -@prefix ns: . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix schema: . - -# orders from this customer - -schema:Corporation ldh:template ns:OrdersFromCustomer . - -ns:OrdersFromCustomer a ldh:View ; - dct:title "Orders from this customer" ; - spin:query ns:SelectOrdersFromCustomer ; - rdfs:isDefinedBy ns: . - -ns:SelectOrdersFromCustomer a sp:Select ; - rdfs:label "Select orders from customer" ; - sp:text """ -PREFIX schema: - -SELECT DISTINCT ?order -WHERE - { GRAPH ?graph - { ?order schema:customer $about } - } -ORDER BY DESC(?order) -""" ; - rdfs:isDefinedBy ns: . - -# products supplied by this supplier - -schema:Corporation ldh:template ns:ProductsFromSupplier . - -ns:ProductsFromSupplier a ldh:View ; - dct:title "Products supplied by this supplier" ; - spin:query ns:SelectProductsFromSupplier ; - rdfs:isDefinedBy ns: . - -ns:SelectProductsFromSupplier a sp:Select ; - rdfs:label "Select products from supplier" ; - sp:text """ -PREFIX schema: - -SELECT DISTINCT ?product -WHERE - { GRAPH ?graph - { ?product schema:provider $about } - } -ORDER BY ?product -""" ; - rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/import-ontologies.sh b/demo/northwind-traders/admin/model/import-ontologies.sh index aa6830a..e21b395 100755 --- a/demo/northwind-traders/admin/model/import-ontologies.sh +++ b/demo/northwind-traders/admin/model/import-ontologies.sh @@ -29,7 +29,7 @@ pwd=$(realpath "$PWD") printf "\n### Creating ontology item\n\n" -target=$(create-item.sh \ +create-item.sh \ -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ @@ -37,13 +37,3 @@ target=$(create-item.sh \ --title "Northwind Traders" \ --slug "northwind-traders" \ --container "${admin_base}ontologies/" -) - -printf "\n### Appending ontology document\n\n" - -cat "$pwd"/northwind-traders.ttl | turtle --base="$target" | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - -t "application/n-triples" \ - "$target" diff --git a/demo/northwind-traders/admin/model/northwind-traders.ttl b/demo/northwind-traders/admin/model/northwind-traders.ttl deleted file mode 100644 index 18e4d5f..0000000 --- a/demo/northwind-traders/admin/model/northwind-traders.ttl +++ /dev/null @@ -1,63 +0,0 @@ -@prefix : . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix owl: . -@prefix dh: . -@prefix sioc: . -@prefix foaf: . -@prefix dct: . - -: a owl:Ontology . - -# classes - -:Person a owl:Class ; - rdfs:label "Person" ; - rdfs:isDefinedBy : . - -:Order a owl:Class ; - rdfs:label "Order" ; - rdfs:isDefinedBy : . - -:City a owl:Class ; - rdfs:label "City" ; - rdfs:isDefinedBy : . - -:PostalAddress a owl:Class ; - rdfs:label "Postal address" ; - rdfs:isDefinedBy : . - -# properties - -:broker a owl:ObjectProperty ; - rdfs:label "Broker"; - rdfs:domain :Order ; - rdfs:range :Person ; - rdfs:isDefinedBy : . - -:areaServed a owl:ObjectProperty ; - rdfs:label "Area served"; - rdfs:domain :Person ; - rdfs:range :City ; - rdfs:isDefinedBy : . - -:address a owl:ObjectProperty ; - rdfs:label "Address"; - rdfs:domain :Person ; - rdfs:range :PostalAddress ; - rdfs:isDefinedBy : . - -# restrictions - -[] a owl:Restriction ; - owl:onProperty :broker ; - owl:minCardinality 1 ; - owl:maxCardinality 1 ; - rdfs:isDefinedBy : . - -[] a owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality 1 ; - owl:maxCardinality 1 ; - rdfs:isDefinedBy : . diff --git a/demo/northwind-traders/admin/model/ns.ttl b/demo/northwind-traders/admin/model/ns.ttl new file mode 100644 index 0000000..5f6bf12 --- /dev/null +++ b/demo/northwind-traders/admin/model/ns.ttl @@ -0,0 +1,193 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix rdf: . +@prefix xsd: . +@prefix owl: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix dh: . +@prefix sioc: . +@prefix foaf: . +@prefix schema: . + +ns: a owl:Ontology . + +# classes + +schema:Person a owl:Class ; + rdfs:label "Person" ; + rdfs:isDefinedBy ns: . + +schema:Order a owl:Class ; + rdfs:label "Order" ; + rdfs:isDefinedBy ns: . + +schema:City a owl:Class ; + rdfs:label "City" ; + rdfs:isDefinedBy ns: . + +schema:PostalAddress a owl:Class ; + rdfs:label "Postal address" ; + rdfs:isDefinedBy ns: . + +# properties + +schema:broker a owl:ObjectProperty ; + rdfs:label "Broker"; + rdfs:domain schema:Order ; + rdfs:range schema:Person ; + rdfs:isDefinedBy ns: . + +schema:areaServed a owl:ObjectProperty ; + rdfs:label "Area served"; + rdfs:domain schema:Person ; + rdfs:range schema:City ; + rdfs:isDefinedBy ns: . + +schema:address a owl:ObjectProperty ; + rdfs:label "Address"; + rdfs:domain schema:Person ; + rdfs:range schema:PostalAddress ; + rdfs:isDefinedBy ns: . + +# restrictions + +[] a owl:Restriction ; + owl:onProperty schema:broker ; + owl:minCardinality 1 ; + owl:maxCardinality 1 ; + rdfs:isDefinedBy ns: . + +[] a owl:Restriction ; + owl:onProperty schema:address ; + owl:minCardinality 1 ; + owl:maxCardinality 1 ; + rdfs:isDefinedBy ns: . + +# Person + +# orders handled by this employee + +schema:Person ldh:template ns:OrdersHandledByEmployee . + +ns:OrdersHandledByEmployee a ldh:View ; + dct:title "Orders handled by this employee" ; + spin:query ns:SelectOrdersHandledByEmployee ; + rdfs:isDefinedBy ns: . + +ns:SelectOrdersHandledByEmployee a sp:Select ; + rdfs:label "Select orders handled by employee" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:broker $about } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy ns: . + +# Corporation + +# orders from this customer + +schema:Corporation ldh:template ns:OrdersFromCustomer . + +ns:OrdersFromCustomer a ldh:View ; + dct:title "Orders from this customer" ; + spin:query ns:SelectOrdersFromCustomer ; + rdfs:isDefinedBy ns: . + +ns:SelectOrdersFromCustomer a sp:Select ; + rdfs:label "Select orders from customer" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:customer $about } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy ns: . + +# products supplied by this supplier + +schema:Corporation ldh:template ns:ProductsFromSupplier . + +ns:ProductsFromSupplier a ldh:View ; + dct:title "Products supplied by this supplier" ; + spin:query ns:SelectProductsFromSupplier ; + rdfs:isDefinedBy ns: . + +ns:SelectProductsFromSupplier a sp:Select ; + rdfs:label "Select products from supplier" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?product +WHERE + { GRAPH ?graph + { ?product schema:provider $about } + } +ORDER BY ?product +""" ; + rdfs:isDefinedBy ns: . + +# Place + +# cities in this region + +schema:Place ldh:template ns:CitiesInRegion . + +ns:CitiesInRegion a ldh:View ; + dct:title "Cities in this region" ; + spin:query ns:SelectCitiesInRegion ; + rdfs:isDefinedBy ns: . + +ns:SelectCitiesInRegion a sp:Select ; + rdfs:label "Select cities in region" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?city +WHERE + { GRAPH ?graph + { ?city schema:containedInPlace $about } + } +ORDER BY ?city +""" ; + rdfs:isDefinedBy ns: . + +# Product + +# orders containing this product + +schema:Product ldh:template ns:OrdersContainingProduct . + +ns:OrdersContainingProduct a ldh:View ; + dct:title "Orders containing this product" ; + spin:query ns:SelectOrdersContainingProduct ; + rdfs:isDefinedBy ns: . + +ns:SelectOrdersContainingProduct a sp:Select ; + rdfs:label "Select orders containing product" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:orderedItem ?orderItem . + ?orderItem schema:orderedItem $about + } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/person-template.ttl b/demo/northwind-traders/admin/model/person-template.ttl deleted file mode 100644 index 6300015..0000000 --- a/demo/northwind-traders/admin/model/person-template.ttl +++ /dev/null @@ -1,31 +0,0 @@ -@prefix : <#> . -@prefix ns: . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix schema: . - -# orders handled by this employee - -schema:Person ldh:template ns:OrdersHandledByEmployee . - -ns:OrdersHandledByEmployee a ldh:View ; - dct:title "Orders handled by this employee" ; - spin:query ns:SelectOrdersHandledByEmployee ; - rdfs:isDefinedBy ns: . - -ns:SelectOrdersHandledByEmployee a sp:Select ; - rdfs:label "Select orders handled by employee" ; - sp:text """ -PREFIX schema: - -SELECT DISTINCT ?order -WHERE - { GRAPH ?graph - { ?order schema:broker $about } - } -ORDER BY DESC(?order) -""" ; - rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/place-template.ttl b/demo/northwind-traders/admin/model/place-template.ttl deleted file mode 100644 index 9398f06..0000000 --- a/demo/northwind-traders/admin/model/place-template.ttl +++ /dev/null @@ -1,31 +0,0 @@ -@prefix : <#> . -@prefix ns: . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix schema: . - -# cities in this region - -schema:Place ldh:template ns:CitiesInRegion . - -ns:CitiesInRegion a ldh:View ; - dct:title "Cities in this region" ; - spin:query ns:SelectCitiesInRegion ; - rdfs:isDefinedBy ns: . - -ns:SelectCitiesInRegion a sp:Select ; - rdfs:label "Select cities in region" ; - sp:text """ -PREFIX schema: - -SELECT DISTINCT ?city -WHERE - { GRAPH ?graph - { ?city schema:containedInPlace $about } - } -ORDER BY ?city -""" ; - rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/admin/model/post-class-templates.sh b/demo/northwind-traders/admin/model/post-ns.sh similarity index 62% rename from demo/northwind-traders/admin/model/post-class-templates.sh rename to demo/northwind-traders/admin/model/post-ns.sh index 3cb66d5..83d7603 100755 --- a/demo/northwind-traders/admin/model/post-class-templates.sh +++ b/demo/northwind-traders/admin/model/post-ns.sh @@ -35,32 +35,11 @@ admin_proxy=$(admin_uri "$proxy") # append the new class templates to the namespace ontology # prepend @base directive using end-user base URI so that the ns: prefix -# (defined as in the templates) resolves to the end-user namespace +# (defined as in ns.ttl) resolves to the end-user namespace # (e.g. https://northwind-traders.localhost:4443/ns#) instead of the admin namespace # (e.g. https://admin.northwind-traders.localhost:4443/ns#) -{ echo "@base <${base}> ."; cat person-template.ttl; } | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --content-type "text/turtle" \ - "${admin_base}ontologies/namespace/" - -{ echo "@base <${base}> ."; cat corporation-template.ttl; } | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --content-type "text/turtle" \ - "${admin_base}ontologies/namespace/" - -{ echo "@base <${base}> ."; cat place-template.ttl; } | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --content-type "text/turtle" \ - "${admin_base}ontologies/namespace/" - -{ echo "@base <${base}> ."; cat product-template.ttl; } | post.sh \ +{ echo "@base <${base}> ."; cat ns.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$admin_proxy" \ diff --git a/demo/northwind-traders/admin/model/product-template.ttl b/demo/northwind-traders/admin/model/product-template.ttl deleted file mode 100644 index 7914c18..0000000 --- a/demo/northwind-traders/admin/model/product-template.ttl +++ /dev/null @@ -1,33 +0,0 @@ -@prefix : <#> . -@prefix ns: . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix schema: . - -# orders containing this product - -schema:Product ldh:template ns:OrdersContainingProduct . - -ns:OrdersContainingProduct a ldh:View ; - dct:title "Orders containing this product" ; - spin:query ns:SelectOrdersContainingProduct ; - rdfs:isDefinedBy ns: . - -ns:SelectOrdersContainingProduct a sp:Select ; - rdfs:label "Select orders containing product" ; - sp:text """ -PREFIX schema: - -SELECT DISTINCT ?order -WHERE - { GRAPH ?graph - { ?order schema:orderedItem ?orderItem . - ?orderItem schema:orderedItem $about - } - } -ORDER BY DESC(?order) -""" ; - rdfs:isDefinedBy ns: . diff --git a/demo/northwind-traders/install.sh b/demo/northwind-traders/install.sh index e7fee21..6539c58 100755 --- a/demo/northwind-traders/install.sh +++ b/demo/northwind-traders/install.sh @@ -35,7 +35,7 @@ printf "\n### Adding ontology import\n\n" printf "\n### Creating block templates\n\n" -./post-class-templates.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" +./post-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" printf "\n### Clearing ontologies\n\n" diff --git a/demo/skos/admin/acl/create-authorizations.sh b/demo/skos/admin/acl/create-authorizations.sh index 0c75b68..bee09a0 100755 --- a/demo/skos/admin/acl/create-authorizations.sh +++ b/demo/skos/admin/acl/create-authorizations.sh @@ -27,14 +27,14 @@ admin_proxy=$(admin_uri "$proxy") pwd=$(realpath "$PWD") -sha1sum=$(sha1sum "$pwd"/../../files/skos.xsl | cut -d ' ' -f 1) +sha1sum=$(sha1sum "$pwd"/../../files/layout.xsl | cut -d ' ' -f 1) create-authorization.sh \ -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$admin_proxy" \ - --label "Public SKOS XSLT stylesheet" \ + --label "Public layout XSLT stylesheet" \ --agent-class http://xmlns.com/foaf/0.1/Agent \ --to "${base}uploads/${sha1sum}/" \ --read diff --git a/demo/skos/admin/model/collection-template.ttl b/demo/skos/admin/model/collection-template.ttl deleted file mode 100644 index d358cde..0000000 --- a/demo/skos/admin/model/collection-template.ttl +++ /dev/null @@ -1,35 +0,0 @@ -@prefix : <#> . -@prefix ns: . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix skos: . - -skos:Collection ldh:template ns:CollectionMembers. - -ns:CollectionMembers a ldh:View ; - dct:title "Collection members" ; - spin:query ns:SelectCollectionMembers ; - rdfs:isDefinedBy ns: . - -ns:SelectCollectionMembers a sp:Select ; - rdfs:label "Select collection members" ; - sp:text """ -PREFIX skos: - -SELECT DISTINCT ?member -WHERE - { GRAPH ?graph - { $about skos:member ?member . - GRAPH ?memberGraph - { - ?member skos:prefLabel ?prefLabel . - FILTER (langMatches(lang(?prefLabel), "en")) - } - } - } -ORDER BY ?prefLabel -""" ; - rdfs:isDefinedBy ns: . diff --git a/demo/skos/admin/model/concept-scheme-template.ttl b/demo/skos/admin/model/concept-scheme-template.ttl deleted file mode 100644 index 92507ef..0000000 --- a/demo/skos/admin/model/concept-scheme-template.ttl +++ /dev/null @@ -1,32 +0,0 @@ -@prefix : <#> . -@prefix ns: . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix skos: . - -skos:ConceptScheme ldh:template ns:ConceptsInScheme. - -ns:ConceptsInScheme a ldh:View ; - dct:title "Concepts in scheme" ; - spin:query ns:SelectConceptsInScheme ; - rdfs:isDefinedBy ns: . - -ns:SelectConceptsInScheme a sp:Select ; - rdfs:label "Select concepts in scheme" ; - sp:text """ -PREFIX skos: - -SELECT DISTINCT ?concept -WHERE - { GRAPH ?graph - { ?concept skos:inScheme $about ; - skos:prefLabel ?prefLabel . - FILTER (langMatches(lang(?prefLabel), "en")) - } - } -ORDER BY ?prefLabel -""" ; - rdfs:isDefinedBy ns: . diff --git a/demo/skos/admin/model/concept-template.ttl b/demo/skos/admin/model/ns.ttl similarity index 54% rename from demo/skos/admin/model/concept-template.ttl rename to demo/skos/admin/model/ns.ttl index f94b5c7..60bf737 100644 --- a/demo/skos/admin/model/concept-template.ttl +++ b/demo/skos/admin/model/ns.ttl @@ -2,11 +2,13 @@ @prefix ns: . @prefix ldh: . @prefix rdfs: . -@prefix sp: . +@prefix sp: . @prefix spin: . @prefix dct: . @prefix skos: . +# Concept + # narrower skos:Concept ldh:template ns:NarrowerConcepts. @@ -65,3 +67,57 @@ ORDER BY ?prefLabel """ ; rdfs:isDefinedBy ns: . +# Collection + +skos:Collection ldh:template ns:CollectionMembers. + +ns:CollectionMembers a ldh:View ; + dct:title "Collection members" ; + spin:query ns:SelectCollectionMembers ; + rdfs:isDefinedBy ns: . + +ns:SelectCollectionMembers a sp:Select ; + rdfs:label "Select collection members" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?member +WHERE + { GRAPH ?graph + { $about skos:member ?member . + GRAPH ?memberGraph + { + ?member skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# ConceptScheme + +skos:ConceptScheme ldh:template ns:ConceptsInScheme. + +ns:ConceptsInScheme a ldh:View ; + dct:title "Concepts in scheme" ; + spin:query ns:SelectConceptsInScheme ; + rdfs:isDefinedBy ns: . + +ns:SelectConceptsInScheme a sp:Select ; + rdfs:label "Select concepts in scheme" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?concept +WHERE + { GRAPH ?graph + { ?concept skos:inScheme $about ; + skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . diff --git a/demo/skos/admin/model/post-class-templates.sh b/demo/skos/admin/model/post-ns.sh similarity index 68% rename from demo/skos/admin/model/post-class-templates.sh rename to demo/skos/admin/model/post-ns.sh index b641a45..10bbaf2 100755 --- a/demo/skos/admin/model/post-class-templates.sh +++ b/demo/skos/admin/model/post-ns.sh @@ -35,25 +35,11 @@ admin_proxy=$(admin_uri "$proxy") # append the new class templates to the namespace ontology # prepend @base directive using end-user base URI so that the ns: prefix -# (defined as in the templates) resolves to the end-user namespace +# (defined as in ns.ttl) resolves to the end-user namespace # (e.g. https://swib.localhost:4443/ns#) instead of the admin namespace # (e.g. https://admin.swib.localhost:4443/ns#) -{ echo "@base <${base}> ."; cat concept-template.ttl; } | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --content-type "text/turtle" \ - "${admin_base}ontologies/namespace/" - -{ echo "@base <${base}> ."; cat collection-template.ttl; } | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --content-type "text/turtle" \ - "${admin_base}ontologies/namespace/" - -{ echo "@base <${base}> ."; cat concept-scheme-template.ttl; } | post.sh \ +{ echo "@base <${base}> ."; cat ns.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$admin_proxy" \ diff --git a/demo/skos/files/skos.xsl b/demo/skos/files/layout.xsl similarity index 100% rename from demo/skos/files/skos.xsl rename to demo/skos/files/layout.xsl diff --git a/demo/skos/install.sh b/demo/skos/install.sh index 5af00eb..0b1db3c 100755 --- a/demo/skos/install.sh +++ b/demo/skos/install.sh @@ -43,7 +43,7 @@ printf "\n### Creating constraints\n\n" printf "\n### Creating block templates\n\n" -./post-class-templates.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" +./post-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" cd .. diff --git a/packages/README.md b/packages/README.md new file mode 100644 index 0000000..8d43117 --- /dev/null +++ b/packages/README.md @@ -0,0 +1,233 @@ +# LinkedDataHub Packages + +This directory contains reusable packages for LinkedDataHub dataspaces. Packages provide vocabulary support with custom ontologies and XSLT templates for rendering specific RDF vocabularies. + +## Package Structure + +Each package consists of: + +``` +packages// +├── package.ttl # Package metadata (ldhp:Package resource) +├── ns.ttl # Ontology with template blocks (ldh:template) +└── layout.xsl # XSLT stylesheet with custom templates +``` + +### Example: SKOS Package + +``` +packages/skos/ +├── package.ttl # Metadata: https://packages.linkeddatahub.com/skos/#this +├── ns.ttl # SKOS vocabulary with ldh:template blocks +└── layout.xsl # XSLT templates for SKOS concepts, schemes, collections +``` + +## How Packages Work + +### 1. Package Metadata (`package.ttl`) + +Describes the package using standard LinkedDataHub properties: + +```turtle +@prefix ldhp: . +@prefix ldt: . +@prefix ac: . + + a ldhp:Package ; + rdfs:label "SKOS Package" ; + dct:description "SKOS vocabulary support with custom templates" ; + ldt:ontology ; + ac:stylesheet . +``` + +**Note**: Uses standard `ldt:ontology` and `ac:stylesheet` properties instead of inventing new ones. + +### 2. Ontology (`ns.ttl`) + +Contains two layers: + +**A. RDF Vocabulary Classes and Properties** +```turtle +skos:Concept a owl:Class ; + rdfs:label "Concept" . + +skos:narrower a owl:ObjectProperty ; + rdfs:label "has narrower" . +``` + +**B. Template Blocks (ldh:template)** + +SPARQL-based views attached to RDF types: + +```turtle +skos:Concept ldh:template ns:NarrowerConcepts . + +ns:NarrowerConcepts a ldh:View ; + dct:title "Narrower concepts" ; + spin:query ns:SelectNarrowerConcepts . + +ns:SelectNarrowerConcepts a sp:Select ; + sp:text """ + SELECT DISTINCT ?narrower + WHERE { GRAPH ?graph { $about skos:narrower ?narrower } } + ORDER BY ?narrower + """ . +``` + +### 3. XSLT Stylesheet (`layout.xsl`) + +XSLT templates using `bs2:*` modes to override default rendering: + +```xsl + + + + + + + +``` + +## Installing Packages + +### Method 1: CLI Script + +```bash +install-package.sh \ + -b https://localhost:4443/ \ + -f ssl/owner/cert.pem \ + -p Password \ + --package https://packages.linkeddatahub.com/skos/#this +``` + +### Method 2: From Application Install Script + +```bash +# In LinkedDataHub-Apps/demo/skos/install.sh +install-package.sh \ + -b "$base" \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --package "https://packages.linkeddatahub.com/skos/#this" +``` + +## Prerequisites + +Before installing packages, a **master stylesheet** must exist at `/static//layout.xsl` in the webapp directory. A default template is provided at: + +``` +src/main/webapp/static/localhost/layout.xsl +``` + +This file should be deployed with the application. It contains: + +```xml + + + + + + + + + +``` + +## What Installation Does + +When you install a package, the system: + +1. **Fetches package metadata** from the package URI +2. **Downloads package ontology** (`ns.ttl`) and POSTs it to the namespace graph (`${admin_base}ontologies/namespace/`) +3. **Downloads package stylesheet** (`layout.xsl`) and saves it to `/static/packages//layout.xsl` +4. **Updates master stylesheet** at `/static//layout.xsl` by adding import: + ```xml + + + ``` +5. **Adds import to application** (currently manual): ` ldh:import ` + +**Note**: The master stylesheet must already exist or installation will fail with `InternalServerErrorException`. + +## Architecture + +### Installation-Time vs Runtime + +Packages use **installation-time composition**, NOT runtime composition: + +- ✅ Package content is integrated during installation (via JAX-RS endpoints) +- ✅ Ontology and XSLT are pre-composed before being loaded +- ✅ No runtime overhead +- ❌ No dynamic package loading at request time + +### JAX-RS Endpoints + +- **POST `/admin/install-package`** - Installs a package + - Parameter: `packageUri` (form-urlencoded) + - Requires admin authentication + +- **POST `/admin/uninstall-package`** - Uninstalls a package + - Parameter: `packageUri` (form-urlencoded) + - Requires admin authentication + +### File System Structure + +After installation: + +``` +webapp/ +├── static/ +│ ├── packages/ +│ │ └── skos/ +│ │ └── layout.xsl # Package stylesheet +│ └── localhost/ +│ └── layout.xsl # Generated master stylesheet +``` + +### SPARQL Data Structure + +```turtle +# In system.trig (application config) + a lapp:Application ; + ldt:ontology ; + ac:stylesheet ; # Master stylesheet + ldh:import . + +# In admin SPARQL endpoint (namespace graph) +# Contains merged package ontologies via owl:imports +``` + +## Available Packages + +- **skos** - SKOS vocabulary support (concepts, schemes, collections) + +## Creating New Packages + +1. Create directory: `packages//` +2. Write `package.ttl` with metadata +3. Write `ns.ttl` with vocabulary and template blocks +4. Write `layout.xsl` with XSLT templates (using `bs2:*` modes) +5. Publish as Linked Data at `https://packages.linkeddatahub.com//#this` + +## Vocabulary Reference + +### LDHP Vocabulary (`https://w3id.org/atomgraph/linkeddatahub/package#`) + +- `ldhp:Package` - Package class + +### Standard Properties (Reused) + +- `ldt:ontology` - Points to package ontology URI (from LDT vocabulary) +- `ac:stylesheet` - Points to package stylesheet URI (from AtomGraph Client vocabulary) +- `ldh:import` - Application property linking to imported packages (from LDH vocabulary) + +## Notes + +- Packages are **declarative only** (RDF + XSLT, no Java code) +- Package ontologies use `owl:imports` (handled automatically by Jena) +- Package stylesheets use `xsl:import` (handled by master stylesheet generation) +- Template blocks (`ldh:template`) are separate from XSLT overrides +- Both mechanisms work independently and complement each other diff --git a/packages/skos/layout.xsl b/packages/skos/layout.xsl new file mode 100644 index 0000000..bea9ee2 --- /dev/null +++ b/packages/skos/layout.xsl @@ -0,0 +1,61 @@ + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/skos/ns.ttl b/packages/skos/ns.ttl new file mode 100644 index 0000000..60bf737 --- /dev/null +++ b/packages/skos/ns.ttl @@ -0,0 +1,123 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix skos: . + +# Concept + +# narrower + +skos:Concept ldh:template ns:NarrowerConcepts. + +ns:NarrowerConcepts a ldh:View ; + dct:title "Narrower concepts" ; + spin:query ns:SelectNarrowerConcepts ; + rdfs:isDefinedBy ns: . + +ns:SelectNarrowerConcepts a sp:Select ; + rdfs:label "Select narrower concepts" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?narrower +WHERE + { GRAPH ?graph + { $about skos:narrower ?narrower . + GRAPH ?narrowerGraph + { + ?narrower skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# broader + +skos:Concept ldh:template ns:BroaderConcepts. + +ns:BroaderConcepts a ldh:View ; + dct:title "Broader concepts" ; + spin:query ns:SelectBroaderConcepts ; + rdfs:isDefinedBy ns: . + +ns:SelectBroaderConcepts a sp:Select ; + rdfs:label "Select broader concepts" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?broader +WHERE + { GRAPH ?graph + { $about skos:broader ?broader . + GRAPH ?broaderGraph + { + ?broader skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# Collection + +skos:Collection ldh:template ns:CollectionMembers. + +ns:CollectionMembers a ldh:View ; + dct:title "Collection members" ; + spin:query ns:SelectCollectionMembers ; + rdfs:isDefinedBy ns: . + +ns:SelectCollectionMembers a sp:Select ; + rdfs:label "Select collection members" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?member +WHERE + { GRAPH ?graph + { $about skos:member ?member . + GRAPH ?memberGraph + { + ?member skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# ConceptScheme + +skos:ConceptScheme ldh:template ns:ConceptsInScheme. + +ns:ConceptsInScheme a ldh:View ; + dct:title "Concepts in scheme" ; + spin:query ns:SelectConceptsInScheme ; + rdfs:isDefinedBy ns: . + +ns:SelectConceptsInScheme a sp:Select ; + rdfs:label "Select concepts in scheme" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?concept +WHERE + { GRAPH ?graph + { ?concept skos:inScheme $about ; + skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . diff --git a/packages/skos/package.ttl b/packages/skos/package.ttl new file mode 100644 index 0000000..2fee9d7 --- /dev/null +++ b/packages/skos/package.ttl @@ -0,0 +1,19 @@ +@prefix : <#> . +@prefix lapp: . +@prefix ldt: . +@prefix ac: . +@prefix rdfs: . +@prefix dct: . +@prefix foaf: . + + a lapp:Package ; + rdfs:label "SKOS Package" ; + dct:title "SKOS Package for LinkedDataHub" ; + dct:description "Provides SKOS (Simple Knowledge Organization System) vocabulary support with custom templates for concept hierarchies, schemes, and collections." ; + dct:creator ; + ldt:ontology ; + ac:stylesheet . + + a foaf:Organization ; + foaf:name "AtomGraph" ; + foaf:homepage . From cdd584061bc226d05c9effb6ab94d979f6be9b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Wed, 3 Dec 2025 13:35:49 +0100 Subject: [PATCH 05/14] Renamed SKOS app to Unesco Thesaurus --- demo/{skos => unesco-thesaurus}/Makefile | 0 .../admin/acl/create-authorizations.sh | 0 .../admin/clear-ontologies.sh | 0 .../admin/model/add-constraints.sh | 0 .../admin/model/import-ontologies.sh | 0 demo/{skos => unesco-thesaurus}/admin/model/ns.ttl | 0 .../admin/model/patch-ontology.ru | 0 .../admin/model/post-ns.sh | 0 .../{skos => unesco-thesaurus}/create-containers.sh | 0 .../files/bootstrap.min.css | 0 demo/{skos => unesco-thesaurus}/files/layout.xsl | 0 .../files/unesco-thesaurus.ttl | 0 demo/{skos => unesco-thesaurus}/import-rdf.sh | 0 demo/{skos => unesco-thesaurus}/install.sh | 0 .../queries/select-collections.rq | 0 .../queries/select-concept-schemes.rq | 0 .../queries/select-concepts.rq | 0 .../queries/skos-import.rq | 0 demo/{skos => unesco-thesaurus}/root.ttl | 0 .../screenshot-edit-mode.png | Bin demo/{skos => unesco-thesaurus}/screenshot.png | Bin demo/{skos => unesco-thesaurus}/update-documents.sh | 0 demo/{skos => unesco-thesaurus}/upload-file.sh | 0 .../validate-documents.sh | 0 24 files changed, 0 insertions(+), 0 deletions(-) rename demo/{skos => unesco-thesaurus}/Makefile (100%) rename demo/{skos => unesco-thesaurus}/admin/acl/create-authorizations.sh (100%) rename demo/{skos => unesco-thesaurus}/admin/clear-ontologies.sh (100%) rename demo/{skos => unesco-thesaurus}/admin/model/add-constraints.sh (100%) rename demo/{skos => unesco-thesaurus}/admin/model/import-ontologies.sh (100%) rename demo/{skos => unesco-thesaurus}/admin/model/ns.ttl (100%) rename demo/{skos => unesco-thesaurus}/admin/model/patch-ontology.ru (100%) rename demo/{skos => unesco-thesaurus}/admin/model/post-ns.sh (100%) rename demo/{skos => unesco-thesaurus}/create-containers.sh (100%) rename demo/{skos => unesco-thesaurus}/files/bootstrap.min.css (100%) rename demo/{skos => unesco-thesaurus}/files/layout.xsl (100%) rename demo/{skos => unesco-thesaurus}/files/unesco-thesaurus.ttl (100%) rename demo/{skos => unesco-thesaurus}/import-rdf.sh (100%) rename demo/{skos => unesco-thesaurus}/install.sh (100%) rename demo/{skos => unesco-thesaurus}/queries/select-collections.rq (100%) rename demo/{skos => unesco-thesaurus}/queries/select-concept-schemes.rq (100%) rename demo/{skos => unesco-thesaurus}/queries/select-concepts.rq (100%) rename demo/{skos => unesco-thesaurus}/queries/skos-import.rq (100%) rename demo/{skos => unesco-thesaurus}/root.ttl (100%) rename demo/{skos => unesco-thesaurus}/screenshot-edit-mode.png (100%) rename demo/{skos => unesco-thesaurus}/screenshot.png (100%) rename demo/{skos => unesco-thesaurus}/update-documents.sh (100%) rename demo/{skos => unesco-thesaurus}/upload-file.sh (100%) rename demo/{skos => unesco-thesaurus}/validate-documents.sh (100%) diff --git a/demo/skos/Makefile b/demo/unesco-thesaurus/Makefile similarity index 100% rename from demo/skos/Makefile rename to demo/unesco-thesaurus/Makefile diff --git a/demo/skos/admin/acl/create-authorizations.sh b/demo/unesco-thesaurus/admin/acl/create-authorizations.sh similarity index 100% rename from demo/skos/admin/acl/create-authorizations.sh rename to demo/unesco-thesaurus/admin/acl/create-authorizations.sh diff --git a/demo/skos/admin/clear-ontologies.sh b/demo/unesco-thesaurus/admin/clear-ontologies.sh similarity index 100% rename from demo/skos/admin/clear-ontologies.sh rename to demo/unesco-thesaurus/admin/clear-ontologies.sh diff --git a/demo/skos/admin/model/add-constraints.sh b/demo/unesco-thesaurus/admin/model/add-constraints.sh similarity index 100% rename from demo/skos/admin/model/add-constraints.sh rename to demo/unesco-thesaurus/admin/model/add-constraints.sh diff --git a/demo/skos/admin/model/import-ontologies.sh b/demo/unesco-thesaurus/admin/model/import-ontologies.sh similarity index 100% rename from demo/skos/admin/model/import-ontologies.sh rename to demo/unesco-thesaurus/admin/model/import-ontologies.sh diff --git a/demo/skos/admin/model/ns.ttl b/demo/unesco-thesaurus/admin/model/ns.ttl similarity index 100% rename from demo/skos/admin/model/ns.ttl rename to demo/unesco-thesaurus/admin/model/ns.ttl diff --git a/demo/skos/admin/model/patch-ontology.ru b/demo/unesco-thesaurus/admin/model/patch-ontology.ru similarity index 100% rename from demo/skos/admin/model/patch-ontology.ru rename to demo/unesco-thesaurus/admin/model/patch-ontology.ru diff --git a/demo/skos/admin/model/post-ns.sh b/demo/unesco-thesaurus/admin/model/post-ns.sh similarity index 100% rename from demo/skos/admin/model/post-ns.sh rename to demo/unesco-thesaurus/admin/model/post-ns.sh diff --git a/demo/skos/create-containers.sh b/demo/unesco-thesaurus/create-containers.sh similarity index 100% rename from demo/skos/create-containers.sh rename to demo/unesco-thesaurus/create-containers.sh diff --git a/demo/skos/files/bootstrap.min.css b/demo/unesco-thesaurus/files/bootstrap.min.css similarity index 100% rename from demo/skos/files/bootstrap.min.css rename to demo/unesco-thesaurus/files/bootstrap.min.css diff --git a/demo/skos/files/layout.xsl b/demo/unesco-thesaurus/files/layout.xsl similarity index 100% rename from demo/skos/files/layout.xsl rename to demo/unesco-thesaurus/files/layout.xsl diff --git a/demo/skos/files/unesco-thesaurus.ttl b/demo/unesco-thesaurus/files/unesco-thesaurus.ttl similarity index 100% rename from demo/skos/files/unesco-thesaurus.ttl rename to demo/unesco-thesaurus/files/unesco-thesaurus.ttl diff --git a/demo/skos/import-rdf.sh b/demo/unesco-thesaurus/import-rdf.sh similarity index 100% rename from demo/skos/import-rdf.sh rename to demo/unesco-thesaurus/import-rdf.sh diff --git a/demo/skos/install.sh b/demo/unesco-thesaurus/install.sh similarity index 100% rename from demo/skos/install.sh rename to demo/unesco-thesaurus/install.sh diff --git a/demo/skos/queries/select-collections.rq b/demo/unesco-thesaurus/queries/select-collections.rq similarity index 100% rename from demo/skos/queries/select-collections.rq rename to demo/unesco-thesaurus/queries/select-collections.rq diff --git a/demo/skos/queries/select-concept-schemes.rq b/demo/unesco-thesaurus/queries/select-concept-schemes.rq similarity index 100% rename from demo/skos/queries/select-concept-schemes.rq rename to demo/unesco-thesaurus/queries/select-concept-schemes.rq diff --git a/demo/skos/queries/select-concepts.rq b/demo/unesco-thesaurus/queries/select-concepts.rq similarity index 100% rename from demo/skos/queries/select-concepts.rq rename to demo/unesco-thesaurus/queries/select-concepts.rq diff --git a/demo/skos/queries/skos-import.rq b/demo/unesco-thesaurus/queries/skos-import.rq similarity index 100% rename from demo/skos/queries/skos-import.rq rename to demo/unesco-thesaurus/queries/skos-import.rq diff --git a/demo/skos/root.ttl b/demo/unesco-thesaurus/root.ttl similarity index 100% rename from demo/skos/root.ttl rename to demo/unesco-thesaurus/root.ttl diff --git a/demo/skos/screenshot-edit-mode.png b/demo/unesco-thesaurus/screenshot-edit-mode.png similarity index 100% rename from demo/skos/screenshot-edit-mode.png rename to demo/unesco-thesaurus/screenshot-edit-mode.png diff --git a/demo/skos/screenshot.png b/demo/unesco-thesaurus/screenshot.png similarity index 100% rename from demo/skos/screenshot.png rename to demo/unesco-thesaurus/screenshot.png diff --git a/demo/skos/update-documents.sh b/demo/unesco-thesaurus/update-documents.sh similarity index 100% rename from demo/skos/update-documents.sh rename to demo/unesco-thesaurus/update-documents.sh diff --git a/demo/skos/upload-file.sh b/demo/unesco-thesaurus/upload-file.sh similarity index 100% rename from demo/skos/upload-file.sh rename to demo/unesco-thesaurus/upload-file.sh diff --git a/demo/skos/validate-documents.sh b/demo/unesco-thesaurus/validate-documents.sh similarity index 100% rename from demo/skos/validate-documents.sh rename to demo/unesco-thesaurus/validate-documents.sh From c8aced80e714d23d9c3d1fa16887f837db65d88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Wed, 3 Dec 2025 16:13:12 +0100 Subject: [PATCH 06/14] Consolidated ontology import logic `demo/skos` renamed to `demo/northwind-traders` --- demo/{city-graph => copenhagen}/Makefile | 0 .../admin/clear-ontologies.sh | 0 .../admin/model/add-classes.sh | 0 .../create-charts.sh | 0 .../create-containers.sh | 33 ++----- .../files/copenhagen/bicycle-parkings.csv | 0 .../files/copenhagen/charging-stations.csv | 0 .../files/copenhagen/libraries.csv | 0 .../files/copenhagen/parking-facilities.csv | 0 .../files/copenhagen/places.csv | 0 .../files/copenhagen/playgrounds.csv | 0 .../files/copenhagen/public-toilets.csv | 0 .../files/copenhagen/schools.csv | 0 .../files/copenhagen/sports-centers.csv | 0 demo/{city-graph => copenhagen}/import-csv.sh | 0 demo/{city-graph => copenhagen}/imports.csv | 0 demo/{city-graph => copenhagen}/install.sh | 0 .../charts/parking-facilities-by-spaces.rq | 0 .../imports/copenhagen/bicycle-parkings.rq | 2 +- .../imports/copenhagen/charging-stations.rq | 2 +- .../queries/imports/copenhagen/libraries.rq | 2 +- .../imports/copenhagen/parking-facilities.rq | 2 +- .../queries/imports/copenhagen/places.rq | 2 +- .../queries/imports/copenhagen/playgrounds.rq | 2 +- .../imports/copenhagen/public-toilets.rq | 2 +- .../queries/imports/copenhagen/schools.rq | 2 +- .../imports/copenhagen/sports-centers.rq | 2 +- demo/{city-graph => copenhagen}/root.ttl | 0 .../{city-graph => copenhagen}/screenshot.png | Bin .../update-documents.sh | 0 .../admin/clear-ontologies.sh | 33 ------- .../admin/model/add-imports.sh | 33 ------- .../admin/model/{post-ns.sh => import-ns.sh} | 19 ++-- .../admin/model/import-ontologies.sh | 39 --------- demo/northwind-traders/admin/model/ns.ttl | 81 +++++++++--------- demo/northwind-traders/install.sh | 16 +--- .../admin/clear-ontologies.sh | 33 ------- .../admin/model/add-constraints.sh | 36 -------- .../admin/model/{post-ns.sh => import-ns.sh} | 39 +++++++-- .../admin/model/import-ontologies.sh | 51 ----------- demo/unesco-thesaurus/admin/model/ns.ttl | 63 ++++++++------ demo/unesco-thesaurus/install.sh | 16 +--- packages/skos/ns.ttl | 8 ++ 43 files changed, 153 insertions(+), 365 deletions(-) rename demo/{city-graph => copenhagen}/Makefile (100%) rename demo/{city-graph => copenhagen}/admin/clear-ontologies.sh (100%) rename demo/{city-graph => copenhagen}/admin/model/add-classes.sh (100%) rename demo/{city-graph => copenhagen}/create-charts.sh (100%) rename demo/{city-graph => copenhagen}/create-containers.sh (84%) rename demo/{city-graph => copenhagen}/files/copenhagen/bicycle-parkings.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/charging-stations.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/libraries.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/parking-facilities.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/places.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/playgrounds.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/public-toilets.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/schools.csv (100%) rename demo/{city-graph => copenhagen}/files/copenhagen/sports-centers.csv (100%) rename demo/{city-graph => copenhagen}/import-csv.sh (100%) rename demo/{city-graph => copenhagen}/imports.csv (100%) rename demo/{city-graph => copenhagen}/install.sh (100%) rename demo/{city-graph => copenhagen}/queries/charts/parking-facilities-by-spaces.rq (100%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/bicycle-parkings.rq (95%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/charging-stations.rq (95%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/libraries.rq (95%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/parking-facilities.rq (96%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/places.rq (94%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/playgrounds.rq (96%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/public-toilets.rq (95%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/schools.rq (95%) rename demo/{city-graph => copenhagen}/queries/imports/copenhagen/sports-centers.rq (95%) rename demo/{city-graph => copenhagen}/root.ttl (100%) rename demo/{city-graph => copenhagen}/screenshot.png (100%) rename demo/{city-graph => copenhagen}/update-documents.sh (100%) delete mode 100755 demo/northwind-traders/admin/clear-ontologies.sh delete mode 100755 demo/northwind-traders/admin/model/add-imports.sh rename demo/northwind-traders/admin/model/{post-ns.sh => import-ns.sh} (72%) delete mode 100755 demo/northwind-traders/admin/model/import-ontologies.sh delete mode 100755 demo/unesco-thesaurus/admin/clear-ontologies.sh delete mode 100755 demo/unesco-thesaurus/admin/model/add-constraints.sh rename demo/unesco-thesaurus/admin/model/{post-ns.sh => import-ns.sh} (55%) delete mode 100755 demo/unesco-thesaurus/admin/model/import-ontologies.sh diff --git a/demo/city-graph/Makefile b/demo/copenhagen/Makefile similarity index 100% rename from demo/city-graph/Makefile rename to demo/copenhagen/Makefile diff --git a/demo/city-graph/admin/clear-ontologies.sh b/demo/copenhagen/admin/clear-ontologies.sh similarity index 100% rename from demo/city-graph/admin/clear-ontologies.sh rename to demo/copenhagen/admin/clear-ontologies.sh diff --git a/demo/city-graph/admin/model/add-classes.sh b/demo/copenhagen/admin/model/add-classes.sh similarity index 100% rename from demo/city-graph/admin/model/add-classes.sh rename to demo/copenhagen/admin/model/add-classes.sh diff --git a/demo/city-graph/create-charts.sh b/demo/copenhagen/create-charts.sh similarity index 100% rename from demo/city-graph/create-charts.sh rename to demo/copenhagen/create-charts.sh diff --git a/demo/city-graph/create-containers.sh b/demo/copenhagen/create-containers.sh similarity index 84% rename from demo/city-graph/create-containers.sh rename to demo/copenhagen/create-containers.sh index 63d2e34..44ebf5b 100755 --- a/demo/city-graph/create-containers.sh +++ b/demo/copenhagen/create-containers.sh @@ -17,21 +17,6 @@ else proxy="$base" fi -parent=$( -create-container.sh \ - -b "$base" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --title "Copenhagen" \ - --slug "copenhagen" \ - --parent "$base" -) - -if [ -z "$parent" ]; then - exit 1 -fi - create-container.sh \ -b "$base" \ -f "$cert_pem_file" \ @@ -39,7 +24,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Places" \ --slug "places" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -49,7 +34,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Bicycle parkings" \ --slug "bicycle-parkings" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -59,7 +44,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Charging stations" \ --slug "charging-stations" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -69,7 +54,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Libraries" \ --slug "libraries" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -79,7 +64,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Parking facilities" \ --slug "parking-facilities" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -89,7 +74,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Playgrounds" \ --slug "playgrounds" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -99,7 +84,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Schools" \ --slug "schools" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -109,7 +94,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Sport centers" \ --slug "sports-centers" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -119,5 +104,5 @@ create-container.sh \ --proxy "$proxy" \ --title "Public toilets" \ --slug "public-toilets" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" diff --git a/demo/city-graph/files/copenhagen/bicycle-parkings.csv b/demo/copenhagen/files/copenhagen/bicycle-parkings.csv similarity index 100% rename from demo/city-graph/files/copenhagen/bicycle-parkings.csv rename to demo/copenhagen/files/copenhagen/bicycle-parkings.csv diff --git a/demo/city-graph/files/copenhagen/charging-stations.csv b/demo/copenhagen/files/copenhagen/charging-stations.csv similarity index 100% rename from demo/city-graph/files/copenhagen/charging-stations.csv rename to demo/copenhagen/files/copenhagen/charging-stations.csv diff --git a/demo/city-graph/files/copenhagen/libraries.csv b/demo/copenhagen/files/copenhagen/libraries.csv similarity index 100% rename from demo/city-graph/files/copenhagen/libraries.csv rename to demo/copenhagen/files/copenhagen/libraries.csv diff --git a/demo/city-graph/files/copenhagen/parking-facilities.csv b/demo/copenhagen/files/copenhagen/parking-facilities.csv similarity index 100% rename from demo/city-graph/files/copenhagen/parking-facilities.csv rename to demo/copenhagen/files/copenhagen/parking-facilities.csv diff --git a/demo/city-graph/files/copenhagen/places.csv b/demo/copenhagen/files/copenhagen/places.csv similarity index 100% rename from demo/city-graph/files/copenhagen/places.csv rename to demo/copenhagen/files/copenhagen/places.csv diff --git a/demo/city-graph/files/copenhagen/playgrounds.csv b/demo/copenhagen/files/copenhagen/playgrounds.csv similarity index 100% rename from demo/city-graph/files/copenhagen/playgrounds.csv rename to demo/copenhagen/files/copenhagen/playgrounds.csv diff --git a/demo/city-graph/files/copenhagen/public-toilets.csv b/demo/copenhagen/files/copenhagen/public-toilets.csv similarity index 100% rename from demo/city-graph/files/copenhagen/public-toilets.csv rename to demo/copenhagen/files/copenhagen/public-toilets.csv diff --git a/demo/city-graph/files/copenhagen/schools.csv b/demo/copenhagen/files/copenhagen/schools.csv similarity index 100% rename from demo/city-graph/files/copenhagen/schools.csv rename to demo/copenhagen/files/copenhagen/schools.csv diff --git a/demo/city-graph/files/copenhagen/sports-centers.csv b/demo/copenhagen/files/copenhagen/sports-centers.csv similarity index 100% rename from demo/city-graph/files/copenhagen/sports-centers.csv rename to demo/copenhagen/files/copenhagen/sports-centers.csv diff --git a/demo/city-graph/import-csv.sh b/demo/copenhagen/import-csv.sh similarity index 100% rename from demo/city-graph/import-csv.sh rename to demo/copenhagen/import-csv.sh diff --git a/demo/city-graph/imports.csv b/demo/copenhagen/imports.csv similarity index 100% rename from demo/city-graph/imports.csv rename to demo/copenhagen/imports.csv diff --git a/demo/city-graph/install.sh b/demo/copenhagen/install.sh similarity index 100% rename from demo/city-graph/install.sh rename to demo/copenhagen/install.sh diff --git a/demo/city-graph/queries/charts/parking-facilities-by-spaces.rq b/demo/copenhagen/queries/charts/parking-facilities-by-spaces.rq similarity index 100% rename from demo/city-graph/queries/charts/parking-facilities-by-spaces.rq rename to demo/copenhagen/queries/charts/parking-facilities-by-spaces.rq diff --git a/demo/city-graph/queries/imports/copenhagen/bicycle-parkings.rq b/demo/copenhagen/queries/imports/copenhagen/bicycle-parkings.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/bicycle-parkings.rq rename to demo/copenhagen/queries/imports/copenhagen/bicycle-parkings.rq index 2e6aa7a..2e9b01e 100644 --- a/demo/city-graph/queries/imports/copenhagen/bicycle-parkings.rq +++ b/demo/copenhagen/queries/imports/copenhagen/bicycle-parkings.rq @@ -44,7 +44,7 @@ WHERE OPTIONAL { ?bicyleParking_row <#antal_pladser> ?spaces } - BIND(uri(concat(str($base), "copenhagen/bicycle-parkings/")) AS ?container) + BIND(uri(concat(str($base), "bicycle-parkings/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?bicyleParking) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/charging-stations.rq b/demo/copenhagen/queries/imports/copenhagen/charging-stations.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/charging-stations.rq rename to demo/copenhagen/queries/imports/copenhagen/charging-stations.rq index f1b0bfa..cc5bcea 100644 --- a/demo/city-graph/queries/imports/copenhagen/charging-stations.rq +++ b/demo/copenhagen/queries/imports/copenhagen/charging-stations.rq @@ -49,7 +49,7 @@ WHERE OPTIONAL { ?charger_row <#bem> ?information } - BIND(uri(concat(str($base), "copenhagen/charging-stations/")) AS ?container) + BIND(uri(concat(str($base), "charging-stations/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?charger) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/libraries.rq b/demo/copenhagen/queries/imports/copenhagen/libraries.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/libraries.rq rename to demo/copenhagen/queries/imports/copenhagen/libraries.rq index 8ac07d4..cb16161 100644 --- a/demo/city-graph/queries/imports/copenhagen/libraries.rq +++ b/demo/copenhagen/queries/imports/copenhagen/libraries.rq @@ -51,7 +51,7 @@ WHERE BIND (URI(?linkString) AS ?link) } - BIND(uri(concat(str($base), "copenhagen/libraries/")) AS ?container) + BIND(uri(concat(str($base), "libraries/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?library) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/parking-facilities.rq b/demo/copenhagen/queries/imports/copenhagen/parking-facilities.rq similarity index 96% rename from demo/city-graph/queries/imports/copenhagen/parking-facilities.rq rename to demo/copenhagen/queries/imports/copenhagen/parking-facilities.rq index 5ae06ed..17fc371 100644 --- a/demo/city-graph/queries/imports/copenhagen/parking-facilities.rq +++ b/demo/copenhagen/queries/imports/copenhagen/parking-facilities.rq @@ -54,7 +54,7 @@ WHERE BIND ( AS ?owner) # Copenhagen Municipality } - BIND(uri(concat(str($base), "copenhagen/parking-facilities/")) AS ?container) + BIND(uri(concat(str($base), "parking-facilities/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?parking) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/places.rq b/demo/copenhagen/queries/imports/copenhagen/places.rq similarity index 94% rename from demo/city-graph/queries/imports/copenhagen/places.rq rename to demo/copenhagen/queries/imports/copenhagen/places.rq index b17dd8c..f218074 100644 --- a/demo/city-graph/queries/imports/copenhagen/places.rq +++ b/demo/copenhagen/queries/imports/copenhagen/places.rq @@ -36,7 +36,7 @@ WHERE OPTIONAL { ?place_row <#category> ?category_name } - BIND(uri(concat(str($base), "copenhagen/places/")) AS ?container) + BIND(uri(concat(str($base), "places/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?place) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/playgrounds.rq b/demo/copenhagen/queries/imports/copenhagen/playgrounds.rq similarity index 96% rename from demo/city-graph/queries/imports/copenhagen/playgrounds.rq rename to demo/copenhagen/queries/imports/copenhagen/playgrounds.rq index 628b35d..0bce09b 100644 --- a/demo/city-graph/queries/imports/copenhagen/playgrounds.rq +++ b/demo/copenhagen/queries/imports/copenhagen/playgrounds.rq @@ -50,7 +50,7 @@ WHERE { ?playground_row <#link> ?linkString BIND (URI(?linkString) AS ?link)} - BIND(uri(concat(str($base), "copenhagen/playgrounds/")) AS ?container) + BIND(uri(concat(str($base), "playgrounds/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?playground) BIND(xsd:float(?lat_string) AS ?lat) . diff --git a/demo/city-graph/queries/imports/copenhagen/public-toilets.rq b/demo/copenhagen/queries/imports/copenhagen/public-toilets.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/public-toilets.rq rename to demo/copenhagen/queries/imports/copenhagen/public-toilets.rq index 3d76d05..5d3639d 100644 --- a/demo/city-graph/queries/imports/copenhagen/public-toilets.rq +++ b/demo/copenhagen/queries/imports/copenhagen/public-toilets.rq @@ -46,7 +46,7 @@ WHERE OPTIONAL { ?toilet_row <#aabningstid_bemrk> ?comment } OPTIONAL { ?toilet_row <#opening_hours> ?openingHours } - BIND(uri(concat(str($base), "copenhagen/public-toilets/")) AS ?container) + BIND(uri(concat(str($base), "public-toilets/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?toilet) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/schools.rq b/demo/copenhagen/queries/imports/copenhagen/schools.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/schools.rq rename to demo/copenhagen/queries/imports/copenhagen/schools.rq index dad0b9b..2ef0e27 100644 --- a/demo/city-graph/queries/imports/copenhagen/schools.rq +++ b/demo/copenhagen/queries/imports/copenhagen/schools.rq @@ -48,7 +48,7 @@ WHERE BIND (URI(?linkString) AS ?link) } - BIND (uri(concat(str($base), "copenhagen/schools/")) AS ?container) + BIND (uri(concat(str($base), "schools/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?school) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/sports-centers.rq b/demo/copenhagen/queries/imports/copenhagen/sports-centers.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/sports-centers.rq rename to demo/copenhagen/queries/imports/copenhagen/sports-centers.rq index 65b469d..f4cca66 100644 --- a/demo/city-graph/queries/imports/copenhagen/sports-centers.rq +++ b/demo/copenhagen/queries/imports/copenhagen/sports-centers.rq @@ -46,7 +46,7 @@ WHERE BIND (URI(?linkString) AS ?link) } - BIND(uri(concat(str($base), "copenhagen/sports-centers/")) AS ?container) + BIND(uri(concat(str($base), "sports-centers/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?sportCenter) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/root.ttl b/demo/copenhagen/root.ttl similarity index 100% rename from demo/city-graph/root.ttl rename to demo/copenhagen/root.ttl diff --git a/demo/city-graph/screenshot.png b/demo/copenhagen/screenshot.png similarity index 100% rename from demo/city-graph/screenshot.png rename to demo/copenhagen/screenshot.png diff --git a/demo/city-graph/update-documents.sh b/demo/copenhagen/update-documents.sh similarity index 100% rename from demo/city-graph/update-documents.sh rename to demo/copenhagen/update-documents.sh diff --git a/demo/northwind-traders/admin/clear-ontologies.sh b/demo/northwind-traders/admin/clear-ontologies.sh deleted file mode 100755 index c25f666..0000000 --- a/demo/northwind-traders/admin/clear-ontologies.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/ ../../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file="$(realpath "$2")" -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -admin_uri() { - local uri="$1" - echo "$uri" | sed 's|://|://admin.|' -} - -admin_base=$(admin_uri "$base") -admin_proxy=$(admin_uri "$proxy") - -clear-ontology.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - -b "$admin_base" \ - --proxy "$admin_proxy" \ - --ontology "${base}ns#" diff --git a/demo/northwind-traders/admin/model/add-imports.sh b/demo/northwind-traders/admin/model/add-imports.sh deleted file mode 100755 index ff73042..0000000 --- a/demo/northwind-traders/admin/model/add-imports.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/demo/northwind-traders/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -admin_uri() { - local uri="$1" - echo "$uri" | sed 's|://|://admin.|' -} - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -admin_base=$(admin_uri "$base") -admin_proxy=$(admin_uri "$proxy") - -add-ontology-import.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --import "https://schema.org/" \ - "${admin_base}ontologies/namespace/" diff --git a/demo/northwind-traders/admin/model/post-ns.sh b/demo/northwind-traders/admin/model/import-ns.sh similarity index 72% rename from demo/northwind-traders/admin/model/post-ns.sh rename to demo/northwind-traders/admin/model/import-ns.sh index 83d7603..e90c29d 100755 --- a/demo/northwind-traders/admin/model/post-ns.sh +++ b/demo/northwind-traders/admin/model/import-ns.sh @@ -25,7 +25,7 @@ admin_uri() { admin_base=$(admin_uri "$base") admin_proxy=$(admin_uri "$proxy") -# clear the old contents of the namespace ontology +# clear the old properties of the namespace ontology { echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ -f "$cert_pem_file" \ @@ -33,15 +33,22 @@ admin_proxy=$(admin_uri "$proxy") --proxy "$admin_proxy" \ "${admin_base}ontologies/namespace/" -# append the new class templates to the namespace ontology -# prepend @base directive using end-user base URI so that the ns: prefix +# append the ns.ttl file to the namespace ontology +# prepend @base directive using end-user base URI so that the : prefix # (defined as in ns.ttl) resolves to the end-user namespace -# (e.g. https://northwind-traders.localhost:4443/ns#) instead of the admin namespace -# (e.g. https://admin.northwind-traders.localhost:4443/ns#) -{ echo "@base <${base}> ."; cat ns.ttl; } | post.sh \ +{ echo "@base <${base}ns> ."; cat ns.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$admin_proxy" \ --content-type "text/turtle" \ "${admin_base}ontologies/namespace/" + +# clear the namespace ontology from memory + +clear-ontology.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ + --ontology "${base}ns#" diff --git a/demo/northwind-traders/admin/model/import-ontologies.sh b/demo/northwind-traders/admin/model/import-ontologies.sh deleted file mode 100755 index e21b395..0000000 --- a/demo/northwind-traders/admin/model/import-ontologies.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/demo/northwind-traders/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -admin_uri() { - local uri="$1" - echo "$uri" | sed 's|://|://admin.|' -} - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -admin_base=$(admin_uri "$base") -admin_proxy=$(admin_uri "$proxy") - -pwd=$(realpath "$PWD") - -printf "\n### Creating ontology item\n\n" - -create-item.sh \ - -b "$admin_base" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --title "Northwind Traders" \ - --slug "northwind-traders" \ - --container "${admin_base}ontologies/" diff --git a/demo/northwind-traders/admin/model/ns.ttl b/demo/northwind-traders/admin/model/ns.ttl index 5f6bf12..1dfe81c 100644 --- a/demo/northwind-traders/admin/model/ns.ttl +++ b/demo/northwind-traders/admin/model/ns.ttl @@ -1,5 +1,4 @@ @prefix : <#> . -@prefix ns: . @prefix ldh: . @prefix rdfs: . @prefix rdf: . @@ -13,25 +12,25 @@ @prefix foaf: . @prefix schema: . -ns: a owl:Ontology . +: a owl:Ontology . # classes schema:Person a owl:Class ; rdfs:label "Person" ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . schema:Order a owl:Class ; rdfs:label "Order" ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . schema:City a owl:Class ; rdfs:label "City" ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . schema:PostalAddress a owl:Class ; rdfs:label "Postal address" ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # properties @@ -39,19 +38,19 @@ schema:broker a owl:ObjectProperty ; rdfs:label "Broker"; rdfs:domain schema:Order ; rdfs:range schema:Person ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . schema:areaServed a owl:ObjectProperty ; rdfs:label "Area served"; rdfs:domain schema:Person ; rdfs:range schema:City ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . schema:address a owl:ObjectProperty ; rdfs:label "Address"; rdfs:domain schema:Person ; rdfs:range schema:PostalAddress ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # restrictions @@ -59,26 +58,26 @@ schema:address a owl:ObjectProperty ; owl:onProperty schema:broker ; owl:minCardinality 1 ; owl:maxCardinality 1 ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . [] a owl:Restriction ; owl:onProperty schema:address ; owl:minCardinality 1 ; owl:maxCardinality 1 ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # Person # orders handled by this employee -schema:Person ldh:template ns:OrdersHandledByEmployee . +schema:Person ldh:template :OrdersHandledByEmployee . -ns:OrdersHandledByEmployee a ldh:View ; +:OrdersHandledByEmployee a ldh:View ; dct:title "Orders handled by this employee" ; - spin:query ns:SelectOrdersHandledByEmployee ; - rdfs:isDefinedBy ns: . + spin:query :SelectOrdersHandledByEmployee ; + rdfs:isDefinedBy : . -ns:SelectOrdersHandledByEmployee a sp:Select ; +:SelectOrdersHandledByEmployee a sp:Select ; rdfs:label "Select orders handled by employee" ; sp:text """ PREFIX schema: @@ -90,20 +89,20 @@ WHERE } ORDER BY DESC(?order) """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # Corporation # orders from this customer -schema:Corporation ldh:template ns:OrdersFromCustomer . +schema:Corporation ldh:template :OrdersFromCustomer . -ns:OrdersFromCustomer a ldh:View ; +:OrdersFromCustomer a ldh:View ; dct:title "Orders from this customer" ; - spin:query ns:SelectOrdersFromCustomer ; - rdfs:isDefinedBy ns: . + spin:query :SelectOrdersFromCustomer ; + rdfs:isDefinedBy : . -ns:SelectOrdersFromCustomer a sp:Select ; +:SelectOrdersFromCustomer a sp:Select ; rdfs:label "Select orders from customer" ; sp:text """ PREFIX schema: @@ -115,18 +114,18 @@ WHERE } ORDER BY DESC(?order) """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # products supplied by this supplier -schema:Corporation ldh:template ns:ProductsFromSupplier . +schema:Corporation ldh:template :ProductsFromSupplier . -ns:ProductsFromSupplier a ldh:View ; +:ProductsFromSupplier a ldh:View ; dct:title "Products supplied by this supplier" ; - spin:query ns:SelectProductsFromSupplier ; - rdfs:isDefinedBy ns: . + spin:query :SelectProductsFromSupplier ; + rdfs:isDefinedBy : . -ns:SelectProductsFromSupplier a sp:Select ; +:SelectProductsFromSupplier a sp:Select ; rdfs:label "Select products from supplier" ; sp:text """ PREFIX schema: @@ -138,20 +137,20 @@ WHERE } ORDER BY ?product """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # Place # cities in this region -schema:Place ldh:template ns:CitiesInRegion . +schema:Place ldh:template :CitiesInRegion . -ns:CitiesInRegion a ldh:View ; +:CitiesInRegion a ldh:View ; dct:title "Cities in this region" ; - spin:query ns:SelectCitiesInRegion ; - rdfs:isDefinedBy ns: . + spin:query :SelectCitiesInRegion ; + rdfs:isDefinedBy : . -ns:SelectCitiesInRegion a sp:Select ; +:SelectCitiesInRegion a sp:Select ; rdfs:label "Select cities in region" ; sp:text """ PREFIX schema: @@ -163,20 +162,20 @@ WHERE } ORDER BY ?city """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # Product # orders containing this product -schema:Product ldh:template ns:OrdersContainingProduct . +schema:Product ldh:template :OrdersContainingProduct . -ns:OrdersContainingProduct a ldh:View ; +:OrdersContainingProduct a ldh:View ; dct:title "Orders containing this product" ; - spin:query ns:SelectOrdersContainingProduct ; - rdfs:isDefinedBy ns: . + spin:query :SelectOrdersContainingProduct ; + rdfs:isDefinedBy : . -ns:SelectOrdersContainingProduct a sp:Select ; +:SelectOrdersContainingProduct a sp:Select ; rdfs:label "Select orders containing product" ; sp:text """ PREFIX schema: @@ -190,4 +189,4 @@ WHERE } ORDER BY DESC(?order) """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . diff --git a/demo/northwind-traders/install.sh b/demo/northwind-traders/install.sh index 6539c58..6794a5c 100755 --- a/demo/northwind-traders/install.sh +++ b/demo/northwind-traders/install.sh @@ -25,24 +25,12 @@ make-public.sh -b "$base" -f "$cert_pem_file" -p "$cert_password" --proxy "$prox cd admin/model -printf "\n### Import ontologies\n\n" +printf "\n### Importing namespace ontology\n\n" -./import-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Adding ontology import\n\n" - -./add-imports.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Creating block templates\n\n" - -./post-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Clearing ontologies\n\n" +./import-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" cd .. -./clear-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - cd .. printf "\n### Creating containers\n\n" diff --git a/demo/unesco-thesaurus/admin/clear-ontologies.sh b/demo/unesco-thesaurus/admin/clear-ontologies.sh deleted file mode 100755 index e090341..0000000 --- a/demo/unesco-thesaurus/admin/clear-ontologies.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/ ../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -admin_uri() { - local uri="$1" - echo "$uri" | sed 's|://|://admin.|' -} - -base="$1" -cert_pem_file="$(realpath $2)" -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -admin_base=$(admin_uri "$base") -admin_proxy=$(admin_uri "$proxy") - -clear-ontology.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - -b "$admin_base" \ - --proxy "$admin_proxy" \ - --ontology "${base}ns#" diff --git a/demo/unesco-thesaurus/admin/model/add-constraints.sh b/demo/unesco-thesaurus/admin/model/add-constraints.sh deleted file mode 100755 index 2d28631..0000000 --- a/demo/unesco-thesaurus/admin/model/add-constraints.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -admin_uri() { - local uri="$1" - echo "$uri" | sed 's|://|://admin.|' -} - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -admin_base=$(admin_uri "$base") -admin_proxy=$(admin_uri "$proxy") - -add-property-constraint.sh \ - -b "$admin_base" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --uri "${base}ns#MissingPrefLabel" \ - --label "Missing skos:prefLabel" \ - --property "http://www.w3.org/2004/02/skos/core#prefLabel" \ - "${admin_base}ontologies/namespace/" diff --git a/demo/unesco-thesaurus/admin/model/post-ns.sh b/demo/unesco-thesaurus/admin/model/import-ns.sh similarity index 55% rename from demo/unesco-thesaurus/admin/model/post-ns.sh rename to demo/unesco-thesaurus/admin/model/import-ns.sh index 10bbaf2..736cd02 100755 --- a/demo/unesco-thesaurus/admin/model/post-ns.sh +++ b/demo/unesco-thesaurus/admin/model/import-ns.sh @@ -25,7 +25,29 @@ admin_uri() { admin_base=$(admin_uri "$base") admin_proxy=$(admin_uri "$proxy") -# clear the old contents of the namespace ontology +# create a new document for the SKOS ontology + +target=$(create-item.sh \ + -b "$admin_base" \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --title "SKOS" \ + --slug "skos" \ + --container "${admin_base}ontologies/" +) + +# import the SKOS ontology data + +import-ontology.sh \ + -b "$admin_base" \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --source "http://www.w3.org/2004/02/skos/core" \ + --graph "$target" + +# clear the old properties of the namespace ontology { echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ -f "$cert_pem_file" \ @@ -33,15 +55,20 @@ admin_proxy=$(admin_uri "$proxy") --proxy "$admin_proxy" \ "${admin_base}ontologies/namespace/" -# append the new class templates to the namespace ontology -# prepend @base directive using end-user base URI so that the ns: prefix +# append the ns.ttl file to the namespace ontology +# prepend @base directive using end-user base URI so that the : prefix # (defined as in ns.ttl) resolves to the end-user namespace -# (e.g. https://swib.localhost:4443/ns#) instead of the admin namespace -# (e.g. https://admin.swib.localhost:4443/ns#) -{ echo "@base <${base}> ."; cat ns.ttl; } | post.sh \ +{ echo "@base <${base}ns> ."; cat ns.ttl; } | post.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$admin_proxy" \ --content-type "text/turtle" \ "${admin_base}ontologies/namespace/" + +clear-ontology.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ + --ontology "${base}ns#" diff --git a/demo/unesco-thesaurus/admin/model/import-ontologies.sh b/demo/unesco-thesaurus/admin/model/import-ontologies.sh deleted file mode 100755 index 13761d0..0000000 --- a/demo/unesco-thesaurus/admin/model/import-ontologies.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/demo/skos/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -admin_uri() { - local uri="$1" - echo "$uri" | sed 's|://|://admin.|' -} - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -admin_base=$(admin_uri "$base") -admin_proxy=$(admin_uri "$proxy") - -target=$(create-item.sh \ - -b "$admin_base" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --title "SKOS" \ - --slug "skos" \ - --container "${admin_base}ontologies/" -) - -import-ontology.sh \ - -b "$admin_base" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --source "http://www.w3.org/2004/02/skos/core" \ - --graph "$target" - -add-ontology-import.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$admin_proxy" \ - --import "http://www.w3.org/2004/02/skos/core" \ - "${admin_base}ontologies/namespace/" diff --git a/demo/unesco-thesaurus/admin/model/ns.ttl b/demo/unesco-thesaurus/admin/model/ns.ttl index 60bf737..580e638 100644 --- a/demo/unesco-thesaurus/admin/model/ns.ttl +++ b/demo/unesco-thesaurus/admin/model/ns.ttl @@ -1,24 +1,29 @@ @prefix : <#> . -@prefix ns: . +@prefix owl: . @prefix ldh: . @prefix rdfs: . @prefix sp: . @prefix spin: . @prefix dct: . -@prefix skos: . +@prefix skos: . + +: a owl:Ontology ; + owl:imports . # Concept +skos:Concept spin:constraint :MissingPrefLabel . + # narrower -skos:Concept ldh:template ns:NarrowerConcepts. +skos:Concept ldh:template :NarrowerConcepts. -ns:NarrowerConcepts a ldh:View ; +:NarrowerConcepts a ldh:View ; dct:title "Narrower concepts" ; - spin:query ns:SelectNarrowerConcepts ; - rdfs:isDefinedBy ns: . + spin:query :SelectNarrowerConcepts ; + rdfs:isDefinedBy : . -ns:SelectNarrowerConcepts a sp:Select ; +:SelectNarrowerConcepts a sp:Select ; rdfs:label "Select narrower concepts" ; sp:text """ PREFIX skos: @@ -36,18 +41,18 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # broader -skos:Concept ldh:template ns:BroaderConcepts. +skos:Concept ldh:template :BroaderConcepts. -ns:BroaderConcepts a ldh:View ; +:BroaderConcepts a ldh:View ; dct:title "Broader concepts" ; - spin:query ns:SelectBroaderConcepts ; - rdfs:isDefinedBy ns: . + spin:query :SelectBroaderConcepts ; + rdfs:isDefinedBy : . -ns:SelectBroaderConcepts a sp:Select ; +:SelectBroaderConcepts a sp:Select ; rdfs:label "Select broader concepts" ; sp:text """ PREFIX skos: @@ -65,18 +70,18 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # Collection -skos:Collection ldh:template ns:CollectionMembers. +skos:Collection ldh:template :CollectionMembers. -ns:CollectionMembers a ldh:View ; +:CollectionMembers a ldh:View ; dct:title "Collection members" ; - spin:query ns:SelectCollectionMembers ; - rdfs:isDefinedBy ns: . + spin:query :SelectCollectionMembers ; + rdfs:isDefinedBy : . -ns:SelectCollectionMembers a sp:Select ; +:SelectCollectionMembers a sp:Select ; rdfs:label "Select collection members" ; sp:text """ PREFIX skos: @@ -94,18 +99,18 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . # ConceptScheme -skos:ConceptScheme ldh:template ns:ConceptsInScheme. +skos:ConceptScheme ldh:template :ConceptsInScheme. -ns:ConceptsInScheme a ldh:View ; +:ConceptsInScheme a ldh:View ; dct:title "Concepts in scheme" ; - spin:query ns:SelectConceptsInScheme ; - rdfs:isDefinedBy ns: . + spin:query :SelectConceptsInScheme ; + rdfs:isDefinedBy : . -ns:SelectConceptsInScheme a sp:Select ; +:SelectConceptsInScheme a sp:Select ; rdfs:label "Select concepts in scheme" ; sp:text """ PREFIX skos: @@ -120,4 +125,10 @@ WHERE } ORDER BY ?prefLabel """ ; - rdfs:isDefinedBy ns: . + rdfs:isDefinedBy : . + +# Constraints + +:MissingPrefLabel a ldh:MissingPropertyValue ; + rdfs:label "Missing skos:prefLabel" ; + sp:arg1 skos:prefLabel . diff --git a/demo/unesco-thesaurus/install.sh b/demo/unesco-thesaurus/install.sh index 0b1db3c..50f82bc 100755 --- a/demo/unesco-thesaurus/install.sh +++ b/demo/unesco-thesaurus/install.sh @@ -33,24 +33,12 @@ cd .. cd model -printf "\n### Import ontologies\n\n" +printf "\n### Importing namespace ontology\n\n" -./import-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Creating constraints\n\n" - -./add-constraints.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Creating block templates\n\n" - -./post-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" +./import-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" cd .. -printf "\n### Clearing ontologies\n\n" - -./clear-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - cd .. printf "\n### Uploading files\n\n" diff --git a/packages/skos/ns.ttl b/packages/skos/ns.ttl index 60bf737..3f1f5ec 100644 --- a/packages/skos/ns.ttl +++ b/packages/skos/ns.ttl @@ -9,6 +9,8 @@ # Concept +skos:Concept spin:constraint ns:MissingPrefLabel . + # narrower skos:Concept ldh:template ns:NarrowerConcepts. @@ -121,3 +123,9 @@ WHERE ORDER BY ?prefLabel """ ; rdfs:isDefinedBy ns: . + +# Constraints + +ns:MissingPrefLabel a ldh:MissingPropertyValue ; + rdfs:label "Missing skos:prefLabel" ; + sp:arg1 skos:prefLabel . From d831e56166912230483dfe33ba3950917fe653e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Wed, 3 Dec 2025 22:37:13 +0100 Subject: [PATCH 07/14] Content updates --- demo/copenhagen/root.ttl | 6 +++--- demo/unesco-thesaurus/create-containers.sh | 2 -- demo/unesco-thesaurus/files/unesco.png | Bin 0 -> 4590 bytes demo/unesco-thesaurus/root.ttl | 23 ++++++++++++++++++--- 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 demo/unesco-thesaurus/files/unesco.png diff --git a/demo/copenhagen/root.ttl b/demo/copenhagen/root.ttl index 4b2fabf..146d80b 100644 --- a/demo/copenhagen/root.ttl +++ b/demo/copenhagen/root.ttl @@ -8,7 +8,7 @@ @prefix sioc: . <> a def:Root ; - dct:title "City Graph" ; + dct:title "Copenhagen" ; dct:description "Geospatial and other open data about cities, imported by transforming CSV files to RDF" ; rdf:_1 <#page-header> ; rdf:_2 <#main-library> ; @@ -20,7 +20,7 @@ <#page-header> a ldh:XHTML ; rdf:value """

Features include CSV data imports, SPARQL-based charts, faceted search and related results (parallax navigation) as well as @@ -31,7 +31,7 @@

"""^^rdf:XMLLiteral . <#main-library> a ldh:Object ; - rdf:value ; + rdf:value ; ac:mode ac:MapMode . <#charts> a ldh:XHTML ; diff --git a/demo/unesco-thesaurus/create-containers.sh b/demo/unesco-thesaurus/create-containers.sh index 865e653..5efe413 100755 --- a/demo/unesco-thesaurus/create-containers.sh +++ b/demo/unesco-thesaurus/create-containers.sh @@ -73,8 +73,6 @@ add-object-block.sh \ --value "${container}#${view_id}" \ "$container" -echo "BBB" - # collections container=$(create-container.sh \ diff --git a/demo/unesco-thesaurus/files/unesco.png b/demo/unesco-thesaurus/files/unesco.png new file mode 100644 index 0000000000000000000000000000000000000000..d250e191e03eb474f9fe1352a9a5c201651df30c GIT binary patch literal 4590 zcmV>`oqJ++uPgm@$rCwfXvLyM@L7itE<)3)#~c%qN1Yi?(U6^jkmYAm6es7o0~K= zGz$w0czAgB_V#OQYjALIv9YmZV`Jdp;K|9!y1Kf+z`z(77^tYIPft%QEG$}DT0A^F zY;0_OeSIAr9ZXD2K|w(yBO`~0hb}HI6B83~SDJ+Y01+ZdL_t(|ob8?KVxl?_fRhM< zAP5L@lZsex*!O?FGn1eOOV!g_a4Yj;S5pl6lF4K;B!rL`kTLbFuFKG}sFYHt>q4|G zOG=}z%h0x%<)Z5%^wP_(h>@3F7olxoV7JFz7oueeUU967Hbu~N8G7lZm&eGQzFdDs zyX|&eh?eCQ$7iDDCF{Bjz4XG2(pDaw=~G+nf&T^uhc1WdBXf1>;Ys6RY7|pR!t7D4 z^Q`f(WUSLql8?+s%x>)c#6BKr-#|!a4M2Ty$kOgF-9f46I;t4jBPe#|>D z8(gTp_s!0&_?=HNF1zrw8kShPK2?Ng8~j?ushhV$`TsjN1N+da5o42C4PsgfxL{sS zr*yLxj!81g>wob7XXoyAd``yo;_H>NHjd6Hv$=|YXPIA5FaB5OUeKNT8#uS+vJ1zN zD2QQ8>3e@b*nIYJPRSQ$by?k(KV;Ka|BtKxd+zaAYE>mskWaPWL1x4Ecy;jI{lfM|D4oUYTxlAE%y70i>eDdQn^=GHM%jcng{Mz6xDR(dgWzp4r?ZTpL312 z=3&k1eA7p$Vn?@)XP@nr>U1OFjp4yTVef6=|NL^wP4ZYCxE(GAV&o|5Ot2 zA&1p}^eLB%gh0JhrPcP;0DAS3*p!~58W@O#A!Kq&D0#1xLb8SqQ!#mFpg@8rPYG3= zuB`95KV;r|90`~`;>gTX7(CdU#B6is^N3;z({wH>yG$TrM(W?bJ;puTbV|51F|R){ zzia842(Gq6*_D_;jX>ggfo=vZ=|u?SC%PTcHsjku znwWPq_CCdiBo7fAN6zCf*svMRuQC%Ir(S3I3(P(}T#Qv)yBtVA8rQ4fFEBgwV|vYo zkpyZ%`uZ1`Bh=+<%;ZpuY5s`0gVml*%;`;LzcyO^gxR6{*4Mi?GH-4%XSJskKOCQ* zBBr0}x0nM;cjs?E@xwM9tXXej*1}uNWG8p%pXhcMdyN{I%bU!;{ENR}w>9@Fvy~)> zd7eXa<|H}WqJNM%jjl3-<{POTy88>Uq13p_T*brAX@4Q6pDOn-Kj=Az*}hZK$ZWO8 z?ANC&twGHWrkU6Lf56o&N`5)(hP@9E8K+QIXxuEi)? zbv;>2(k9aldBy!0J#)|eSDAyws1;c}lM#CgVUyNFL!Aq_aD&@d{ak|eux(j?v5>X3 zc$n3e^^zq1qAc%sx#j;R^X#j_DD6zLpQ)YO5_P4wExY0EV)fF?PsCC>l}-X=P6y^o zl1^TC=yuE8$*Xyvjycu+-=2d!n{KzUr!2_^9ZL3T$=@rU6+s4G+|RFj>7|!mdg-N? zUb>KHU32n_GNklhKWF0qN+&ez4X${-J(SzR56j?<(OhW`y9d; zR7)O%QFXLaeMKAmK>H_b(y&_cQG0k8PYH=WKUpiP*K{P+xVoTny@U%~0{dI#e58~W z^IIq-GDs^vKS7Ok@xNKUq@>P_!Cdx4Yi7O{nc1{J)$zTSmPyni#;wbR4$Z}HOd2u#jLZ(c!gYXT_~UX($l(A}2Yt$*HX^JNMsT&X z@6-ljc+%p>C^@6Z5%3#XJ|L8x$kQA0hJs zkF0B$L9ux^M_oC`vC3~?o)(Moc)VDMzesj_g#W}7VAklga5Sl%8<@obSD$se-LqfL zG8fx4O*F)p%w)%P+f2#u4L|H9-6mv2x4`Tbm?AN2JVOh<9huqOf;Po5zb>8Zmqbyi z2MuB6xKF0WT*PRkuy1Zw&`IZLsdDif!Azj-82P|AE|r|QvSAc!!H4`#?abeEvEF~W zchS=Nuun1&PfBqSB4PrwO2Q>NXw!tuXd!|bE{$jOP;I73#5M{Ona8v!X}-+CB7mcU z`e4v$xx}40I>ICKgs$velNz^rW|u7L#J0uRJ_9V4If71_;bxN(ER5z1g+p%Gj;S5} zZQ*GU4VzoD?Ex{s&o&*08R)31i{aQhWfui_l-F?lYEhtGdg-MX!m>(^7I1KTa7(Xm zo=@th+M45`Q~QBA`EoL3;Dy=HP3{a`e$UUeE*BkbuC5Vg1(a&Ky>HNss2Vi zY1*GPKWA7+B4#q6n|OR@WF+|3)=2AeVUhRcT5uFTzcH^b3ai zR?IfI$N8H{0++IBA-}2N!Y+mfvKq z1hVsZ?h>=fCkdJ>oZJAam-lC2j`#$54uzg#VcSEU+cnAh@` z5bod4%<1W!3Bi2)zLA*MOH4JPefTDRj%h`1{PCHYpJ@%VBkMQ^8c-{tGvD{u%WV}5 zXkbq2Gs0x#JO4+_$=Osd-piP>KX=IqQohOX|6 zFPNDv?jKRZJRVUD%m!UMwrxA3ubGt^vrj)_x2!Rv3I?BQ-{jr_H1LTeO zO=1-l9%IcXW|tS0-@9TK8EKd8JoSjUG8MV1GXr#66>Y90Uo)$`A+4AX8!0DrYs|c- zG_>>Wbq3ZsqLiUsnehG`V|FX?0Uw?4i`Eh|57UzEhMbrcUaY)gR*$z`@V^IWi;4q5 z8WU~UcF#-fe9cUBR3%6Bt_a`!5o~1UA=d1=$%fs0>T$AR1={RkNT)I0NuSYTkIm+} zTYw3v@4OXs2$#S4zFf-@Qoe?ndMx+xEh&s;}n(8p~6pn$lQRjs$ymb>g4-x`6O(CK}Znva5KL& zqfC6Tc)Y@LXEqwv$X{n9gOt>_3BSa!-^bVn3)E6$%pj+*)bMZk#aN#7TXFsMNEP=A zO9SH@0e<$^*wqu>wOr6JWj$mWBn=|W58G=TmdA%Pmht#@BorRKQL_M0`r`xmKsc;f)bn-nlvYDmIr)lYva9QzRV!EMCj$$n5BL!F$>+6 zm@&LL=QapRd}NMJhZ+|cdvQq>1Q`MIKwNA?hWKeeTmA(rqbfJYs|tjr_pdHG0#uTTb;)l;1?p0goB+Hl{#m}FRLT7TAkvROx%KcM`lt5 z9`YQRNn^}_n9hUNG8dJpQel=AUSY=OGbr8rV~IIA25T6o3y-lGCuUIaO&D=zR8#NB z>NpYLapv?B^Wn(6DLCGlne3_>8$m9dSp-2c z_`2fHL{9B|WR8VuxZKdkhm&qIq4?AAOXdgeO*p(^`3;&^@%gx7ULWu_F8--vW;}%A z$jk zN<{*%Tox6xOLGl0Fbp^QV}A~5Io^36{+StLhTPIFz?Jp<}^X=E`Z#ZGvMzklQ8YiEtEEabhY?m5 zpxEPh7>uCGZQeYKcovblOHBLZGX#q;ws{SxwrGWsJ>cQoQ5-Kw<`S#Ki^mhfY(=#l z6u46J3){3xi>SjwNlIKT=M?;fsRk-Av%6U$^c_(>EcT>j|G8t?(kvO#*LqD-F#Mp) zmwUZL!_JIedg-N?UV7=JmtK15<=G_|ce1^zQ|aPtwvMH . <> a def:Root ; - dct:title "SKOS" ; + dct:title "Unesco Thesaurus" ; dct:description "SKOS-based editor of thesauri, lexicons, vocabularies, taxonomies, and classification schemes" ; rdf:_1 <#page-header> ; rdf:_2 <#select-children> . @@ -15,8 +15,25 @@ <#page-header> a ldh:XHTML ; rdf:value """
+
+
+

This application demonstrates the capabilities of LinkedDataHub's SKOS package.

+
+
Browser
+
Navigate concepts, collections, and concept schemes with parallax navigation through broader/narrower/related relationships
+
Editor
+
Create and edit SKOS resources (requires authentication)
+
RDF Import
+
Import data using SPARQL transformation queries
+
+
+
+ + UNESCO Thesaurus + +
"""^^rdf:XMLLiteral . From 817690c07aa840658a37da26a62e1bc94462b63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Wed, 3 Dec 2025 23:17:36 +0100 Subject: [PATCH 08/14] Northwing Traders territories displayed using map mode --- demo/northwind-traders/create-containers.sh | 2 +- demo/northwind-traders/files/territories.csv | 108 +++++++++--------- .../queries/imports/territories.rq | 9 +- 3 files changed, 62 insertions(+), 57 deletions(-) diff --git a/demo/northwind-traders/create-containers.sh b/demo/northwind-traders/create-containers.sh index 65da35d..d3ff4ac 100755 --- a/demo/northwind-traders/create-containers.sh +++ b/demo/northwind-traders/create-containers.sh @@ -480,7 +480,7 @@ add-view.sh \ --proxy "$proxy" \ --uri "#${view_id}" \ --query "${container}#${query_id}" \ - --mode "https://w3id.org/atomgraph/client#TableMode" \ + --mode "https://w3id.org/atomgraph/client#MapMode" \ "$container" object_id="select-territories" diff --git a/demo/northwind-traders/files/territories.csv b/demo/northwind-traders/files/territories.csv index f5aabf5..e72f545 100644 --- a/demo/northwind-traders/files/territories.csv +++ b/demo/northwind-traders/files/territories.csv @@ -1,54 +1,54 @@ -territoryID,territoryDescription,regionID -01581,Westboro,1 -01730,Bedford,1 -01833,Georgetown,1 -02116,Boston,1 -02139,Cambridge,1 -02184,Braintree,1 -02903,Providence,1 -03049,Hollis,3 -03801,Portsmouth,3 -06897,Wilton,1 -07960,Morristown,1 -08837,Edison,1 -10019,New York,1 -10038,New York,1 -11747,Mellvile,1 -14450,Fairport,1 -19428,Philadelphia,3 -19713,Neward,1 -20852,Rockville,1 -27403,Greensboro,1 -27511,Cary,1 -29202,Columbia,4 -30346,Atlanta,4 -31406,Savannah,4 -32859,Orlando,4 -33607,Tampa,4 -40222,Louisville,1 -44122,Beachwood,3 -45839,Findlay,3 -48075,Southfield,3 -48084,Troy,3 -48304,Bloomfield Hills,3 -53404,Racine,3 -55113,Roseville,3 -55439,Minneapolis,3 -60179,Hoffman Estates,2 -60601,Chicago,2 -72716,Bentonville,4 -75234,Dallas,4 -78759,Austin,4 -80202,Denver,2 -80909,Colorado Springs,2 -85014,Phoenix,2 -85251,Scottsdale,2 -90405,Santa Monica,2 -94025,Menlo Park,2 -94105,San Francisco,2 -95008,Campbell,2 -95054,Santa Clara,2 -95060,Santa Cruz,2 -98004,Bellevue,2 -98052,Redmond,2 -98104,Seattle,2 +territoryID,territoryDescription,regionID,latitude,longitude +01581,Westboro,1,42.2679,-71.6176 +01730,Bedford,1,42.4843,-71.2768 +01833,Georgetown,1,42.7281,-70.9822 +02116,Boston,1,42.3492,-71.0768 +02139,Cambridge,1,42.3647,-71.1042 +02184,Braintree,1,42.2093,-70.9963 +02903,Providence,1,41.82,-71.4158 +03049,Hollis,3,42.7485,-71.5772 +03801,Portsmouth,3,43.0729,-70.8052 +06897,Wilton,1,41.2018,-73.4383 +07960,Morristown,1,40.7952,-74.4873 +08837,Edison,1,40.5325,-74.3375 +10019,New York,1,40.7651,-73.9858 +10038,New York,1,40.7101,-74.0013 +11747,Mellvile,1,40.7946,-73.403 +14450,Fairport,1,43.0892,-77.436 +19428,Philadelphia,3,40.0825,-75.3044 +19713,Neward,1,39.6699,-75.7151 +20852,Rockville,1,39.0496,-77.1204 +27403,Greensboro,1,36.0641,-79.8202 +27511,Cary,1,35.7641,-78.7786 +29202,Columbia,4,34.0007,-81.0348 +30346,Atlanta,4,33.9267,-84.3334 +31406,Savannah,4,31.989,-81.0979 +32859,Orlando,4,28.4429,-81.4026 +33607,Tampa,4,27.9625,-82.4895 +40222,Louisville,1,38.2674,-85.6237 +44122,Beachwood,3,41.4701,-81.5232 +45839,Findlay,3,41.0442,-83.6499 +48075,Southfield,3,42.4638,-83.2255 +48084,Troy,3,42.5627,-83.1799 +48304,Bloomfield Hills,3,42.587,-83.2359 +53404,Racine,3,42.7433,-87.8053 +55113,Roseville,3,45.0139,-93.1571 +55439,Minneapolis,3,44.8744,-93.3753 +60179,Hoffman Estates,2,42.0793,-88.2237 +60601,Chicago,2,41.8858,-87.6181 +72716,Bentonville,4,36.3729,-94.2088 +75234,Dallas,4,32.9245,-96.8938 +78759,Austin,4,30.4036,-97.7526 +80202,Denver,2,39.7491,-104.9946 +80909,Colorado Springs,2,38.852,-104.7735 +85014,Phoenix,2,33.5103,-112.0556 +85251,Scottsdale,2,33.4936,-111.9167 +90405,Santa Monica,2,34.01,-118.4717 +94025,Menlo Park,2,37.4396,-122.1864 +94105,San Francisco,2,37.7864,-122.3892 +95008,Campbell,2,37.2803,-121.9539 +95054,Santa Clara,2,37.3924,-121.9623 +95060,Santa Cruz,2,37.0313,-122.1198 +98004,Bellevue,2,47.6155,-122.2072 +98052,Redmond,2,47.6718,-122.1232 +98104,Seattle,2,47.6036,-122.3256 diff --git a/demo/northwind-traders/queries/imports/territories.rq b/demo/northwind-traders/queries/imports/territories.rq index 9be7315..25c3ddf 100644 --- a/demo/northwind-traders/queries/imports/territories.rq +++ b/demo/northwind-traders/queries/imports/territories.rq @@ -1,6 +1,7 @@ PREFIX foaf: PREFIX dct: PREFIX schema: +PREFIX geo: CONSTRUCT { @@ -13,14 +14,18 @@ CONSTRUCT dct:title ?territoryDescription ; schema:name ?territoryDescription ; schema:identifier ?territoryID ; - schema:containedInPlace ?region . + schema:containedInPlace ?region ; + geo:lat ?latitude ; + geo:long ?longitude . } } WHERE { ?territory_row <#territoryID> ?territoryID ; <#territoryDescription> ?territoryDescription ; - <#regionID> ?regionID . + <#regionID> ?regionID ; + <#latitude> ?latitude ; + <#longitude> ?longitude . BIND(uri(concat(str($base), "territories/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?territoryID), "/")) AS ?graph) From aba2b5b4b15fae06d9da8f7a780e9d6e954bab18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Tue, 9 Dec 2025 11:01:21 +0100 Subject: [PATCH 09/14] Documentation links --- linkeddatahub/docs/reference/dataspace.ttl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linkeddatahub/docs/reference/dataspace.ttl b/linkeddatahub/docs/reference/dataspace.ttl index c1af9a6..4522960 100644 --- a/linkeddatahub/docs/reference/dataspace.ttl +++ b/linkeddatahub/docs/reference/dataspace.ttl @@ -99,9 +99,9 @@

Document hierarchy

The basic structure of resources in an application is analogous to the file system, but built using RDF - resources and relationships between them instead. There is a hierarchy of containers (folders), - which are collections of items (files) as well as sub-containers (sub-folders). Both containers - and items are documents. Items cannot contain other documents.

+ resources and relationships between them instead. There is a hierarchy of containers, + which are collections of items as well as sub-containers. Both containers + and items are documents. Items cannot contain other documents.

The first level of resources in a container is referred to as its children (of which that container is the parent), while all levels down the hierarchy are collectively referred to as descendants.

From 3795f592c9a7081ac3aeee4b120c07f0457c8413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= Date: Sun, 14 Dec 2025 11:48:55 +0100 Subject: [PATCH 10/14] Typo fix --- linkeddatahub/docs/user-guide/change-layout.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkeddatahub/docs/user-guide/change-layout.ttl b/linkeddatahub/docs/user-guide/change-layout.ttl index ae78f50..e0dff2d 100644 --- a/linkeddatahub/docs/user-guide/change-layout.ttl +++ b/linkeddatahub/docs/user-guide/change-layout.ttl @@ -32,7 +32,7 @@
-

First, either upload the XSLT file or mount it using Docker and docker-compose.override.yml::

+

First, either upload the XSLT file or mount it using Docker and docker-compose.override.yml:

version: "2.3"
 services:
   linkeddatahub:

From 617637c28c894c857cdce053185df5a83f0a7e38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= 
Date: Fri, 26 Dec 2025 01:06:20 +0100
Subject: [PATCH 11/14] Unesco Thesaurus installs SKOS package

README update
---
 demo/unesco-thesaurus/install.sh |  4 ++
 packages/README.md               | 77 +++++++++++++++++++++-----------
 packages/skos/ns.ttl             | 63 +++++++++++++-------------
 packages/skos/package.ttl        |  5 ++-
 4 files changed, 90 insertions(+), 59 deletions(-)

diff --git a/demo/unesco-thesaurus/install.sh b/demo/unesco-thesaurus/install.sh
index 50f82bc..5bc5ffe 100755
--- a/demo/unesco-thesaurus/install.sh
+++ b/demo/unesco-thesaurus/install.sh
@@ -56,3 +56,7 @@ printf "\n### Updating documents\n\n"
 printf "\n### Importing SKOS vocabulary\n\n"
 
 ./import-rdf.sh "$base" "$cert_pem_file" "$cert_password" "$proxy"
+
+printf "\n### Installing SKOS package\n\n"
+
+install-package.sh -b "$base" -f "$cert_pem_file" -p "$cert_password" --proxy "$proxy" --package "https://packages.linkeddatahub.com/skos/#this"
diff --git a/packages/README.md b/packages/README.md
index 8d43117..4a7c96f 100644
--- a/packages/README.md
+++ b/packages/README.md
@@ -113,13 +113,19 @@ install-package.sh \
 
 ## Prerequisites
 
-Before installing packages, a **master stylesheet** must exist at `/static//layout.xsl` in the webapp directory. A default template is provided at:
+Before installing packages, **master stylesheets** must exist in the webapp directory:
+
+- `/static/xsl/layout.xsl` - End-user application master stylesheet
+- `/static/xsl/admin/layout.xsl` - Admin application master stylesheet
+
+Default templates are provided at:
 
 ```
-src/main/webapp/static/localhost/layout.xsl
+src/main/webapp/static/xsl/layout.xsl
+src/main/webapp/static/xsl/admin/layout.xsl
 ```
 
-This file should be deployed with the application. It contains:
+These files should be deployed with the application. End-user stylesheet contains:
 
 ```xml
 
@@ -141,14 +147,17 @@ This file should be deployed with the application. It contains:
 When you install a package, the system:
 
 1. **Fetches package metadata** from the package URI
-2. **Downloads package ontology** (`ns.ttl`) and POSTs it to the namespace graph (`${admin_base}ontologies/namespace/`)
-3. **Downloads package stylesheet** (`layout.xsl`) and saves it to `/static/packages//layout.xsl`
-4. **Updates master stylesheet** at `/static//layout.xsl` by adding import:
+2. **Hashes the package ontology URI** using SHA-1 to create a unique document slug
+3. **Downloads package ontology** (`ns.ttl`) and PUTs it as a document to `${admin_base}ontologies/{hash}/` where `{hash}` is the SHA-1 hash of the ontology URI
+4. **Adds owl:imports** from the namespace ontology to the package ontology in the namespace graph (`${admin_base}ontologies/namespace/`)
+5. **Clears and reloads** the namespace ontology from cache to pick up the new imports
+6. **Downloads package stylesheet** (`layout.xsl`) and saves it to `/static/{package-path}/layout.xsl` where `{package-path}` is derived from the package URI (e.g., `com/linkeddatahub/packages/skos/` for `https://packages.linkeddatahub.com/skos/`)
+7. **Updates master stylesheet** at `/static/xsl/layout.xsl` by adding import:
    ```xml
      
-     
+     
    ```
-5. **Adds import to application** (currently manual): ` ldh:import `
+8. **Adds import to application** (TODO - currently manual): ` ldh:import `
 
 **Note**: The master stylesheet must already exist or installation will fail with `InternalServerErrorException`.
 
@@ -165,39 +174,53 @@ Packages use **installation-time composition**, NOT runtime composition:
 
 ### JAX-RS Endpoints
 
-- **POST `/admin/install-package`** - Installs a package
-  - Parameter: `packageUri` (form-urlencoded)
-  - Requires admin authentication
+**On the admin application**
+
+- **POST `/packages/install`** - Installs a package
+  - Parameter: `package-uri` (form-urlencoded)
+  - Requires owner/admin authentication
+  - Delegates authenticated agent credentials for PUT requests
 
-- **POST `/admin/uninstall-package`** - Uninstalls a package
-  - Parameter: `packageUri` (form-urlencoded)
-  - Requires admin authentication
+- **POST `/packages/uninstall`** - Uninstalls a package
+  - Parameter: `package-uri` (form-urlencoded)
+  - Requires owner/admin authentication
 
 ### File System Structure
 
-After installation:
+After installing the SKOS package:
 
 ```
 webapp/
 ├── static/
-│   ├── packages/
-│   │   └── skos/
-│   │       └── layout.xsl          # Package stylesheet
-│   └── localhost/
-│       └── layout.xsl               # Generated master stylesheet
+│   ├── com/
+│   │   └── linkeddatahub/
+│   │       └── packages/
+│   │           └── skos/
+│   │               └── layout.xsl          # Package stylesheet
+│   └── xsl/
+│       ├── layout.xsl                      # End-user master stylesheet
+│       └── admin/
+│           └── layout.xsl                  # Admin master stylesheet
 ```
 
 ### SPARQL Data Structure
 
 ```turtle
-# In system.trig (application config)
- a lapp:Application ;
-    ldt:ontology  ;
-    ac:stylesheet  ;  # Master stylesheet
-    ldh:import  .
+# In admin SPARQL endpoint at <${admin_base}ontologies/{hash}/>
+# Package ontology stored as a document where {hash} is SHA-1 of ontology URI
+ a owl:Ontology ;
+    # ... package ontology content ...
+
+# In admin SPARQL endpoint (namespace graph at <${admin_base}ontologies/namespace/>)
+# Namespace ontology imports package ontology
+ a owl:Ontology ;
+    owl:imports  .
 
-# In admin SPARQL endpoint (namespace graph)
-# Contains merged package ontologies via owl:imports
+# In system.trig (application config)
+ a lapp:EndUserApplication ;
+    ldt:ontology  ;
+    ac:stylesheet  ;  # Master stylesheet
+    # ldh:import  (TODO - not yet implemented)
 ```
 
 ## Available Packages
diff --git a/packages/skos/ns.ttl b/packages/skos/ns.ttl
index 3f1f5ec..eb3bb10 100644
--- a/packages/skos/ns.ttl
+++ b/packages/skos/ns.ttl
@@ -1,26 +1,28 @@
-@prefix :	    <#> .
-@prefix ns:      .
+@prefix :	<#> .
 @prefix ldh:	 .
 @prefix rdfs:	 .
+@prefix owl:     .
 @prefix sp: 	 .
 @prefix spin:	 .
 @prefix dct:	 .
 @prefix skos:    .
 
-# Concept
+: a owl:Ontology ;
+    rdfs:label "SKOS package ontology".
 
-skos:Concept spin:constraint ns:MissingPrefLabel .
+# Concept
 
 # narrower
 
-skos:Concept ldh:template ns:NarrowerConcepts.
+skos:Concept ldh:template :NarrowerConcepts ;
+    spin:constraint :MissingPrefLabel .
 
-ns:NarrowerConcepts a ldh:View ;
+:NarrowerConcepts a ldh:View ;
     dct:title "Narrower concepts" ;
-    spin:query ns:SelectNarrowerConcepts ;
-    rdfs:isDefinedBy ns: .
+    spin:query :SelectNarrowerConcepts ;
+    rdfs:isDefinedBy : .
 
-ns:SelectNarrowerConcepts a sp:Select ;
+:SelectNarrowerConcepts a sp:Select ;
     rdfs:label "Select narrower concepts" ;
     sp:text """
 PREFIX  skos: 
@@ -38,18 +40,18 @@ WHERE
   }
 ORDER BY ?prefLabel
 """ ;
-    rdfs:isDefinedBy ns: .
+    rdfs:isDefinedBy : .
 
 # broader
 
-skos:Concept ldh:template ns:BroaderConcepts.
+skos:Concept ldh:template :BroaderConcepts.
 
-ns:BroaderConcepts a ldh:View ;
+:BroaderConcepts a ldh:View ;
     dct:title "Broader concepts" ;
-    spin:query ns:SelectBroaderConcepts ;
-    rdfs:isDefinedBy ns: .
+    spin:query :SelectBroaderConcepts ;
+    rdfs:isDefinedBy : .
 
-ns:SelectBroaderConcepts a sp:Select ;
+:SelectBroaderConcepts a sp:Select ;
     rdfs:label "Select broader concepts" ;
     sp:text """
 PREFIX  skos: 
@@ -67,18 +69,18 @@ WHERE
   }
 ORDER BY ?prefLabel
 """ ;
-    rdfs:isDefinedBy ns: .
+    rdfs:isDefinedBy : .
 
 # Collection
 
-skos:Collection ldh:template ns:CollectionMembers.
+skos:Collection ldh:template :CollectionMembers.
 
-ns:CollectionMembers a ldh:View ;
+:CollectionMembers a ldh:View ;
     dct:title "Collection members" ;
-    spin:query ns:SelectCollectionMembers ;
-    rdfs:isDefinedBy ns: .
+    spin:query :SelectCollectionMembers ;
+    rdfs:isDefinedBy : .
 
-ns:SelectCollectionMembers a sp:Select ;
+:SelectCollectionMembers a sp:Select ;
     rdfs:label "Select collection members" ;
     sp:text """
 PREFIX  skos: 
@@ -96,18 +98,18 @@ WHERE
   }
 ORDER BY ?prefLabel
 """ ;
-    rdfs:isDefinedBy ns: .
+    rdfs:isDefinedBy : .
 
 # ConceptScheme
 
-skos:ConceptScheme ldh:template ns:ConceptsInScheme.
+skos:ConceptScheme ldh:template :ConceptsInScheme.
 
-ns:ConceptsInScheme a ldh:View ;
+:ConceptsInScheme a ldh:View ;
     dct:title "Concepts in scheme" ;
-    spin:query ns:SelectConceptsInScheme ;
-    rdfs:isDefinedBy ns: .
+    spin:query :SelectConceptsInScheme ;
+    rdfs:isDefinedBy : .
 
-ns:SelectConceptsInScheme a sp:Select ;
+:SelectConceptsInScheme a sp:Select ;
     rdfs:label "Select concepts in scheme" ;
     sp:text """
 PREFIX  skos: 
@@ -122,10 +124,11 @@ WHERE
   }
 ORDER BY ?prefLabel
 """ ;
-    rdfs:isDefinedBy ns: .
+    rdfs:isDefinedBy : .
 
 # Constraints
 
-ns:MissingPrefLabel a ldh:MissingPropertyValue ;
+:MissingPrefLabel a ldh:MissingPropertyValue ;
     rdfs:label "Missing skos:prefLabel" ;
-    sp:arg1 skos:prefLabel .
+    sp:arg1 skos:prefLabel ;
+    rdfs:isDefinedBy : .
\ No newline at end of file
diff --git a/packages/skos/package.ttl b/packages/skos/package.ttl
index 2fee9d7..b906f96 100644
--- a/packages/skos/package.ttl
+++ b/packages/skos/package.ttl
@@ -1,3 +1,4 @@
+@base            .
 @prefix :       <#> .
 @prefix lapp:    .
 @prefix ldt:     .
@@ -11,8 +12,8 @@
     dct:title "SKOS Package for LinkedDataHub" ;
     dct:description "Provides SKOS (Simple Knowledge Organization System) vocabulary support with custom templates for concept hierarchies, schemes, and collections." ;
     dct:creator  ;
-    ldt:ontology  ;
-    ac:stylesheet  .
+    ldt:ontology  ;
+    ac:stylesheet  .
 
  a foaf:Organization ;
     foaf:name "AtomGraph" ;

From e00e6e128cbb492e540934b45a4ce5a48203f56f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= 
Date: Fri, 26 Dec 2025 14:27:10 +0100
Subject: [PATCH 12/14] Importing SKOS ontology separately not necessary now
 that we're installing SKOS package

---
 .../unesco-thesaurus/admin/model/import-ns.sh |  74 ----------
 demo/unesco-thesaurus/admin/model/ns.ttl      | 134 ------------------
 .../admin/model/patch-ontology.ru             |  19 ---
 demo/unesco-thesaurus/install.sh              |  20 +--
 4 files changed, 5 insertions(+), 242 deletions(-)
 delete mode 100755 demo/unesco-thesaurus/admin/model/import-ns.sh
 delete mode 100644 demo/unesco-thesaurus/admin/model/ns.ttl
 delete mode 100644 demo/unesco-thesaurus/admin/model/patch-ontology.ru

diff --git a/demo/unesco-thesaurus/admin/model/import-ns.sh b/demo/unesco-thesaurus/admin/model/import-ns.sh
deleted file mode 100755
index 736cd02..0000000
--- a/demo/unesco-thesaurus/admin/model/import-ns.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env bash
-
-if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then
-  echo "Usage:   $0" '$base $cert_pem_file $cert_password [$proxy]' >&2
-  echo "Example: $0" 'https://localhost:4443/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2
-  echo "Note: special characters such as $ need to be escaped in passwords!" >&2
-  exit 1
-fi
-
-base="$1"
-cert_pem_file=$(realpath "$2")
-cert_password="$3"
-
-if [ -n "$4" ]; then
-    proxy="$4"
-else
-    proxy="$base"
-fi
-
-admin_uri() {
-    local uri="$1"
-    echo "$uri" | sed 's|://|://admin.|'
-}
-
-admin_base=$(admin_uri "$base")
-admin_proxy=$(admin_uri "$proxy")
-
-# create a new document for the SKOS ontology
-
-target=$(create-item.sh \
-  -b "$admin_base" \
-  -f "$cert_pem_file" \
-  -p "$cert_password" \
-  --proxy "$admin_proxy" \
-  --title "SKOS" \
-  --slug "skos" \
-  --container "${admin_base}ontologies/"
-)
-
-# import the SKOS ontology data
-
-import-ontology.sh \
-  -b "$admin_base" \
-  -f "$cert_pem_file" \
-  -p "$cert_password" \
-  --proxy "$admin_proxy" \
-  --source "http://www.w3.org/2004/02/skos/core" \
-  --graph "$target"
-
-# clear the old properties of the namespace ontology
-
-{ echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \
-    -f "$cert_pem_file" \
-    -p "$cert_password" \
-    --proxy "$admin_proxy" \
-    "${admin_base}ontologies/namespace/"
-
-# append the ns.ttl file to the namespace ontology
-# prepend @base directive using end-user base URI so that the : prefix
-# (defined as  in ns.ttl) resolves to the end-user namespace
-
-{ echo "@base <${base}ns> ."; cat ns.ttl; } | post.sh \
-    -f "$cert_pem_file" \
-    -p "$cert_password" \
-    --proxy "$admin_proxy" \
-    --content-type "text/turtle" \
-    "${admin_base}ontologies/namespace/"
-
-clear-ontology.sh \
-  -f "$cert_pem_file" \
-  -p "$cert_password" \
-  -b "$admin_base" \
-  --proxy "$admin_proxy" \
-  --ontology "${base}ns#"
diff --git a/demo/unesco-thesaurus/admin/model/ns.ttl b/demo/unesco-thesaurus/admin/model/ns.ttl
deleted file mode 100644
index 580e638..0000000
--- a/demo/unesco-thesaurus/admin/model/ns.ttl
+++ /dev/null
@@ -1,134 +0,0 @@
-@prefix :	    <#> .
-@prefix owl:   .
-@prefix ldh:	 .
-@prefix rdfs:	 .
-@prefix sp: 	 .
-@prefix spin:	 .
-@prefix dct:	 .
-@prefix skos:  .
-
-: a owl:Ontology ;
-    owl:imports  .
-
-# Concept
-
-skos:Concept spin:constraint :MissingPrefLabel .
-
-# narrower
-
-skos:Concept ldh:template :NarrowerConcepts.
-
-:NarrowerConcepts a ldh:View ;
-    dct:title "Narrower concepts" ;
-    spin:query :SelectNarrowerConcepts ;
-    rdfs:isDefinedBy : .
-
-:SelectNarrowerConcepts a sp:Select ;
-    rdfs:label "Select narrower concepts" ;
-    sp:text """
-PREFIX  skos: 
-
-SELECT DISTINCT  ?narrower
-WHERE
-  { GRAPH ?graph
-      { $about  skos:narrower  ?narrower .
-        GRAPH ?narrowerGraph
-        {
-          ?narrower skos:prefLabel ?prefLabel .
-          FILTER (langMatches(lang(?prefLabel), "en"))
-        }
-      }
-  }
-ORDER BY ?prefLabel
-""" ;
-    rdfs:isDefinedBy : .
-
-# broader
-
-skos:Concept ldh:template :BroaderConcepts.
-
-:BroaderConcepts a ldh:View ;
-    dct:title "Broader concepts" ;
-    spin:query :SelectBroaderConcepts ;
-    rdfs:isDefinedBy : .
-
-:SelectBroaderConcepts a sp:Select ;
-    rdfs:label "Select broader concepts" ;
-    sp:text """
-PREFIX  skos: 
-
-SELECT DISTINCT  ?broader
-WHERE
-  { GRAPH ?graph
-      { $about  skos:broader  ?broader .
-        GRAPH ?broaderGraph
-        {
-          ?broader skos:prefLabel ?prefLabel .
-          FILTER (langMatches(lang(?prefLabel), "en"))
-        }
-      }
-  }
-ORDER BY ?prefLabel
-""" ;
-    rdfs:isDefinedBy : .
-
-# Collection
-
-skos:Collection ldh:template :CollectionMembers.
-
-:CollectionMembers a ldh:View ;
-    dct:title "Collection members" ;
-    spin:query :SelectCollectionMembers ;
-    rdfs:isDefinedBy : .
-
-:SelectCollectionMembers a sp:Select ;
-    rdfs:label "Select collection members" ;
-    sp:text """
-PREFIX  skos: 
-
-SELECT DISTINCT  ?member
-WHERE
-  { GRAPH ?graph
-      { $about  skos:member  ?member .
-        GRAPH ?memberGraph
-        {
-          ?member skos:prefLabel ?prefLabel .
-          FILTER (langMatches(lang(?prefLabel), "en"))
-        }
-      }
-  }
-ORDER BY ?prefLabel
-""" ;
-    rdfs:isDefinedBy : .
-
-# ConceptScheme
-
-skos:ConceptScheme ldh:template :ConceptsInScheme.
-
-:ConceptsInScheme a ldh:View ;
-    dct:title "Concepts in scheme" ;
-    spin:query :SelectConceptsInScheme ;
-    rdfs:isDefinedBy : .
-
-:SelectConceptsInScheme a sp:Select ;
-    rdfs:label "Select concepts in scheme" ;
-    sp:text """
-PREFIX  skos: 
-
-SELECT DISTINCT  ?concept
-WHERE
-  { GRAPH ?graph
-      { ?concept  skos:inScheme  $about ;
-            skos:prefLabel ?prefLabel .
-        FILTER (langMatches(lang(?prefLabel), "en"))
-      }
-  }
-ORDER BY ?prefLabel
-""" ;
-    rdfs:isDefinedBy : .
-
-# Constraints
-
-:MissingPrefLabel a ldh:MissingPropertyValue ;
-    rdfs:label "Missing skos:prefLabel" ;
-    sp:arg1 skos:prefLabel .
diff --git a/demo/unesco-thesaurus/admin/model/patch-ontology.ru b/demo/unesco-thesaurus/admin/model/patch-ontology.ru
deleted file mode 100644
index efa41e4..0000000
--- a/demo/unesco-thesaurus/admin/model/patch-ontology.ru
+++ /dev/null
@@ -1,19 +0,0 @@
-PREFIX foaf: 
-
-DELETE {
-  ?s ?p ?o
-}
-WHERE {
-  ?s ?p ?o
-  # Exclude triples about the main resource itself
-  MINUS {
-    <> ?p ?o
-    BIND(<> AS ?s)
-  }
-  # Exclude triples about the foaf:primaryTopic resource
-  MINUS {
-    <> foaf:primaryTopic ?primaryTopic .
-    ?primaryTopic ?p ?o
-    BIND(?primaryTopic AS ?s)
-  }
-}
diff --git a/demo/unesco-thesaurus/install.sh b/demo/unesco-thesaurus/install.sh
index 5bc5ffe..8d5a977 100755
--- a/demo/unesco-thesaurus/install.sh
+++ b/demo/unesco-thesaurus/install.sh
@@ -29,17 +29,7 @@ cd admin/acl
 
 ./create-authorizations.sh "$base" "$cert_pem_file" "$cert_password" "$proxy"
 
-cd ..
-
-cd model
-
-printf "\n### Importing namespace ontology\n\n"
-
-./import-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy"
-
-cd ..
-
-cd ..
+cd ../..
 
 printf "\n### Uploading files\n\n"
 
@@ -53,10 +43,10 @@ printf "\n### Updating documents\n\n"
 
 ./update-documents.sh "$base" "$cert_pem_file" "$cert_password" "$proxy"
 
-printf "\n### Importing SKOS vocabulary\n\n"
-
-./import-rdf.sh "$base" "$cert_pem_file" "$cert_password" "$proxy"
-
 printf "\n### Installing SKOS package\n\n"
 
 install-package.sh -b "$base" -f "$cert_pem_file" -p "$cert_password" --proxy "$proxy" --package "https://packages.linkeddatahub.com/skos/#this"
+
+printf "\n### Importing SKOS vocabulary\n\n"
+
+./import-rdf.sh "$base" "$cert_pem_file" "$cert_password" "$proxy"

From 18576e0f664f9a0c4baa0d3851f72ac63d88c3ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= 
Date: Fri, 26 Dec 2025 19:33:34 +0100
Subject: [PATCH 13/14] Updated SKOS package ontology

---
 packages/skos/ns.ttl | 63 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 57 insertions(+), 6 deletions(-)

diff --git a/packages/skos/ns.ttl b/packages/skos/ns.ttl
index eb3bb10..681a0c2 100644
--- a/packages/skos/ns.ttl
+++ b/packages/skos/ns.ttl
@@ -12,10 +12,29 @@
 
 # Concept
 
-# narrower
+skos:Concept spin:constructor :ConceptConstructor ;
+    spin:constraint :MissingPrefLabel ;
+    ldh:template :NarrowerConcepts .
+
+:ConceptConstructor a ldh:Constructor ;
+    rdfs:label "Concept constructor" ;
+    sp:text """
+        PREFIX skos:    
+        PREFIX xsd:     
+
+        CONSTRUCT {
+            $this skos:prefLabel [ a xsd:string ] ;
+                skos:altLabel [ a xsd:string ] ;
+                skos:definition [ a xsd:string ] ;
+                skos:broader [ a skos:Concept ] ;
+                skos:narrower [ a skos:Concept ] ;
+                skos:related [ a skos:Concept ] ;
+                skos:inScheme [ a skos:ConceptScheme ] .
+        }
+        WHERE {}""" ;
+    rdfs:isDefinedBy : .
 
-skos:Concept ldh:template :NarrowerConcepts ;
-    spin:constraint :MissingPrefLabel .
+# narrower
 
 :NarrowerConcepts a ldh:View ;
     dct:title "Narrower concepts" ;
@@ -73,7 +92,23 @@ ORDER BY ?prefLabel
 
 # Collection
 
-skos:Collection ldh:template :CollectionMembers.
+skos:Collection spin:constructor :CollectionConstructor ;
+    spin:constraint :MissingPrefLabel ;
+    ldh:template :CollectionMembers.
+
+:CollectionConstructor a ldh:Constructor ;
+    rdfs:label "Collection constructor" ;
+    sp:text """
+        PREFIX skos:    
+        PREFIX xsd:     
+
+        CONSTRUCT {
+            $this skos:prefLabel [ a xsd:string ] ;
+                skos:definition [ a xsd:string ] ;
+                skos:member [ a skos:Concept ] .
+        }
+        WHERE {}""" ;
+    rdfs:isDefinedBy : .
 
 :CollectionMembers a ldh:View ;
     dct:title "Collection members" ;
@@ -102,7 +137,23 @@ ORDER BY ?prefLabel
 
 # ConceptScheme
 
-skos:ConceptScheme ldh:template :ConceptsInScheme.
+skos:ConceptScheme spin:constructor :ConceptSchemeConstructor ;
+    ldh:template :ConceptsInScheme.
+
+:ConceptSchemeConstructor a ldh:Constructor ;
+    rdfs:label "Concept scheme constructor" ;
+    sp:text """
+        PREFIX skos:    
+        PREFIX xsd:     
+        PREFIX dct:     
+
+        CONSTRUCT {
+            $this dct:title [ a xsd:string ] ;
+                dct:description [ a xsd:string ] ;
+                skos:hasTopConcept [ a skos:Concept ] .
+        }
+        WHERE {}""" ;
+    rdfs:isDefinedBy : .
 
 :ConceptsInScheme a ldh:View ;
     dct:title "Concepts in scheme" ;
@@ -131,4 +182,4 @@ ORDER BY ?prefLabel
 :MissingPrefLabel a ldh:MissingPropertyValue ;
     rdfs:label "Missing skos:prefLabel" ;
     sp:arg1 skos:prefLabel ;
-    rdfs:isDefinedBy : .
\ No newline at end of file
+    rdfs:isDefinedBy : .

From 87aefdf8a3c4465148b03b6d47cbaabeb356a7cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martynas=20Jusevi=C4=8Dius?= 
Date: Sat, 27 Dec 2025 11:43:51 +0100
Subject: [PATCH 14/14] Added SKOS import to SKOS package ontology

---
 packages/skos/ns.ttl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/packages/skos/ns.ttl b/packages/skos/ns.ttl
index 681a0c2..e97dbd5 100644
--- a/packages/skos/ns.ttl
+++ b/packages/skos/ns.ttl
@@ -8,6 +8,7 @@
 @prefix skos:    .
 
 : a owl:Ontology ;
+    owl:imports  ;
     rdfs:label "SKOS package ontology".
 
 # Concept