diff --git a/projects/dsp-ui/package.json b/projects/dsp-ui/package.json
index ff7b5d6d7..cecc98c22 100644
--- a/projects/dsp-ui/package.json
+++ b/projects/dsp-ui/package.json
@@ -21,7 +21,7 @@
"@angular/core": "^9.0.0",
"@angular/material": "^9.0.0",
"@angular/cdk": "^9.0.0",
- "@dasch-swiss/dsp-js": "^1.0.1",
+ "@dasch-swiss/dsp-js": "^1.1.0",
"jdnconvertiblecalendar": "^0.0.5",
"jdnconvertiblecalendardateadapter": "^0.0.13",
"ngx-color-picker": "^10.0.1",
diff --git a/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.spec.ts b/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.spec.ts
index e61eb8422..eaa62893e 100644
--- a/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.spec.ts
+++ b/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.spec.ts
@@ -12,7 +12,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { By } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
- ApiResponseError, Constants,
+ ApiResponseError,
+ Constants,
DeleteValue,
DeleteValueResponse,
MockResource,
@@ -303,13 +304,13 @@ class TestHostDisplayValueComponent implements OnInit {
standoffLinkVal.linkedResourceIri = 'testIri';
const propDefinition = this.readResource.entityInfo.properties['http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue'];
- propDefinition.id = 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue';
+ propDefinition.id = Constants.HasStandoffLinkToValue;
const guiDefinition = this.readResource.entityInfo.classes['http://0.0.0.0:3333/ontology/0001/anything/v2#Thing'].propertiesList.filter(
propDefForGui => propDefForGui.propertyIndex === 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue'
);
- guiDefinition[0].propertyIndex = 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue';
+ guiDefinition[0].propertyIndex = Constants.HasStandoffLinkToValue;
const propInfo: PropertyInfoValues = {
values: [standoffLinkVal],
@@ -706,7 +707,7 @@ describe('DisplayEditComponent', () => {
it('should choose the apt component for a link value (standoff link) in the template', () => {
testHostComponent.assignValue('http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue');
- testHostComponent.readValue.property = Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasStandoffLinkToValue';
+ testHostComponent.readValue.property = Constants.HasStandoffLinkToValue;
testHostComponent.readValue.attachedToUser = 'http://www.knora.org/ontology/knora-admin#SystemUser'; // sstandoff links are managed by the system
testHostFixture.detectChanges();
@@ -714,7 +715,7 @@ describe('DisplayEditComponent', () => {
expect(testHostComponent.displayEditValueComponent.displayValueComponent.displayValue instanceof ReadLinkValue).toBe(true);
expect(testHostComponent.displayEditValueComponent.displayValueComponent.mode).toEqual('read');
expect((testHostComponent.displayEditValueComponent.displayValueComponent as unknown as TestLinkValueComponent).parentResource instanceof ReadResource).toBe(true);
- expect((testHostComponent.displayEditValueComponent.displayValueComponent as unknown as TestLinkValueComponent).propIri).toEqual('http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue');
+ expect((testHostComponent.displayEditValueComponent.displayValueComponent as unknown as TestLinkValueComponent).propIri).toEqual(Constants.HasStandoffLinkToValue);
const userServiceSpy = TestBed.inject(UserService);
diff --git a/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.ts b/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.ts
index 2f0dd4c7f..e5887303f 100644
--- a/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.ts
+++ b/projects/dsp-ui/src/lib/viewer/operations/display-edit/display-edit.component.ts
@@ -176,7 +176,7 @@ export class DisplayEditComponent implements OnInit {
// find the PropertyInfoValues for the standoff link value
const standoffLinkPropInfoVals: PropertyInfoValues[] = this.propArray.filter(
resPropInfoVal => {
- return resPropInfoVal.propDef.id === "http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue";
+ return resPropInfoVal.propDef.id === Constants.HasStandoffLinkToValue;
}
);
diff --git a/projects/dsp-ui/src/lib/viewer/services/value.service.spec.ts b/projects/dsp-ui/src/lib/viewer/services/value.service.spec.ts
index aa5d3ca05..c3534a05e 100644
--- a/projects/dsp-ui/src/lib/viewer/services/value.service.spec.ts
+++ b/projects/dsp-ui/src/lib/viewer/services/value.service.spec.ts
@@ -1,6 +1,7 @@
import { TestBed } from '@angular/core/testing';
import {
+ Constants,
KnoraDate, KnoraPeriod,
MockResource, ReadDateValue,
ReadIntValue, ReadLinkValue,
@@ -44,7 +45,7 @@ describe('ValueService', () => {
const readTextValueAsXml = new ReadTextValueAsXml();
readTextValueAsXml.type = 'http://api.knora.org/ontology/knora-api/v2#TextValue';
- readTextValueAsXml.mapping = 'http://rdfh.ch/standoff/mappings/StandardMapping';
+ readTextValueAsXml.mapping = Constants.StandardMapping;
expect(service.isTextEditable(readTextValueAsXml)).toBeTruthy();
});
@@ -153,7 +154,7 @@ describe('ValueService', () => {
it('should not mark ReadTextValueAsXml with standard mapping as ReadOnly', () => {
const readTextValueAsXml = new ReadTextValueAsXml();
readTextValueAsXml.type = 'http://api.knora.org/ontology/knora-api/v2#TextValue';
- readTextValueAsXml.mapping = 'http://rdfh.ch/standoff/mappings/StandardMapping';
+ readTextValueAsXml.mapping = Constants.StandardMapping;
const resPropDef = new ResourcePropertyDefinition();
resPropDef.isEditable = true;
diff --git a/projects/dsp-ui/src/lib/viewer/services/value.service.ts b/projects/dsp-ui/src/lib/viewer/services/value.service.ts
index 40a6911c1..ba902914f 100644
--- a/projects/dsp-ui/src/lib/viewer/services/value.service.ts
+++ b/projects/dsp-ui/src/lib/viewer/services/value.service.ts
@@ -125,7 +125,7 @@ export class ValueService {
* @param textValue the text value to be checked.
*/
isTextEditable(textValue: ReadTextValueAsXml): boolean {
- return textValue.mapping === 'http://rdfh.ch/standoff/mappings/StandardMapping';
+ return textValue.mapping === Constants.StandardMapping;
}
/**
diff --git a/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.spec.ts b/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.spec.ts
index d07d145d9..288363f1e 100644
--- a/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.spec.ts
+++ b/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.spec.ts
@@ -15,7 +15,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@a
import { MatInputModule } from '@angular/material/input';
import { By } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { CreateTextValueAsXml, MockResource, ReadTextValueAsXml, UpdateTextValueAsXml } from '@dasch-swiss/dsp-js';
+import { Constants, CreateTextValueAsXml, MockResource, ReadTextValueAsXml, UpdateTextValueAsXml } from '@dasch-swiss/dsp-js';
import { TextValueAsXMLComponent } from './text-value-as-xml.component';
/**
@@ -361,7 +361,7 @@ describe('TextValueAsXMLComponent', () => {
const newXml = new ReadTextValueAsXml();
newXml.xml = 'my updated text
';
- newXml.mapping = 'http://rdfh.ch/standoff/mappings/StandardMapping';
+ newXml.mapping = Constants.StandardMapping;
newXml.id = 'updatedId';
@@ -514,7 +514,7 @@ describe('TextValueAsXMLComponent', () => {
expect(newValue instanceof CreateTextValueAsXml).toBeTruthy();
expect((newValue as CreateTextValueAsXml).xml).toEqual('created text
');
- expect((newValue as CreateTextValueAsXml).mapping).toEqual('http://rdfh.ch/standoff/mappings/StandardMapping');
+ expect((newValue as CreateTextValueAsXml).mapping).toEqual(Constants.StandardMapping);
});
it('should reset form after cancellation', () => {
diff --git a/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.ts b/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.ts
index 451a3a53b..b82860696 100644
--- a/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.ts
+++ b/projects/dsp-ui/src/lib/viewer/values/text-value/text-value-as-xml/text-value-as-xml.component.ts
@@ -26,7 +26,7 @@ const resolvedPromise = Promise.resolve(null);
})
export class TextValueAsXMLComponent extends BaseValueComponent implements OnInit, OnChanges, OnDestroy {
- readonly standardMapping = 'http://rdfh.ch/standoff/mappings/StandardMapping'; // TODO: define this somewhere else
+ readonly standardMapping = Constants.StandardMapping; // TODO: define this somewhere else
@Input() displayValue?: ReadTextValueAsXml;
diff --git a/projects/dsp-ui/src/lib/viewer/views/property-view/property-view.component.spec.ts b/projects/dsp-ui/src/lib/viewer/views/property-view/property-view.component.spec.ts
index a7214a36a..edd73bd2d 100644
--- a/projects/dsp-ui/src/lib/viewer/views/property-view/property-view.component.spec.ts
+++ b/projects/dsp-ui/src/lib/viewer/views/property-view/property-view.component.spec.ts
@@ -5,6 +5,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { By } from '@angular/platform-browser';
import {
ApiResponseError,
+ Constants,
IHasPropertyWithPropertyDefinition,
MockResource,
ReadLinkValue,
@@ -321,7 +322,7 @@ describe('PropertyViewComponent', () => {
it('should determine that adding a standoff link value is not allowed', () => {
const standoffLinkVal = testHostComponent.propArray.filter(
- propVal => propVal.propDef.id === 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'
+ propVal => propVal.propDef.id === Constants.HasStandoffLinkToValue
);
expect(testHostComponent.propertyViewComponent.addValueIsAllowed(standoffLinkVal[0])).toBeFalsy();
diff --git a/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.spec.ts b/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.spec.ts
index 8304d2b01..5333a8b79 100644
--- a/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.spec.ts
+++ b/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.spec.ts
@@ -4,6 +4,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { By } from '@angular/platform-browser';
import {
+ Constants,
DeleteValue,
MockResource,
PropertyDefinition,
@@ -263,10 +264,10 @@ describe('ResourceViewComponent', () => {
const linkVal = res.getValuesAs('http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue', ReadLinkValue);
- linkVal[0].property = 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue';
+ linkVal[0].property = Constants.HasStandoffLinkToValue;
linkVal[0].linkedResourceIri = 'testId';
- res.properties['http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'] = linkVal;
+ res.properties[Constants.HasStandoffLinkToValue] = linkVal;
return new ReadResourceSequence([res]);
}
@@ -286,7 +287,7 @@ describe('ResourceViewComponent', () => {
);
const propArrStandoffLinkValues = testHostComponent.resourceViewComponent.resPropInfoVals.filter(
- propInfoValueArray => propInfoValueArray.propDef.id === 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'
+ propInfoValueArray => propInfoValueArray.propDef.id === Constants.HasStandoffLinkToValue
);
expect(propArrayXmlValues[0].values.length).toEqual(1);
@@ -408,7 +409,7 @@ describe('ResourceViewComponent', () => {
);
const existingStandoffLinkVal = testHostComponent.resourceViewComponent.resPropInfoVals.filter(
- propInfo => propInfo.propDef.id === 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'
+ propInfo => propInfo.propDef.id === Constants.HasStandoffLinkToValue
);
// add value
@@ -417,7 +418,7 @@ describe('ResourceViewComponent', () => {
const standoffLinkVal = new ReadLinkValue();
standoffLinkVal.linkedResourceIri = 'testId';
- standoffLinkVal.property = 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue';
+ standoffLinkVal.property = Constants.HasStandoffLinkToValue;
// add corresponding link val
existingStandoffLinkVal[0].values.push(standoffLinkVal);
@@ -507,9 +508,9 @@ describe('ResourceViewComponent', () => {
const linkVal = res.getValuesAs('http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue', ReadLinkValue);
linkVal[0].linkedResourceIri = 'testId';
- linkVal[0].property = 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue';
+ linkVal[0].property = Constants.HasStandoffLinkToValue;
- res.properties['http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'] = linkVal;
+ res.properties[Constants.HasStandoffLinkToValue] = linkVal;
return new ReadResourceSequence([res]);
}
@@ -530,7 +531,7 @@ describe('ResourceViewComponent', () => {
);
const propArrStandoffLinkValues = testHostComponent.resourceViewComponent.resPropInfoVals.filter(
- propInfoValueArray => propInfoValueArray.propDef.id === 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'
+ propInfoValueArray => propInfoValueArray.propDef.id === Constants.HasStandoffLinkToValue
);
propArrayXmlValues[0].values.push(newReadXmlValue);
diff --git a/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.ts b/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.ts
index 1b6ba43ef..a01978584 100644
--- a/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.ts
+++ b/projects/dsp-ui/src/lib/viewer/views/resource-view/resource-view.component.ts
@@ -313,11 +313,11 @@ export class ResourceViewComponent implements OnInit, OnChanges, OnDestroy {
return;
}
- const newStandoffLinkVals = res.resources[0].getValuesAs('http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue', ReadLinkValue);
+ const newStandoffLinkVals = res.resources[0].getValuesAs(Constants.HasStandoffLinkToValue, ReadLinkValue);
this.resPropInfoVals.filter(
resPropInfoVal => {
- return resPropInfoVal.propDef.id === 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue';
+ return resPropInfoVal.propDef.id === Constants.HasStandoffLinkToValue;
}
).forEach(
standoffLinkResPropInfoVal => {