Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofstetter Benjamin (extern) committed Aug 16, 2024
1 parent 091430c commit 07174e9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,60 @@ import { ClownfaceObject } from '@blueprint/model/clownface-object/clownface-obj

export class HierarchyNode extends ClownfaceObject {

private _children: HierarchyNode[] | null = null;
private _targetClass: string | null = null;
private _label: string | null = null;
private _classLabel: string | null = null;
private _parent: HierarchyNode | null | undefined = undefined;
#_children: HierarchyNode[] | null = null;
#_targetClass: string | null = null;
#_label: string | null = null;
#_classLabel: string | null = null;
#_parent: HierarchyNode | null | undefined = undefined;

constructor(cfNode: GraphPointer) {
super(cfNode);
}

get label(): string {
if (this._label === null) {
this._label = this._node.out(rdfs.labelNamedNode).value ?? '';
if (this.#_label === null) {
this.#_label = this._node.out(rdfs.labelNamedNode).value ?? '';
}
return this.label;
return this.#_label;
}

get children(): HierarchyNode[] {
if (this._children === null) {
this._children = this._node.out(shacl.propertyNamedNode).out(shacl.nodeNamedNode).map(childNode => new HierarchyNode(childNode));
if (this.#_children === null) {
this.#_children = this._node.out(shacl.propertyNamedNode).out(shacl.nodeNamedNode).map(childNode => new HierarchyNode(childNode));
}
return this._children;
return this.#_children;
}

get targetClass(): string {
if (this._targetClass === null) {
if (this.#_targetClass === null) {
const targetClasses = this._node.out(shacl.targetClassNamedNode).values;
if (targetClasses.length === 0) {
console.warn(`No targetClass found for node ${this.iri}. Use an empty string.`);
this._targetClass = '';
this.#_targetClass = '';
} else {
if (targetClasses.length > 1) {
console.warn(`Expected exactly one targetClass for node ${this.iri}. Found ${targetClasses.length}. Use the first one.`);
}
this._targetClass = targetClasses[0];
this.#_targetClass = targetClasses[0];
}
}
return this._targetClass;
return this.#_targetClass;
}

get classLabel(): string {
if (this._classLabel === null) {
if (this.#_classLabel === null) {
const classLabels = this._node.out(shacl.targetClassNamedNode).in(shacl.targetNodeNamedNode).out(rdfs.labelNamedNode).values;
if (classLabels.length === 0) {
console.warn(`No classLabel found for node ${this.iri}. Use an empty string.`);
this._classLabel = '';
this.#_classLabel = '';
} else {
if (classLabels.length > 1) {
console.warn(`Expected exactly one classLabel for node ${this.iri}. Found ${classLabels.length}. Use the first one.`);
}
this._classLabel = classLabels[0];
this.#_classLabel = classLabels[0];
}
}
return this._classLabel;
return this.#_classLabel;
}

get pathToParent(): string | null {
Expand Down Expand Up @@ -117,18 +117,18 @@ export class HierarchyNode extends ClownfaceObject {


get parent(): HierarchyNode | null {
if (this._parent === undefined) {
if (this.#_parent === undefined) {
const parent = this._node.in(shacl.nodeNamedNode).in(shacl.propertyNamedNode);
if (parent.values.length === 0) {
this._parent = null;
this.#_parent = null;
} else {
if (parent.values.length > 1) {
console.warn(`Expected exactly one parent for node ${this.iri}. Found ${parent.values.length}. Use the first one.`);
}
this._parent = new HierarchyNode(parent.toArray()[0]);
this.#_parent = new HierarchyNode(parent.toArray()[0]);
}
}
return this._parent;
return this.#_parent;
}

}
6 changes: 3 additions & 3 deletions proxy.conf.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"/query": {
"target_1": "https://ld.aws.zazukoians.org/query",
"target_2": "https://ld.flux.zazuko.com/query",
"target": "http://localhost:8080/query",
"target_334": "https://ld.flux.zazuko.com/query",
"target_12": "http://localhost:8080/query",
"target_4": "https://ld.aws.zazukoians.org/query",
"target_11": "http://127.0.0.1:7200/repositories/edc",
"target": "http://127.0.0.1:7200/repositories/blueprint",
"headers": {
"Connection": "keep-alive"
},
Expand Down

0 comments on commit 07174e9

Please sign in to comment.