Skip to content

Commit

Permalink
Introduce external ontology handling.
Browse files Browse the repository at this point in the history
With this PR external ontologies can be pulled and combined to create the KMS data.
Every onology contains of a prefix, and three parts: prefix_entities.ttl, prefix_knowledge.ttl
and prefix_shacl.ttl. Different ontologies can be pulled together with a make target:
make ontology2kms ONTOLOGIES="base filter"
would pull in base and filter ontologies and compile a joint kms structure.
The PR provides:
* Syncing of knowledge configmaps between debezium-bridge and semantic model
* Added stakater/Reloader to restart debezium-bridge when new knowledge is deployed
* Extended SPARQL parser to enable consistent inheritance of RDFS Types when creating SHACL constraints and rules
* Tolerating of rdfs:subClassOf* path expression
* Streamlining of Knowledge closure calculation across all tools and add explicit script to calculate
  knowledge closure (create_knowledge_closure.py)
* Add explicit tool to execute SPARQL query (check_sparql_expression.py)
* For the time being - drop the sh:ord based deterministic ordering of fields. It creates confusion but will be needed in future
  to allow forward compatibility. For the time being, deterministic ordering is achieved by lexical ordering by field names.

Related EPIC: #514
Related User Story: #515

Signed-off-by: marcel <wagmarcel@web.de>
  • Loading branch information
wagmarcel committed Mar 19, 2024
1 parent ab37976 commit f27ec12
Show file tree
Hide file tree
Showing 34 changed files with 1,341 additions and 1,275 deletions.
1 change: 1 addition & 0 deletions helm/airgap-deployment/prepare-airgap.bash
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ wget -O- https://github.com/strimzi/strimzi-kafka-operator/releases/download/${S
( cd ${OFFLINE_DIR} && rm -rf emqx-operator && git clone https://github.com/emqx/emqx-operator.git && cd emqx-operator && git checkout ${EMQX_OPERATOR_VERSION} )
( cd ${OFFLINE_DIR} && rm -rf postgres-operator && git clone https://github.com/zalando/postgres-operator.git && cd postgres-operator && git checkout ${POSTGRES_OPERATOR_VERSION} )
( cd ${OFFLINE_DIR} && rm -rf helm-charts && git clone https://github.com/vmware-tanzu/helm-charts.git && cd helm-charts && git checkout ${VELERO_HELM_VERSION})
( cd ${OFFLINE_DIR} && rm -rf Reloader && git clone https://github.com/stakater/Reloader.git && cd Reloader && git checkout ${RELOADER_HELM_VERSION})
1 change: 0 additions & 1 deletion helm/charts/kafka-bridges/kms

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,5 @@ spec:
items:
- key: "config.json"
path: "config.json"
- key: "knowledge.ttl"
path: "knowledge.ttl"
imagePullSecrets:
- name: {{ .Values.pullSecretCredentials }}
3 changes: 1 addition & 2 deletions helm/charts/kafka-bridges/templates/bridge-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,4 @@ data:
"password": "POSTGRES_PASSWORD"
}
}
knowledge.ttl: |
{{ .Files.Get "kms/knowledge.ttl" | indent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: debezium-bridge
annotations:
configmap.reloader.stakater.com/reload: "knowledge"
spec:
replicas: {{ .Values.kafkaBridge.debezium.replicaCount }}
selector:
Expand Down Expand Up @@ -45,19 +47,20 @@ spec:
initialDelaySeconds: 5
volumeMounts:
- name: config
mountPath: /opt/config
mountPath: /opt/config/config.json
readOnly: true
subPath: config.json
- name: knowledge-config
mountPath: /opt/config/knowledge.ttl
subPath: knowledge.ttl
readOnly: true
resources:
volumes:
- name: config
configMap:
# Provide the name of the ConfigMap you want to mount.
name: bridge-configmap
# An array of keys from the ConfigMap to create as files
items:
- key: "config.json"
path: "config.json"
- key: "knowledge.ttl"
path: "knowledge.ttl"
- name: knowledge-config
configMap:
name: knowledge
imagePullSecrets:
- name: {{ .Values.pullSecretCredentials }}
30 changes: 30 additions & 0 deletions helm/charts/kafka-bridges/templates/knowledge-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# yamllint disable rule:line-length
# yamllint disable rule:braces
apiVersion: v1
kind: ConfigMap
metadata:
name: knowledge
namespace: {{ .Release.Namespace }}
labels:
app: knowledge
data:
{{- $configmap := (lookup "v1" "ConfigMap" .Release.Namespace "knowledge") }}
{{- if $configmap }}
{{- $knowledge := get $configmap.data "knowledge.ttl" }}
knowledge.ttl: {{ $knowledge | quote }}
{{- else }}
knowledge.ttl: |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX iff: <https://industry-fusion.com/types/v0.9/>
PREFIX oee: <https://industry-fusion.com/oee/v0.9/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
### Test classes
iff:cutter_test rdfs:subClassOf iff:machine_test ;
a rdfs:Class .
iff:plasmacutter_test rdfs:subClassOf iff:cutter_test ;
a rdfs:Class .
### End of Test Content
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,5 @@ spec:
items:
- key: "config.json"
path: "config.json"
- key: "knowledge.ttl"
path: "knowledge.ttl"
imagePullSecrets:
- name: {{ .Values.pullSecretCredentials }}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,5 @@ spec:
items:
- key: "config.json"
path: "config.json"
- key: "knowledge.ttl"
path: "knowledge.ttl"
imagePullSecrets:
- name: {{ .Values.pullSecretCredentials }}
6 changes: 5 additions & 1 deletion helm/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ db:
clusterSvcPostfix: cluster
svcPort: "5432"
dbUser: "ngb"
oispdbUser: "oisp"
oispdbUser: "oisp"

ontology:
baseUri: https://industryfusion.github.io/contexts/staging/ontology/v0.1/

1 change: 1 addition & 0 deletions helm/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export STRIMZI_VERSION="0.32.0"
export OFFLINE=${OFFLINE:-false}
export OFFLINE_DIR=$(cd $DIRNAME/airgap-deployment; pwd)
export KEYCLOAK_VERSION=21.1.2
export RELOADER_HELM_VERSION=v1.0.67
COMMON_MAIN_REGISTRY=$(yq ".mainRegistry" < $DIRNAME/common.yaml)
COMMON_EXTERNAL_REGISTRY=$(yq ".externalRegistry" < $DIRNAME/common.yaml)
COMMON_EXTERNAL_REGISTRY2=$(yq ".externalRegistry2" < $DIRNAME/common.yaml)
Expand Down
14 changes: 14 additions & 0 deletions helm/install_operators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,25 @@ fi
sleep 10
done


printf "\n"
printf "\033[1mInstalling Reloader Operator\n"
printf -- "------------------------\033[0m\n"
if [ "$OFFLINE" = "true" ]; then
( cd ${OFFLINE_DIR}/Reloader && helm upgrade --install --atomic reloader ./deployments/kubernetes/chart/reloader \
--set reloader.image.name=${REGISTRY}/stakater/reloader --set reloader.reloadOnCreate=true)
else
helm repo add stakater https://stakater.github.io/stakater-charts
helm repo update
helm upgrade --install reloader stakater/reloader --version ${RELOADER_HELM_VERSION} --set reloader.reloadOnCreate=true
fi

printf "\n"
printf "\033[1mPrepare Velero Helm Chart Repo\n"
printf -- "------------------------\033[0m\n"

if [ ! "$OFFLINE" = "true" ]; then
( cd ${OFFLINE_DIR} && rm -rf helm-charts && git clone https://github.com/vmware-tanzu/helm-charts.git && cd helm-charts && git checkout ${VELERO_HELM_VERSION} )
fi

printf -- "\033[1mOperators installed successfully.\033[0m\n"
Loading

0 comments on commit f27ec12

Please sign in to comment.