Skip to content
Snippets Groups Projects
Commit 2edadbea authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Update: Inheritance with owl:imports

parent 3c4cb104
Branches
Tags
1 merge request!21Chore: 1.3.0
......@@ -18,7 +18,7 @@
@input="setUrl"
trim
/>
<div v-for="formEntry in form" :key="formEntry.url">
<div v-for="formEntry in visibleForm" :key="formEntry.url">
<label
:for="labelPrefix + formEntry.name"
:id="labelPrefix + formEntry.name + 'Label'"
......@@ -62,6 +62,7 @@ import {
editNodeShapeProperties,
getApplicationProfileProperty,
getApplicationProfileTargetClass,
owlPrefix,
rdfsPrefix,
shPrefix,
} from "@/util/linkedData";
......@@ -104,6 +105,15 @@ export default Vue.extend({
url: shPrefix + "targetClass",
value: "",
},
{
hidden: true,
locale: false,
multiline: false,
name: "imports",
type: "url",
url: owlPrefix + "imports",
value: "",
},
] as NodeShapeProperty[],
isOpen: false,
};
......@@ -160,6 +170,9 @@ export default Vue.extend({
this.definition
);
},
visibleForm(): NodeShapeProperty[] {
return this.form.filter((entry) => !entry.hidden);
},
},
watch: {
"applicationProfile.base_url"() {
......@@ -185,6 +198,7 @@ export default Vue.extend({
},
save() {
changeBaseUrl(this.applicationProfile, this.definition, this.url);
this.setImports();
editNodeShapeProperties(
this.applicationProfile,
this.definition,
......@@ -198,6 +212,17 @@ export default Vue.extend({
this.setFormProperty(property.name, definitionValue);
});
},
setImports() {
const shNode = this.form.find(
(formEntry) => formEntry.url === shPrefix + "node"
);
const owlImports = this.form.find(
(formEntry) => formEntry.url === owlPrefix + "imports"
);
if (shNode !== undefined && owlImports !== undefined) {
this.setForm(owlImports, shNode.value);
}
},
setForm(property: NodeShapeProperty, value: string) {
property.value = value;
},
......
declare interface NodeShapeProperty {
hidden?: boolean;
locale: boolean;
multiline: boolean;
name: string;
......
......@@ -19,6 +19,7 @@ import {
import { v4 as uuidv4 } from "uuid";
export const aimsPrefix = "https://aims.org/applicationProfiles/";
export const owlPrefix = "http://www.w3.org/2002/07/owl#";
export const rdfPrefix = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
export const rdfsPrefix = "http://www.w3.org/2000/01/rdf-schema#";
export const shPrefix = "http://www.w3.org/ns/shacl#";
......@@ -300,7 +301,9 @@ export function editNodeShapeProperties(
dataset.removeMatches(baseUrlNode, predicate);
}
dataset.add(factory.quad(baseUrlNode, predicate, object));
if (property.value !== "") {
dataset.add(factory.quad(baseUrlNode, predicate, object));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment