diff --git a/.angular-cli.json b/.angular-cli.json
deleted file mode 100644
index 46f858ec..00000000
--- a/.angular-cli.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
- "project": {
- "version": "1.0.0-beta.17.5",
- "name": "salsah"
- },
- "apps": [
- {
- "root": "src",
- "outDir": "dist",
- "assets": [
- "favicon.ico",
- "assets",
- "data",
- "i18n"
- ],
- "index": "index.html",
- "main": "main.ts",
- "polyfills": "polyfills.ts",
- "test": "test.ts",
- "tsconfig": "tsconfig.app.json",
- "testTsconfig": "tsconfig.spec.json",
- "prefix": "salsah",
- "styles": [
- "index.style.css",
- "assets/style/mat-teal-amber.scss",
- "assets/style/main.scss",
- "themes/beol/main.scss"
- ],
- "scripts": [
- "../node_modules/openseadragon/build/openseadragon/openseadragon.min.js",
- "../node_modules/svg-overlay/openseadragon-svg-overlay.js"
- ],
- "environmentSource": "environments/environment.ts",
- "environments": {
- "dev": "environments/environment.ts",
- "prod": "environments/environment.prod.ts",
- "test": "environments/environment.test.ts",
- "mock": "environments/environment.mock.ts",
- "beol": "environments/environment.beol.ts",
- "it": "environments/environment.integration.ts"
- }
- }
- ],
- "e2e": {
- "protractor": {
- "config": "./protractor.conf.js"
- }
- },
- "lint": [
- {
- "project": "src/tsconfig.app.json"
- },
- {
- "project": "src/tsconfig.spec.json"
- },
- {
- "project": "e2e/tsconfig.e2e.json"
- }
- ],
- "test": {
- "karma": {
- "config": "./karma.conf.js"
- }
- },
- "defaults": {
- "styleExt": "scss",
- "component": {}
- }
-}
diff --git a/.travis.yml b/.travis.yml
index 09cb57ca..346ad16c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,21 +7,35 @@ node_js:
- "8"
cache:
+ yarn: true
directories:
- - "node_modules"
+ - node_modules
addons:
chrome: stable
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - g++-4.9
+
+env:
+ global:
+ - CXX=g++-4.9
+
+install: export CXX="g++-4.9"
before_script:
- yarn global add @angular/cli
+ - yarn install
script:
- - ng test --reporters=spec --browser=ChromeHeadless --single-run=true
+ - ng test --watch=false --browsers=ChromeHeadless # --reporters=spec --browser=ChromeHeadless --single-run=true
# this should really be fixed in the package itself (https://github.com/dhlab-basel/JDNConvertibleCalendarDateAdapter/issues/5)
- - cp fixes/jdnconvertiblecalendardateadapter/index.d.ts node_modules/jdnconvertiblecalendardateadapter/dist/index.d.ts
+ # - cp fixes/jdnconvertiblecalendardateadapter/index.d.ts node_modules/jdnconvertiblecalendardateadapter/dist/index.d.ts
- ng build --prod --build-optimizer
notifications:
slack:
secure: "fzFYDu/Ooy8SM49Z1FFe/owOp4OXwPkoGjp1Vm3kadP/25pvwqGmQkkEX0urSTpZuMc+LvipLMUD33RxVEP2R4V9qlWzdoZ/AW61GSUzkVdhJZwnJJ5D8BXCulajKgGdXAsv2qZ7Qq7yQnom2gpYClzWo02aXIH+HCN76jUhrMS+ELeeqrxMF4ritw/j32T1E4t+oZRDK3Al08y+5e8zZHAzG5xH9JUOhg15novNveTC77KbXUKkvfSt96tPPwK03W0yC1+AtXcYxC0tLecqxbDFm5RRli8IeTSEq1BKij335MbEWfQepSDg0MlvrbKuP7TJ0c1eBotUBCpfa5NBsD+mFs36EuBsMRdQpDHEPIr0ExhcrblAQJ+2MwzEq5hpDdZDXnZ7zuvzrsb5qlZuaOOZLDxblPxZhrIrgOPPRqvQK0qUUPU0Bjew/cL42MtQpN2/3H6u22NK/ortLVUEZVb9cIT4KnMOB4ExdDiNMc2Y8eqZez/F+QoKEJYYx8W48LGQBaTrrrvL2sBCTK0NjaR8xxDAJWH0NwsBpikWP5S8RtzLKlDgytwTZlc8sxlBVzsyYu1kq6nmT2zMQyyBAB7oVrvsrBcUStCpGIwcspYmDHT7x810INMWzkP8QfdTb/0fLzdhc4fWrf2khMBM47JrWM4fxtCQA65BvfNlj+k="
+
diff --git a/angular.json b/angular.json
new file mode 100644
index 00000000..116ab626
--- /dev/null
+++ b/angular.json
@@ -0,0 +1,188 @@
+{
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
+ "version": 1,
+ "newProjectRoot": "projects",
+ "projects": {
+ "salsah": {
+ "root": "",
+ "sourceRoot": "src",
+ "projectType": "application",
+ "architect": {
+ "build": {
+ "builder": "@angular-devkit/build-angular:browser",
+ "options": {
+ "outputPath": "dist",
+ "index": "src/index.html",
+ "main": "src/main.ts",
+ "tsConfig": "src/tsconfig.app.json",
+ "polyfills": "src/polyfills.ts",
+ "assets": [
+ "src/favicon.ico",
+ "src/assets",
+ "src/data",
+ "src/i18n"
+ ],
+ "styles": [
+ "src/index.style.css",
+ "src/assets/style/mat-teal-amber.scss",
+ "src/assets/style/main.scss",
+ "src/themes/beol/main.scss"
+ ],
+ "scripts": [
+ "node_modules/openseadragon/build/openseadragon/openseadragon.min.js",
+ "node_modules/svg-overlay/openseadragon-svg-overlay.js"
+ ]
+ },
+ "configurations": {
+ "production": {
+ "optimization": true,
+ "outputHashing": "all",
+ "sourceMap": false,
+ "extractCss": true,
+ "namedChunks": false,
+ "aot": true,
+ "extractLicenses": true,
+ "vendorChunk": false,
+ "buildOptimizer": true,
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.prod.ts"
+ }
+ ]
+ },
+ "test": {
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.test.ts"
+ }
+ ]
+ },
+ "mock": {
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.mock.ts"
+ }
+ ]
+ },
+ "beol": {
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.beol.ts"
+ }
+ ]
+ },
+ "it": {
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.integration.ts"
+ }
+ ]
+ }
+ }
+ },
+ "serve": {
+ "builder": "@angular-devkit/build-angular:dev-server",
+ "options": {
+ "browserTarget": "salsah:build"
+ },
+ "configurations": {
+ "production": {
+ "browserTarget": "salsah:build:production"
+ },
+ "test": {
+ "browserTarget": "salsah:build:test"
+ },
+ "mock": {
+ "browserTarget": "salsah:build:mock"
+ },
+ "beol": {
+ "browserTarget": "salsah:build:beol"
+ },
+ "it": {
+ "browserTarget": "salsah:build:it"
+ }
+ }
+ },
+ "extract-i18n": {
+ "builder": "@angular-devkit/build-angular:extract-i18n",
+ "options": {
+ "browserTarget": "salsah:build"
+ }
+ },
+ "test": {
+ "builder": "@angular-devkit/build-angular:karma",
+ "options": {
+ "main": "src/test.ts",
+ "karmaConfig": "./karma.conf.js",
+ "polyfills": "src/polyfills.ts",
+ "tsConfig": "src/tsconfig.spec.json",
+ "scripts": [
+ "node_modules/openseadragon/build/openseadragon/openseadragon.min.js",
+ "node_modules/svg-overlay/openseadragon-svg-overlay.js"
+ ],
+ "styles": [
+ "src/index.style.css",
+ "src/assets/style/mat-teal-amber.scss",
+ "src/assets/style/main.scss",
+ "src/themes/beol/main.scss"
+ ],
+ "assets": [
+ "src/favicon.ico",
+ "src/assets",
+ "src/data",
+ "src/i18n"
+ ]
+ }
+ },
+ "lint": {
+ "builder": "@angular-devkit/build-angular:tslint",
+ "options": {
+ "tsConfig": [
+ "src/tsconfig.app.json",
+ "src/tsconfig.spec.json"
+ ],
+ "exclude": []
+ }
+ }
+ }
+ },
+ "salsah-e2e": {
+ "root": "",
+ "sourceRoot": "e2e",
+ "projectType": "application",
+ "architect": {
+ "e2e": {
+ "builder": "@angular-devkit/build-angular:protractor",
+ "options": {
+ "protractorConfig": "./protractor.conf.js",
+ "devServerTarget": "salsah:serve"
+ }
+ },
+ "lint": {
+ "builder": "@angular-devkit/build-angular:tslint",
+ "options": {
+ "tsConfig": [
+ "e2e/tsconfig.e2e.json"
+ ],
+ "exclude": []
+ }
+ }
+ }
+ }
+ },
+ "defaultProject": "salsah",
+ "schematics": {
+ "@schematics/angular:component": {
+ "prefix": "salsah",
+ "styleext": "scss"
+ },
+ "@schematics/angular:directive": {
+ "prefix": "salsah"
+ }
+ }
+}
\ No newline at end of file
diff --git a/docs/jekyll/_docs/01-getting-started/prerequisites.md b/docs/jekyll/_docs/01-getting-started/prerequisites.md
index 1785c3f5..f0d980f3 100755
--- a/docs/jekyll/_docs/01-getting-started/prerequisites.md
+++ b/docs/jekyll/_docs/01-getting-started/prerequisites.md
@@ -4,7 +4,7 @@ category: Getting Started
order: 1
---
-We develop the Salsah app with Angular (v5), especially with Angular-cli, which requires the following tools:
+We develop the Salsah app with Angular 6, especially with Angular-cli, which requires the following tools:
### Node
diff --git a/karma.conf.js b/karma.conf.js
index d3302aa2..c8ecaadc 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -4,7 +4,7 @@
module.exports = function (config) {
config.set({
basePath: '',
- frameworks: ['jasmine', '@angular/cli'],
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
@@ -12,7 +12,7 @@ module.exports = function (config) {
require('karma-coverage-istanbul-reporter'),
require('karma-html-detailed-reporter'),
require('karma-spec-reporter'),
- require('@angular/cli/plugins/karma')
+ require('@angular-devkit/build-angular/plugins/karma')
],
client:{
captureConsole: true,
@@ -24,22 +24,20 @@ module.exports = function (config) {
terminal: true
},
files: [
- { pattern: './src/test.ts', watched: false }
+
],
preprocessors: {
- './src/test.ts': ['@angular/cli']
+
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
- reports: [ 'html', 'lcovonly' ],
+ dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
logLevel: config.LOG_LOG,
- angularCli: {
- environment: 'dev'
- },
+
reporters: ['progress', 'kjhtml'],
specReporter: {
suppressPassed: false, // do not print information about passed tests
diff --git a/package.json b/package.json
index 2f85f5ea..25575df3 100644
--- a/package.json
+++ b/package.json
@@ -15,63 +15,76 @@
},
"private": true,
"dependencies": {
- "@angular/animations": "^5.2.2",
- "@angular/cdk": "^5.1.0",
- "@angular/common": "^5.2.2",
- "@angular/compiler": "^5.2.2",
- "@angular/core": "^5.2.2",
- "@angular/forms": "^5.2.2",
- "@angular/http": "^5.2.2",
- "@angular/language-service": "^5.0.0",
- "@angular/material": "^5.1.0",
- "@angular/platform-browser": "^5.2.2",
- "@angular/platform-browser-dynamic": "^5.2.2",
- "@angular/platform-server": "^5.2.2",
- "@angular/router": "^5.2.2",
+ "@angular/animations": "^6.1.1",
+ "@angular/cdk": "^6.4.2",
+ "@angular/common": "^6.1.1",
+ "@angular/compiler": "^6.1.1",
+ "@angular/core": "^6.1.1",
+ "@angular/forms": "^6.1.1",
+ "@angular/http": "^6.1.1",
+ "@angular/material": "^6.4.2",
+ "@angular/platform-browser": "^6.1.1",
+ "@angular/platform-browser-dynamic": "^6.1.1",
+ "@angular/platform-server": "^6.1.1",
+ "@angular/router": "^6.1.1",
"@firebase/app": "^0.1.10",
"@firebase/app-types": "^0.1.2",
- "@ngx-translate/core": "^8.0.0",
+ "@knora/action": "^0.0.9",
+ "@knora/authentication": "^1.0.0-alpha.3",
+ "@knora/core": "^1.0.0-beta.2",
+ "@knora/search": "^1.0.3-alpha",
+ "@ngx-translate/core": "^10.0.0",
"@ngx-translate/http-loader": "^2.0.0",
"angular-split": "^1.0.0-rc.3",
"angular-tree-component": "^6.1.0",
- "angularfire2": "^5.0.0-rc.6",
- "core-js": "^2.5.1",
- "firebase": "^4.9.1",
+ "angularfire2": "^5.0.0-rc.11",
+ "core-js": "^2.5.4",
+ "firebase": "^5.0.0",
"hammerjs": "^2.0.8",
"jdnconvertiblecalendar": "0.0.1",
- "jdnconvertiblecalendardateadapter": "0.0.5",
- "json2typescript": "^1.0.5",
- "jsonld": "^0.4.12",
+ "jdnconvertiblecalendardateadapter": "^0.0.6",
+ "json2typescript": "^1.0.6",
+ "jsonld": "^1.0.2",
+ "moment": "^2.22.2",
"ng-recaptcha": "^3.0.3",
"ng2-dnd": "^5.0.2",
"ngx-infinite-scroll": "^0.8.2",
+ "ngx-markdown": "^6.0.1",
"openseadragon": "^2.3.0",
- "rxjs": "^5.5.2",
+ "rxjs": "^6.0.0",
+ "rxjs-compat": "^6.0.0",
"svg-overlay": "github:openseadragon/svg-overlay",
"ts-helpers": "^1.1.2",
"ts-md5": "^1.2.2",
- "zone.js": "^0.8.18"
+ "zone.js": "^0.8.26"
},
"devDependencies": {
- "@angular/cli": "~1.6.0",
- "@angular/compiler-cli": "^5.2.2",
- "@types/jasmine": "2.8.2",
- "@types/node": "^8.0.53",
- "codelyzer": "~4.0.1",
- "jasmine-core": "~2.8.0",
- "jasmine-spec-reporter": "~4.2.0",
- "karma": "~1.7.0",
+ "@angular-devkit/build-angular": "~0.6.0",
+ "@angular-devkit/build-ng-packagr": "~0.6.0",
+ "@angular/cli": "~6.1.2",
+ "@angular/compiler-cli": "^6.1.1",
+ "@angular/language-service": "^6.1.1",
+ "@types/jasmine": "~2.8.6",
+ "@types/jasminewd2": "~2.0.3",
+ "@types/node": "~8.9.4",
+ "codelyzer": "~4.2.1",
+ "jasmine-core": "~2.99.1",
+ "jasmine-spec-reporter": "~4.2.1",
+ "karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
- "karma-coverage-istanbul-reporter": "^1.3.0",
+ "karma-coverage-istanbul-reporter": "~1.4.2",
"karma-html-detailed-reporter": "^1.1.4",
- "karma-jasmine": "~1.1.0",
+ "karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-spec-reporter": "^0.0.32",
- "protractor": "~5.2.0",
+ "ng-packagr": "^3.0.0-rc.0",
+ "protractor": "~5.3.0",
"source-map-explorer": "^1.5.0",
- "ts-node": "~3.3.0",
- "tslint": "~5.8.0",
- "typescript": "~2.6.1"
+ "ts-node": "~5.0.1",
+ "tsickle": ">=0.25.5",
+ "tslib": "^1.7.1",
+ "tslint": "~5.9.1",
+ "typescript": "~2.7.0"
}
}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 0baa50d2..d3363410 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -12,43 +12,44 @@
* License along with SALSAH. If not, see .
* */
-import {RouterModule, Routes} from '@angular/router';
-import {NgModule} from '@angular/core';
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+import { ProgressIndicatorComponent } from '@knora/action';
+import { AuthGuard } from '@knora/authentication';
+import { DashboardComponent } from './view/dashboard/dashboard.component';
-import {LoginComponent} from './view/login/login.component';
-import {DashboardComponent} from './view/dashboard/dashboard.component';
-import {UserComponent} from './view/dashboard/user/user.component';
+import { ProjectAdvancedComponent } from './view/dashboard/project/project-advanced/project-advanced.component';
+import { ProjectListsAdminComponent } from './view/dashboard/project/project-lists-admin/project-lists-admin.component';
-import {ProjectComponent} from './view/dashboard/project/project.component';
-import {ProjectSettingsComponent} from './view/dashboard/project/project-settings/project-settings.component';
-import {ProjectProfileComponent} from './view/dashboard/project/project-profile/project-profile.component';
-import {ProjectTeamComponent} from './view/dashboard/project/project-team/project-team.component';
-import {ProjectResourcesComponent} from './view/dashboard/project/project-resources/project-resources.component';
-import {ProjectListsAdminComponent} from './view/dashboard/project/project-lists-admin/project-lists-admin.component';
-import {ProjectFormComponent} from './view/modules/form/project-form/project-form.component';
-import {DocumentationComponent} from './view/documentation/documentation.component';
+import { ProjectOntologiesComponent } from './view/dashboard/project/project-ontologies/project-ontologies.component';
+import { ProjectProfileComponent } from './view/dashboard/project/project-profile/project-profile.component';
+import { ProjectResourcesComponent } from './view/dashboard/project/project-resources/project-resources.component';
+import { ProjectSettingsComponent } from './view/dashboard/project/project-settings/project-settings.component';
+import { ProjectTeamComponent } from './view/dashboard/project/project-team/project-team.component';
-import {ProjectAdvancedComponent} from './view/dashboard/project/project-advanced/project-advanced.component';
-import {DevelopmentComponent} from './view/test/development/development.component';
-import {ProgressStepperComponent} from './view/modules/other/progress-stepper/progress-stepper.component';
-import {MessageComponent} from './view/modules/message/message.component';
-import {NewResourceClassComponent} from './view/modules/form/new-resource-class/new-resource-class.component';
-import {SystemComponent} from './view/dashboard/system/system.component';
-import {SystemUsersComponent} from './view/dashboard/system/system-users/system-users.component';
-import {SystemProjectsComponent} from './view/dashboard/system/system-projects/system-projects.component';
-import {SystemOntologiesComponent} from './view/dashboard/system/system-ontologies/system-ontologies.component';
-import {SearchResultsComponent} from './view/search/search-results/search-results.component';
-import {UserFormComponent} from './view/modules/form/user-form/user-form.component';
-import {FormCreateComponent} from './view/test/development/form-create/form-create.component';
-import {ResourceObjectComponent} from './view/modules/object/resource-object/resource-object.component';
-import {ProjectOntologiesComponent} from './view/dashboard/project/project-ontologies/project-ontologies.component';
-import {FormTestComponent} from './view/test/development/form-test/form-test.component';
-import {ContactFormComponent} from './view/modules/form/contact-form/contact-form.component';
-import {BeolComponent} from './view/templates/beol/beol.component';
-import {DialogTestComponent} from './view/test/development/dialog-test/dialog-test.component';
-import {ProgressIndicatorComponent} from './view/modules/other/progress-indicator/progress-indicator.component';
-import {LeooComponent} from './view/templates/leoo/leoo.component';
-import {ObjectViewerComponent} from './view/modules/object/object-viewer/object-viewer.component';
+import { ProjectComponent } from './view/dashboard/project/project.component';
+import { SystemOntologiesComponent } from './view/dashboard/system/system-ontologies/system-ontologies.component';
+import { SystemProjectsComponent } from './view/dashboard/system/system-projects/system-projects.component';
+import { SystemUsersComponent } from './view/dashboard/system/system-users/system-users.component';
+import { SystemComponent } from './view/dashboard/system/system.component';
+import { UserComponent } from './view/dashboard/user/user.component';
+import { DocumentationComponent } from './view/documentation/documentation.component';
+
+import { LoginComponent } from './view/login/login.component';
+import { ContactFormComponent } from './view/modules/form/contact-form/contact-form.component';
+import { NewResourceClassComponent } from './view/modules/form/new-resource-class/new-resource-class.component';
+import { ProjectFormComponent } from './view/modules/form/project-form/project-form.component';
+import { UserFormComponent } from './view/modules/form/user-form/user-form.component';
+import { MessageComponent } from './view/modules/message/message.component';
+import { ObjectViewerComponent } from './view/modules/object/object-viewer/object-viewer.component';
+import { ProgressStepperComponent } from './view/modules/other/progress-stepper/progress-stepper.component';
+import { SearchResultsComponent } from './view/search/search-results/search-results.component';
+import { BeolComponent } from './view/templates/beol/beol.component';
+import { LeooComponent } from './view/templates/leoo/leoo.component';
+import { DevelopmentComponent } from './view/test/development/development.component';
+import { DialogTestComponent } from './view/test/development/dialog-test/dialog-test.component';
+import { FormCreateComponent } from './view/test/development/form-create/form-create.component';
+import { FormTestComponent } from './view/test/development/form-test/form-test.component';
const appRoutes: Routes = [
@@ -70,19 +71,19 @@ const appRoutes: Routes = [
},
{
// User profile = Dashboard for logged in users
- path: 'profile', component: UserComponent
+ path: 'profile', component: UserComponent, canActivate: [AuthGuard],
},
{
// User settings
- path: 'settings', component: UserComponent
+ path: 'settings', component: UserComponent, canActivate: [AuthGuard],
},
{
// User projects
- path: 'projects', component: UserComponent
+ path: 'projects', component: UserComponent, canActivate: [AuthGuard],
},
{
// User collections
- path: 'collections', component: UserComponent
+ path: 'collections', component: UserComponent, canActivate: [AuthGuard],
},
{
path: 'search/:mode/:q',
@@ -97,7 +98,7 @@ const appRoutes: Routes = [
component: ContactFormComponent
},
{
- path: 'project/:pid', component: ProjectComponent,
+ path: 'project/:pid', component: ProjectComponent, canActivate: [AuthGuard],
children: [
{
path: '', component: ProjectProfileComponent
@@ -136,7 +137,7 @@ const appRoutes: Routes = [
]
},
{
- path: 'system', component: SystemComponent,
+ path: 'system', component: SystemComponent, canActivate: [AuthGuard],
children: [
{
path: '', redirectTo: 'projects', pathMatch: 'full'
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index d8e34b53..f3fb1c92 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -4,7 +4,7 @@
bottom: $footer-height;
height: calc(100% - #{$header-height} - #{$footer-height});
overflow: hidden;
-// position: fixed;
+ position: fixed;
top: $header-height;
width: 100%;
}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 92484c84..c8e57178 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -16,7 +16,7 @@ import {Component, OnInit} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
@Component({
- selector: 'app-root',
+ selector: 'salsah-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
diff --git a/src/app/app.config.ts b/src/app/app.config.ts
deleted file mode 100644
index 72d1e64d..00000000
--- a/src/app/app.config.ts
+++ /dev/null
@@ -1,239 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {environment} from '../environments/environment';
-
-/**
- * Knora schemas
- */
-export enum KnoraSchema {
- complex = 0,
- simple = 1
-}
-
-export class AppConfig {
-
- public static FileServer: string = environment.media;
- public static AdminFileServer: string = environment.media + '/server/admin';
-
- public static KnoraOntologyPath: string = 'http://www.knora.org/ontology';
- public static KnoraBase: string = AppConfig.KnoraOntologyPath + '/knora-base';
-
- public static SystemProject: string = AppConfig.KnoraBase + '#SystemProject';
- public static SystemAdminGroup: string = AppConfig.KnoraBase + '#SystemAdmin';
- public static ProjectAdminGroup: string = AppConfig.KnoraBase + '#ProjectAdmin';
- public static ProjectMemberGroup: string = AppConfig.KnoraBase + '#ProjectMember';
-
- public static KnoraApi: string = 'http://api.knora.org/ontology/knora-api';
-
- public static PathSeparator = '#';
-
- public static KnoraApiV2WithValueObjectPath: string = AppConfig.KnoraApi + '/v2' + AppConfig.PathSeparator;
-
- public static KnoraApiV2SimplePath: string = AppConfig.KnoraApi + '/simple/v2' + AppConfig.PathSeparator;
-
- public static isEditable: string = AppConfig.KnoraApiV2WithValueObjectPath + 'isEditable';
- public static isLinkProperty: string = AppConfig.KnoraApiV2WithValueObjectPath + 'isLinkProperty';
- public static isLinkValueProperty: string = AppConfig.KnoraApiV2WithValueObjectPath + 'isLinkValueProperty';
-
-
- public static ResourceIcon: string = AppConfig.KnoraApiV2WithValueObjectPath + 'resourceIcon';
-
- public static RdfProperty: string = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property';
-
- public static OwlClass: string = 'http://www.w3.org/2002/07/owl#Class';
- public static OwlObjectProperty: string = 'http://www.w3.org/2002/07/owl#ObjectProperty';
- public static OwlDatatypeProperty: string = 'http://www.w3.org/2002/07/owl#DatatypeProperty';
- public static OwlAnnotationProperty: string = 'http://www.w3.org/2002/07/owl#AnnotationProperty';
- public static OwlOnProperty: string = 'http://www.w3.org/2002/07/owl#onProperty';
- public static OwlMaxCardinality: string = 'http://www.w3.org/2002/07/owl#maxCardinality';
- public static OwlMinCardinality: string = 'http://www.w3.org/2002/07/owl#minCardinality';
- public static OwlCardinality: string = 'http://www.w3.org/2002/07/owl#cardinality';
- public static ObjectType = AppConfig.KnoraApiV2WithValueObjectPath + 'objectType';
- public static OwlRestriction = 'http://www.w3.org/2002/07/owl#Restriction';
-
- public static creationDate = AppConfig.KnoraApiV2WithValueObjectPath + 'creationDate';
- public static lastModificationDate = AppConfig.KnoraApiV2WithValueObjectPath + 'lastModificationDate';
- public static hasPermissions = AppConfig.KnoraApiV2WithValueObjectPath + 'hasPermissions';
- public static attachedToProject = AppConfig.KnoraApiV2WithValueObjectPath + 'attachedToProject';
- public static attachedToUser = AppConfig.KnoraApiV2WithValueObjectPath + 'attachedToUser';
-
- public static Region = AppConfig.KnoraApiV2WithValueObjectPath + 'Region';
-
- public static Resource: string = AppConfig.KnoraApiV2WithValueObjectPath + 'Resource';
- public static TextValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'TextValue';
- public static IntValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'IntValue';
- public static BooleanValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'BooleanValue';
- public static UriValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'UriValue';
- public static DecimalValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'DecimalValue';
- public static DateValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'DateValue';
- public static ColorValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'ColorValue';
- public static GeomValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'GeomValue';
- public static ListValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'ListValue';
- public static IntervalValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'IntervalValue';
- public static LinkValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'LinkValue';
- public static GeonameValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'GeonameValue';
- public static FileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'FileValue';
- public static AudioFileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'AudioFileValue';
- public static DDDFileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'DDDFileValue';
- public static DocumentFileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'DocumentFileValue';
- public static StillImageFileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'StillImageFileValue';
- public static MovingImageFileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'MovingImageFileValue';
- public static TextFileValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'TextFileValue';
- public static IsResourceClass: string = AppConfig.KnoraApiV2WithValueObjectPath + 'isResourceClass';
- public static IsValueClass: string = AppConfig.KnoraApiV2WithValueObjectPath + 'isValueClass';
- public static ForbiddenResource: string = AppConfig.KnoraApiV2WithValueObjectPath + 'ForbiddenResource';
- public static XMLToStandoffMapping: string = AppConfig.KnoraApiV2WithValueObjectPath + 'XMLToStandoffMapping';
- public static ListNode: string = AppConfig.KnoraApiV2WithValueObjectPath + 'ListNode';
-
- public static StandoffOntology = 'http://api.knora.org/ontology/standoff/v2';
- public static SalsahGuiOntology = 'http://api.knora.org/ontology/salsah-gui/v2';
-
- public static ReadTextValueAsHtml: string = 'ReadTextValueAsHtml';
- public static ReadTextValueAsString: string = 'ReadTextValueAsString';
- public static ReadTextValueAsXml: string = 'ReadTextValueAsXml';
- public static ReadDateValue: string = 'ReadDateValue';
- public static ReadLinkValue: string = 'ReadLinkValue';
- public static ReadIntegerValue: string = 'ReadIntegerValue';
- public static ReadDecimalValue: string = 'ReadDecimalValue';
- public static ReadStillImageFileValue: string = 'ReadStillImageFileValue';
- public static ReadGeomValue: string = 'ReadGeomValue';
- public static ReadColorValue: string = 'ReadColorValue';
- public static ReadUriValue: string = 'ReadUriValue';
- public static ReadBooleanValue: string = 'ReadBooleanValue';
- public static ReadIntervalValue: string = 'ReadIntervalValue';
- public static ReadListValue: string = 'ReadListValue';
-
- public static valueAsString: string = AppConfig.KnoraApiV2WithValueObjectPath + 'valueAsString';
-
- public static textValueAsHtml: string = AppConfig.KnoraApiV2WithValueObjectPath + 'textValueAsHtml';
- public static textValueAsXml: string = AppConfig.KnoraApiV2WithValueObjectPath + 'textValueAsXml';
- public static textValueHasMapping: string = AppConfig.KnoraApiV2WithValueObjectPath + 'textValueHasMapping';
-
- public static hasStandoffLinkToValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'hasStandoffLinkToValue';
-
- public static dateValueHasStartYear: string = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasStartYear';
- public static dateValueHasEndYear: string = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasEndYear';
- public static dateValueHasStartEra: string = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasStartEra';
- public static dateValueHasEndEra: string = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasEndEra';
- public static dateValueHasStartMonth = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasStartMonth';
- public static dateValueHasEndMonth = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasEndMonth';
- public static dateValueHasStartDay = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasStartDay';
- public static dateValueHasEndDay = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasEndDay';
- public static dateValueHasCalendar = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasCalendar';
-
- public static linkValueHasTarget = AppConfig.KnoraApiV2WithValueObjectPath + 'linkValueHasTarget';
- public static linkValueHasSource = AppConfig.KnoraApiV2WithValueObjectPath + 'linkValueHasSource';
- public static linkValueHasSourceIri = AppConfig.KnoraApiV2WithValueObjectPath + 'linkValueHasSourceIri';
- public static linkValueHasTargetIri = AppConfig.KnoraApiV2WithValueObjectPath + 'linkValueHasTargetIri';
-
- public static integerValueAsInteger = AppConfig.KnoraApiV2WithValueObjectPath + 'intValueAsInt';
-
- public static decimalValueAsDecimal = AppConfig.KnoraApiV2WithValueObjectPath + 'decimalValueAsDecimal';
-
- public static fileValueAsUrl = AppConfig.KnoraApiV2WithValueObjectPath + 'fileValueAsUrl';
- public static fileValueIsPreview = AppConfig.KnoraApiV2WithValueObjectPath + 'fileValueIsPreview';
- public static fileValueHasFilename = AppConfig.KnoraApiV2WithValueObjectPath + 'fileValueHasFilename';
-
- public static hasStillImageFileValue = AppConfig.KnoraApiV2WithValueObjectPath + 'hasStillImageFileValue';
-
- public static stillImageFileValueHasDimX = AppConfig.KnoraApiV2WithValueObjectPath + 'stillImageFileValueHasDimX';
- public static stillImageFileValueHasDimY = AppConfig.KnoraApiV2WithValueObjectPath + 'stillImageFileValueHasDimY';
- public static stillImageFileValueHasIIIFBaseUrl = AppConfig.KnoraApiV2WithValueObjectPath + 'stillImageFileValueHasIIIFBaseUrl';
-
- public static colorValueAsColor = AppConfig.KnoraApiV2WithValueObjectPath + 'colorValueAsColor';
- public static geometryValueAsGeometry = AppConfig.KnoraApiV2WithValueObjectPath + 'geometryValueAsGeometry';
- public static uriValueAsUri = AppConfig.KnoraApiV2WithValueObjectPath + 'uriValueAsUri';
- public static booleanValueAsBoolean = AppConfig.KnoraApiV2WithValueObjectPath + 'booleanValueAsBoolean';
-
- public static intervalValueHasStart = AppConfig.KnoraApiV2WithValueObjectPath + 'intervalValueHasStart';
- public static intervalValueHasEnd = AppConfig.KnoraApiV2WithValueObjectPath + 'intervalValueHasEnd';
-
- public static listValueAsListNode = AppConfig.KnoraApiV2WithValueObjectPath + 'listValueAsListNode';
- public static listValueAsListNodeLabel = AppConfig.KnoraApiV2WithValueObjectPath + 'listValueAsListNodeLabel';
-
- public static hasGeometry = AppConfig.KnoraApiV2WithValueObjectPath + 'hasGeometry';
-
- public static schemaName = 'http://schema.org/name';
- public static schemaNumberOfItems = 'http://schema.org/numberOfItems';
- public static schemaItemListElement = 'http://schema.org/itemListElement';
-
- public static RdfsLabel = 'http://www.w3.org/2000/01/rdf-schema#label';
- public static RdfsComment = 'http://www.w3.org/2000/01/rdf-schema#comment';
- public static RdfsSubclassOf = 'http://www.w3.org/2000/01/rdf-schema#subClassOf';
- public static subPropertyOf: string = 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf';
-
- public static SalsahLink = 'salsah-link'; // class on an HTML element that indicates a link to a Knora resource
- public static RefMarker = 'ref-marker'; // class on an HTML element that refers to another element in the same document
-
- public static EqualsComparisonOperator = '=';
- public static EqualsComparisonLabel = 'Equals';
-
- public static NotEqualsComparisonOperator = '!=';
- public static NotEqualsComparisonLabel = 'Not_Equals';
-
- public static GreaterThanComparisonOperator = '>';
- public static GreaterThanComparisonLabel = 'Greater_Than';
-
- public static GreaterThanEqualsComparisonOperator = '>=';
- public static GreaterThanEqualsComparisonLabel = 'Greater_Than_Equals';
-
- public static LessThanComparisonOperator = '<';
- public static LessThanComparisonLabel = 'Less_Than';
-
- public static LessThanEqualsComparisonOperator = '<=';
- public static LessThanQualsComparisonLabel = 'Less_Than_Equals';
-
- public static ExistsComparisonOperator = 'E';
- public static ExistsComparisonLabel = 'Exists';
-
- public static LikeComparisonOperator = 'regex';
- public static LikeComparisonLabel = 'Like';
-
- public static MatchComparisonOperator = 'contains';
- public static MatchComparisonLabel = 'Match';
-
- public static Xsd = 'http://www.w3.org/2001/XMLSchema#';
-
- public static xsdString = AppConfig.Xsd + 'string';
- public static xsdBoolean = AppConfig.Xsd + 'boolean';
- public static xsdInteger = AppConfig.Xsd + 'integer';
- public static xsdDecimal = AppConfig.Xsd + 'decimal';
- public static xsdUri = AppConfig.Xsd + 'anyURI';
- public static dateTimeStamp = AppConfig.Xsd + 'dateTimeStamp';
-
- public static resourceSimple = AppConfig.KnoraApiV2SimplePath + 'Resource';
- public static dateSimple = AppConfig.KnoraApiV2SimplePath + 'Date';
- public static intervalSimple = AppConfig.KnoraApiV2SimplePath + 'Interval';
- public static geomSimple = AppConfig.KnoraApiV2SimplePath + 'Geom';
- public static colorSimple = AppConfig.KnoraApiV2SimplePath + 'Color';
- public static geonameSimple = AppConfig.KnoraApiV2SimplePath + 'Geoname';
- public static fileSimple = AppConfig.KnoraApiV2SimplePath + 'File';
-
- public static matchFunction = AppConfig.KnoraApiV2SimplePath + "match";
-
- public static GNDPrefix = '(DE-588)';
- public static GNDResolver = 'http://d-nb.info/gnd/';
-
- public static VIAFPrefix = '(VIAF)';
- public static VIAFResolver = 'https://viaf.org/viaf/';
-
- // regular expression
- public static RegexEmail = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
- public static RegexUrl = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}(:[0-9]{1,5})?(\/.*)?$/i;
- public static RegexPassword = /^(?=.*\d)(?=.*[a-zA-Z]).{8,}$/i;
- public static RegexHex = /^[0-9A-Fa-f]+$/;
- public static RegexShortname = /^[a-zA-Z]+\S*$/;
-
-}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 4b95780f..93f41152 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,166 +1,128 @@
-import {BrowserModule} from '@angular/platform-browser';
-import {NgModule} from '@angular/core';
-import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {HttpModule} from '@angular/http';
-import {HttpClient, HttpClientModule} from '@angular/common/http';
-import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
-import {LanguageService} from './model/services/language.service';
-import {RouterModule} from '@angular/router';
-import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
-import {APP_BASE_HREF} from '@angular/common';
+import { BrowserModule } from '@angular/platform-browser';
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common/http';
+import { JwtInterceptor, KuiAuthenticationModule, LoginFormComponent } from '@knora/authentication';
+import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
+import { TranslateHttpLoader } from '@ngx-translate/http-loader';
+import { RouterModule } from '@angular/router';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { APP_BASE_HREF } from '@angular/common';
//
// import the main app components
//
-import {AppComponent} from './app.component';
-import {AppRoutingModule} from './app-routing.module';
+import { AppComponent } from './app.component';
+import { AppRoutingModule } from './app-routing.module';
//
// import the material design modules
//
-import {AppMaterialModule} from './app-material-module';
+import { AppMaterialModule } from './app-material-module';
import 'hammerjs';
//
// import other third party modules
import { AngularSplitModule } from 'angular-split';
//
-import {DndModule} from 'ng2-dnd';
-import {ApiService} from './model/services/api.service';
-import {AuthenticationService} from './model/services/authentication.service';
-import {ProjectsService} from './model/services/projects.service';
-import {PropertiesService} from './model/services/properties.service';
-import {ResourceService} from './model/services/resource.service';
-import {ResourceTypesService} from './model/services/resource-types.service';
-import {ListsService} from './model/services/lists.service';
-import {OntologyService} from './model/services/ontology.service';
-import {OntologyCacheService} from './model/services/ontologycache.service';
-import {SearchService} from './model/services/search.service';
-import {IncomingService} from './model/services/incoming.service';
-import {UsersService} from './model/services/users.service';
+import { DndModule } from 'ng2-dnd';
//
// import all npm salsah modules
-//
-// just to get the basic ontology form the json file
-import {BasicOntologyService} from './model/services/basic-ontology.service';
-// and a list of status messages
-import {StatusMsgServiceService} from './model/services/status-msg-service.service';
+import { KuiCoreModule } from '@knora/core';
+import { KuiSearchModule } from '@knora/search';
+import { KuiActionModule } from '@knora/action';
//
// import directives, pipes etc.
//
-import {ForbiddenNameDirective} from './view/modules/other/forbidden-name.directive';
-import {ImageDirective} from './view/modules/other/image.directive';
-import {KeyPipe} from './view/modules/other/key.pipe';
-import {OverlayDirective} from './view/modules/other/overlay.directive';
-import {ReversePipe} from './view/modules/other/reverse.pipe';
-import {SortByPipe} from './view/modules/other/sort-by.pipe';
+import { ForbiddenNameDirective } from './view/modules/other/forbidden-name.directive';
+import { ImageDirective } from './view/modules/other/image.directive';
+import { OverlayDirective } from './view/modules/other/overlay.directive';
//
// import all app components
//
-import {HeaderComponent} from './view/modules/framework/main-framework/header/header.component';
-import {HeaderToolbarComponent} from './view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component';
-import {HeaderProjectsComponent} from './view/modules/framework/main-framework/header/header-projects/header-projects.component';
-import {FooterComponent} from './view/modules/framework/main-framework/footer/footer.component';
-import {DashboardComponent} from './view/dashboard/dashboard.component';
-import {LoginComponent} from './view/login/login.component';
-import {UserComponent} from './view/dashboard/user/user.component';
-import {UserProfileComponent} from './view/dashboard/user/user-profile/user-profile.component';
-import {UserSettingsComponent} from './view/dashboard/user/user-settings/user-settings.component';
-import {ProjectComponent} from './view/dashboard/project/project.component';
-import {ProjectProfileComponent} from './view/dashboard/project/project-profile/project-profile.component';
-import {ProjectSettingsComponent} from './view/dashboard/project/project-settings/project-settings.component';
-import {ProjectTeamComponent} from './view/dashboard/project/project-team/project-team.component';
-import {ProjectResourcesComponent} from './view/dashboard/project/project-resources/project-resources.component';
-import {SearchComponent} from './view/modules/search/search.component';
-import {SimpleSearchComponent} from './view/modules/search/simple-search/simple-search.component';
-import {ExtendedSearchComponent} from './view/modules/search/extended-search/extended-search.component';
-import {ProjectsListComponent} from './view/modules/listing/projects-list/projects-list.component';
-import {ResourcesListComponent} from './view/modules/listing/resources-list/resources-list.component';
-import {ResourceGridListComponent} from './view/modules/listing/resource-grid-list/resource-grid-list.component';
-import {ProjectFormComponent} from './view/modules/form/project-form/project-form.component';
-import {ResourceClassFormComponent} from './view/modules/form/resource-class-form/resource-class-form.component';
-import {ResourceFormComponent} from './view/modules/form/resource-form/resource-form.component';
-import {DocumentationComponent} from './view/documentation/documentation.component';
-import {UserProjectsComponent} from './view/dashboard/user/user-projects/user-projects.component';
-import {UserCollectionsComponent} from './view/dashboard/user/user-collections/user-collections.component';
-import {ProjectAdvancedComponent} from './view/dashboard/project/project-advanced/project-advanced.component';
-import {ProgressStepperComponent} from './view/modules/other/progress-stepper/progress-stepper.component';
-import {UserFormComponent} from './view/modules/form/user-form/user-form.component';
-import {DevelopmentComponent} from './view/test/development/development.component';
-import {MessageComponent} from './view/modules/message/message.component';
-import {NewResourceClassComponent} from './view/modules/form/new-resource-class/new-resource-class.component';
-import {EditResourceClassComponent} from './view/modules/form/edit-resource-class/edit-resource-class.component';
-import {SystemComponent} from './view/dashboard/system/system.component';
-import {SystemUsersComponent} from './view/dashboard/system/system-users/system-users.component';
-import {UsersListComponent} from './view/modules/listing/users-list/users-list.component';
-import {FrameworkForListingsComponent} from './view/modules/framework/framework-for-listings/framework-for-listings.component';
-import {UserObjectComponent} from './view/modules/object/user-object/user-object.component';
-import {MessageDialogComponent} from './view/modules/dialog/message-dialog/message-dialog.component';
-import {FormDialogComponent} from './view/modules/dialog/form-dialog/form-dialog.component';
-import {ResourceTypesListComponent} from './view/modules/listing/resource-types-list/resource-types-list.component';
-import {CollectionsListComponent} from './view/modules/listing/collections-list/collections-list.component';
-import {SearchResultsComponent} from './view/search/search-results/search-results.component';
-import {ResourceObjectComponent} from './view/modules/object/resource-object/resource-object.component';
-import {DndDirective} from './view/modules/other/dnd.directive';
-import {ResizeGridDirective} from './view/modules/other/resize-grid.directive';
-import {FormCreateComponent} from './view/test/development/form-create/form-create.component';
-import {FocusDirective} from './view/modules/other/focus.directive';
-import {ConfirmDialogComponent} from './view/modules/dialog/confirm-dialog/confirm-dialog.component';
-import {ProjectListsAdminComponent} from './view/dashboard/project/project-lists-admin/project-lists-admin.component';
-import {MathJaxDirective} from './view/modules/other/mathjax.directive';
-import {ReadTextValueAsHtmlComponent} from './view/properties/read-text-value-as-html/read-text-value-as-html.component';
-import {ReadDateValueComponent} from './view/properties/read-date-value/read-date-value.component';
-import {ReadLinkValueComponent} from './view/properties/read-link-value/read-link-value.component';
-import {ReadTextValueAsStringComponent} from './view/properties/read-text-value-as-string/read-text-value-as-string.component';
-import {ReadTextValueAsXmlComponent} from './view/properties/read-text-value-as-xml/read-text-value-as-xml.component';
-import {ReadIntegerValueComponent} from './view/properties/read-integer-value/read-integer-value.component';
-import {ReadDecimalValueComponent} from './view/properties/read-decimal-value/read-decimal-value.component';
+import { HeaderComponent } from './view/modules/framework/main-framework/header/header.component';
+import { HeaderToolbarComponent } from './view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component';
+import { HeaderProjectsComponent } from './view/modules/framework/main-framework/header/header-projects/header-projects.component';
+import { FooterComponent } from './view/modules/framework/main-framework/footer/footer.component';
+import { DashboardComponent } from './view/dashboard/dashboard.component';
+import { LoginComponent } from './view/login/login.component';
+import { UserComponent } from './view/dashboard/user/user.component';
+import { UserProfileComponent } from './view/dashboard/user/user-profile/user-profile.component';
+import { UserSettingsComponent } from './view/dashboard/user/user-settings/user-settings.component';
+import { ProjectComponent } from './view/dashboard/project/project.component';
+import { ProjectProfileComponent } from './view/dashboard/project/project-profile/project-profile.component';
+import { ProjectSettingsComponent } from './view/dashboard/project/project-settings/project-settings.component';
+import { ProjectTeamComponent } from './view/dashboard/project/project-team/project-team.component';
+import { ProjectResourcesComponent } from './view/dashboard/project/project-resources/project-resources.component';
+import { ProjectsListComponent } from './view/modules/listing/projects-list/projects-list.component';
+import { ResourcesListComponent } from './view/modules/listing/resources-list/resources-list.component';
+import { ResourceGridListComponent } from './view/modules/listing/resource-grid-list/resource-grid-list.component';
+import { ProjectFormComponent } from './view/modules/form/project-form/project-form.component';
+import { ResourceClassFormComponent } from './view/modules/form/resource-class-form/resource-class-form.component';
+import { ResourceFormComponent } from './view/modules/form/resource-form/resource-form.component';
+import { DocumentationComponent } from './view/documentation/documentation.component';
+import { UserProjectsComponent } from './view/dashboard/user/user-projects/user-projects.component';
+import { UserCollectionsComponent } from './view/dashboard/user/user-collections/user-collections.component';
+import { ProjectAdvancedComponent } from './view/dashboard/project/project-advanced/project-advanced.component';
+import { ProgressStepperComponent } from './view/modules/other/progress-stepper/progress-stepper.component';
+import { UserFormComponent } from './view/modules/form/user-form/user-form.component';
+import { DevelopmentComponent } from './view/test/development/development.component';
+import { MessageComponent } from './view/modules/message/message.component';
+import { NewResourceClassComponent } from './view/modules/form/new-resource-class/new-resource-class.component';
+import { EditResourceClassComponent } from './view/modules/form/edit-resource-class/edit-resource-class.component';
+import { SystemComponent } from './view/dashboard/system/system.component';
+import { SystemUsersComponent } from './view/dashboard/system/system-users/system-users.component';
+import { UsersListComponent } from './view/modules/listing/users-list/users-list.component';
+import { FrameworkForListingsComponent } from './view/modules/framework/framework-for-listings/framework-for-listings.component';
+import { UserObjectComponent } from './view/modules/object/user-object/user-object.component';
+import { MessageDialogComponent } from './view/modules/dialog/message-dialog/message-dialog.component';
+import { FormDialogComponent } from './view/modules/dialog/form-dialog/form-dialog.component';
+import { ResourceTypesListComponent } from './view/modules/listing/resource-types-list/resource-types-list.component';
+import { CollectionsListComponent } from './view/modules/listing/collections-list/collections-list.component';
+import { SearchResultsComponent } from './view/search/search-results/search-results.component';
+import { ResourceObjectComponent } from './view/modules/object/resource-object/resource-object.component';
+import { DndDirective } from './view/modules/other/dnd.directive';
+import { ResizeGridDirective } from './view/modules/other/resize-grid.directive';
+import { FormCreateComponent } from './view/test/development/form-create/form-create.component';
+import { FocusDirective } from './view/modules/other/focus.directive';
+import { ConfirmDialogComponent } from './view/modules/dialog/confirm-dialog/confirm-dialog.component';
+import { ProjectListsAdminComponent } from './view/dashboard/project/project-lists-admin/project-lists-admin.component';
+import { MathJaxDirective } from './view/modules/other/mathjax.directive';
+import { ReadTextValueAsHtmlComponent } from './view/properties/read-text-value-as-html/read-text-value-as-html.component';
+import { ReadDateValueComponent } from './view/properties/read-date-value/read-date-value.component';
+import { ReadLinkValueComponent } from './view/properties/read-link-value/read-link-value.component';
+import { ReadTextValueAsStringComponent } from './view/properties/read-text-value-as-string/read-text-value-as-string.component';
+import { ReadTextValueAsXmlComponent } from './view/properties/read-text-value-as-xml/read-text-value-as-xml.component';
+import { ReadIntegerValueComponent } from './view/properties/read-integer-value/read-integer-value.component';
+import { ReadDecimalValueComponent } from './view/properties/read-decimal-value/read-decimal-value.component';
import { ReadTextfileValueComponent } from './view/properties/read-textfile-value/read-textfile-value.component';
-import {StillImageOSDViewerComponent} from './view/properties/still-image-osdviewer/still-image-osdviewer.component';
-import {ReadGeomValueComponent} from './view/properties/read-geom-value/read-geom-value.component';
-import {ReadColorValueComponent} from './view/properties/read-color-value/read-color-value.component';
-import {SystemProjectsComponent} from './view/dashboard/system/system-projects/system-projects.component';
-import {SystemOntologiesComponent} from './view/dashboard/system/system-ontologies/system-ontologies.component';
-import {ProjectOntologiesComponent} from './view/dashboard/project/project-ontologies/project-ontologies.component';
-import {OntologiesListComponent} from './view/modules/listing/ontologies-list/ontologies-list.component';
-import {UsersListItemComponent} from './view/modules/listing/users-list/users-list-item/users-list-item.component';
-import {OntologyFormComponent} from './view/modules/form/ontology-form/ontology-form.component';
-import {SelectPropertyComponent} from './view/modules/search/extended-search/select-property/select-property.component';
-import {SelectResourceClassComponent} from './view/modules/search/extended-search/select-resource-class/select-resource-class.component';
-import {SelectOntologyComponent} from './view/modules/search/extended-search/select-ontology/select-ontology.component';
-import {ReadUriValueComponent} from './view/properties/read-uri-value/read-uri-value.component';
-import {ReadBooleanValueComponent} from './view/properties/read-boolean-value/read-boolean-value.component';
-import {ReadIntervalValueComponent} from './view/properties/read-interval-value/read-interval-value.component';
-import {ReadListValueComponent} from './view/properties/read-list-value/read-list-value.component';
-import {TreeModule} from 'angular-tree-component';
-import {ListsListComponent} from './view/modules/listing/lists-list/lists-list.component';
-import {SpecifyPropertyValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/specify-property-value.component';
-import {IntegerValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/integer-value/integer-value.component';
-import {DecimalValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/decimal-value/decimal-value.component';
-import {BooleanValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/boolean-value/boolean-value.component';
-import {DateValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/date-value/date-value.component';
-import {OntologiesListItemComponent} from './view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component';
-import {FileService} from './model/services/file.service';
-import {InternationalizationComponent} from './view/modules/framework/main-framework/internationalization/internationalization.component';
-import {ExistingNameDirective} from './view/modules/other/existing-name.directive';
-import {FormTestComponent} from './view/test/development/form-test/form-test.component';
-import {UserDataComponent} from './view/modules/form/user-form/user-data/user-data.component';
-import {GndDirective} from './view/modules/other/gnd.directive';
-import {GravsearchGenerationService} from './model/services/gravsearch-generation.service';
-import {MatJDNConvertibleCalendarDateAdapterModule} from 'jdnconvertiblecalendardateadapter';
-import {TextValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/text-value/text-value.component';
-import {UriValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/uri-value/uri-value.component';
-import {LinkValueComponent} from './view/modules/search/extended-search/select-property/specify-property-value/link-value/link-value.component';
-import {BeolComponent} from './view/templates/beol/beol.component';
-import {BeolService} from './model/services/beol.service';
-import {InfiniteScrollModule} from 'ngx-infinite-scroll';
-import {SearchParamsService} from './model/services/search-params.service';
-
-import {GroupsService} from './model/services/groups.service';
+import { StillImageOSDViewerComponent } from './view/properties/still-image-osdviewer/still-image-osdviewer.component';
+import { ReadGeomValueComponent } from './view/properties/read-geom-value/read-geom-value.component';
+import { ReadColorValueComponent } from './view/properties/read-color-value/read-color-value.component';
+import { SystemProjectsComponent } from './view/dashboard/system/system-projects/system-projects.component';
+import { SystemOntologiesComponent } from './view/dashboard/system/system-ontologies/system-ontologies.component';
+import { ProjectOntologiesComponent } from './view/dashboard/project/project-ontologies/project-ontologies.component';
+import { OntologiesListComponent } from './view/modules/listing/ontologies-list/ontologies-list.component';
+import { UsersListItemComponent } from './view/modules/listing/users-list/users-list-item/users-list-item.component';
+import { OntologyFormComponent } from './view/modules/form/ontology-form/ontology-form.component';
+import { ReadUriValueComponent } from './view/properties/read-uri-value/read-uri-value.component';
+import { ReadBooleanValueComponent } from './view/properties/read-boolean-value/read-boolean-value.component';
+import { ReadIntervalValueComponent } from './view/properties/read-interval-value/read-interval-value.component';
+import { ReadListValueComponent } from './view/properties/read-list-value/read-list-value.component';
+import { TreeModule } from 'angular-tree-component';
+import { ListsListComponent } from './view/modules/listing/lists-list/lists-list.component';
+import { OntologiesListItemComponent } from './view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component';
+import { InternationalizationComponent } from './view/modules/framework/main-framework/internationalization/internationalization.component';
+import { ExistingNameDirective } from './view/modules/other/existing-name.directive';
+import { FormTestComponent } from './view/test/development/form-test/form-test.component';
+import { UserDataComponent } from './view/modules/form/user-form/user-data/user-data.component';
+import { GndDirective } from './view/modules/other/gnd.directive';
+import { MatJDNConvertibleCalendarDateAdapterModule } from 'jdnconvertiblecalendardateadapter';
+import { BeolComponent } from './view/templates/beol/beol.component';
+import { InfiniteScrollModule } from 'ngx-infinite-scroll';
-import {AngularFireModule} from 'angularfire2';
-import {environment} from '../environments/environment';
-import {ContactFormComponent} from './view/modules/form/contact-form/contact-form.component';
-import {AngularFirestore} from 'angularfire2/firestore';
-import {RECAPTCHA_SETTINGS, RecaptchaModule, RecaptchaSettings} from 'ng-recaptcha';
+import { AngularFireModule } from 'angularfire2';
+import { environment } from '../environments/environment';
+import { ContactFormComponent } from './view/modules/form/contact-form/contact-form.component';
+import { AngularFirestore } from 'angularfire2/firestore';
+import { RECAPTCHA_SETTINGS, RecaptchaModule, RecaptchaSettings } from 'ng-recaptcha';
import { DialogTestComponent } from './view/test/development/dialog-test/dialog-test.component';
import { ObjectDialogComponent } from './view/modules/dialog/object-dialog/object-dialog.component';
import { UserRoleComponent } from './view/modules/form/user-form/user-role/user-role.component';
@@ -168,19 +130,14 @@ import { UserPasswordComponent } from './view/modules/form/user-form/user-passwo
import { ListFormComponent } from './view/modules/form/list-form/list-form.component';
import { ProjectDataComponent } from './view/modules/form/project-form/project-data/project-data.component';
import { NodeFormComponent } from './view/modules/form/list-form/node-form/node-form.component';
-import { SortButtonComponent } from './view/modules/action/sort-button/sort-button.component';
-import { ProgressIndicatorComponent } from './view/modules/other/progress-indicator/progress-indicator.component';
import { LeooComponent } from './view/templates/leoo/leoo.component';
import { ObjectViewerComponent } from './view/modules/object/object-viewer/object-viewer.component';
-//
-// import all needed services
//
// just to get the basic ontology form the json file
//
// import all app components
//
-
// Translate: AoT requires an exported function for factories
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/i18n/', '.json');
@@ -194,9 +151,6 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
UserComponent,
LoginComponent,
ProjectComponent,
- SearchComponent,
- SimpleSearchComponent,
- ExtendedSearchComponent,
HeaderToolbarComponent,
HeaderProjectsComponent,
DashboardComponent,
@@ -219,8 +173,6 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
UserProjectsComponent,
UserCollectionsComponent,
ProjectAdvancedComponent,
- ReversePipe,
- KeyPipe,
ProgressStepperComponent,
MathJaxDirective,
DevelopmentComponent,
@@ -236,7 +188,6 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
NewResourceClassComponent,
ProjectListsAdminComponent,
EditResourceClassComponent,
- SortByPipe,
SystemComponent,
SystemUsersComponent,
SystemProjectsComponent,
@@ -262,27 +213,16 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
OntologiesListComponent,
UsersListItemComponent,
OntologyFormComponent,
- SelectPropertyComponent,
- SelectResourceClassComponent,
- SelectOntologyComponent,
ReadUriValueComponent,
ReadBooleanValueComponent,
ReadIntervalValueComponent,
ReadListValueComponent,
ListsListComponent,
- SpecifyPropertyValueComponent,
- IntegerValueComponent,
- DecimalValueComponent,
- BooleanValueComponent,
- DateValueComponent,
OntologiesListItemComponent,
FormTestComponent,
UserDataComponent,
InternationalizationComponent,
ExistingNameDirective,
- TextValueComponent,
- UriValueComponent,
- LinkValueComponent,
ExistingNameDirective,
BeolComponent,
GndDirective,
@@ -296,16 +236,22 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
ProjectDataComponent,
ReadTextfileValueComponent,
NodeFormComponent,
- SortButtonComponent,
- ProgressIndicatorComponent,
LeooComponent,
ObjectViewerComponent
],
imports: [
BrowserModule,
+ KuiCoreModule.forRoot({
+ name: environment.name,
+ api: environment.api,
+ media: environment.media,
+ app: environment.app
+ }),
+ KuiSearchModule,
+ KuiActionModule,
+ KuiAuthenticationModule,
HttpClientModule,
FormsModule,
- HttpModule,
RouterModule,
AppMaterialModule,
MatJDNConvertibleCalendarDateAdapterModule,
@@ -333,39 +279,22 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
FormDialogComponent,
MessageDialogComponent,
ObjectDialogComponent,
+ LoginFormComponent,
ResourceClassFormComponent // deprecated!!
],
providers: [
- ApiService,
- ProjectsService,
- PropertiesService,
- ResourceService,
- ResourceTypesService,
- SearchService,
- IncomingService,
- BasicOntologyService,
- UsersService,
- OntologyService,
- OntologyCacheService,
- ListsService,
- StatusMsgServiceService,
- AuthenticationService,
- FileService,
- GravsearchGenerationService,
- BeolService,
- LanguageService,
AngularFirestore,
- SearchParamsService,
- GroupsService,
- {provide: APP_BASE_HREF, useValue: '/'},
+ { provide: APP_BASE_HREF, useValue: '/' },
{
provide: RECAPTCHA_SETTINGS,
useValue: {
siteKey: '6LdmmUoUAAAAAPZ4Z_1xYEIwEgI1d9YdjlZKmVkV',
} as RecaptchaSettings,
- }
+ },
+ {provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}
],
- bootstrap: [AppComponent]
+ bootstrap: [AppComponent],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {
}
diff --git a/src/app/model/services/api-service-error.ts b/src/app/model/services/api-service-error.ts
deleted file mode 100644
index de31b50b..00000000
--- a/src/app/model/services/api-service-error.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-/**
- * Error class used as API response in ApiService
- */
-export class ApiServiceError {
-
- /**
- * Status number
- */
- status: number = 0;
-
- /**
- * Status text
- */
- statusText: string = '';
-
- /**
- * API url
- */
- route: string = '';
-
-}
diff --git a/src/app/model/services/api-service-result.ts b/src/app/model/services/api-service-result.ts
deleted file mode 100644
index a16de54c..00000000
--- a/src/app/model/services/api-service-result.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonConvert, OperationMode, ValueCheckingMode} from 'json2typescript';
-
-/**
- * Result class used as API url response in ApiService
- */
-export class ApiServiceResult {
-
- private static jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- /**
- * Status number
- */
- status: number = 0;
-
- /**
- * Status text
- */
- statusText: string = '';
-
- /**
- * API url
- */
- url: string = '';
-
- /**
- * Body as JSON
- */
- body: any;
-
- /**
- * Gets the result body as instance of classObject.
- * @param classObject
- * @returns {any}
- */
- getBody(classObject?: { new(): any }): any {
-
- if (!classObject) { return this.body; }
- try {
- return ApiServiceResult.jsonConvert.deserializeObject(this.body, classObject);
- } catch (e) {
- console.log(e);
- }
- return null;
- }
-
-}
diff --git a/src/app/model/services/api.service.spec.ts b/src/app/model/services/api.service.spec.ts
deleted file mode 100644
index 7e03b5ec..00000000
--- a/src/app/model/services/api.service.spec.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {ApiService} from './api.service';
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-
-describe('ApiService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule,
- AppRoutingModule
- ],
- schemas: [
- NO_ERRORS_SCHEMA
- ]
-
- });
- });
-
- xit('nothing tested', inject([ApiService], (service: ApiService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/api.service.ts b/src/app/model/services/api.service.ts
deleted file mode 100644
index fa97db24..00000000
--- a/src/app/model/services/api.service.ts
+++ /dev/null
@@ -1,272 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {Http, RequestOptionsArgs, Response, Headers} from '@angular/http';
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {environment} from '../../../environments/environment';
-import {ApiServiceError} from './api-service-error';
-import {ApiServiceResult} from './api-service-result';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/catch';
-import 'rxjs/add/observable/throw';
-
-@Injectable()
-export class ApiService {
-
- static handleError(error: any, url: string): ApiServiceError {
-
- const response = new ApiServiceError();
- if (error instanceof Response) {
- // console.log(error);
- response.status = error.status;
- response.statusText = error.statusText;
- if (!response.statusText) {
- response.statusText = 'Connection to API endpoint failed';
- }
- response.route = url;
- } else {
- response.status = 0;
- response.statusText = 'Connection to API endpoint failed';
- response.route = url;
- }
-
- // response.status === 401 --> Unauthorized; password is wrong
-
- // response.status === 404 --> Not found; username is wrong
-
- return response;
-
- }
-
- constructor(private _http: Http) {
-
-
- //
- // Json convert error handling
- //
- // JsonConvert.debugMode = true;
- // JsonConvert.ignorePrimitiveChecks = false; // don't allow assigning number to string etc.
- // JsonConvert.valueCheckingMode = JsonConvert.ValueCheckingMode.ALLOW_NULL; // never allow null
- }
-
- /**
- * Performs a HTTP GET url to the Knora API.
- * @param url
- * @param options
- * @returns {Observable}
- */
- httpGet(url: string, options?: RequestOptionsArgs): Observable {
-
- options = this.appendToOptions(options);
-
- // if the url is an external one, we have to use this one
- // otherwise we have to use the defined api url from the environment config file
- url = (url.slice(0, 4) === 'http' ? url : environment.api + url);
-
- /*
- if (!environment.production && environment.description === 'mock-api') {
- // in this case, we don't need the knora API; we're using mockup files from knora_mockups
-
- url += '.json';
- options = {withCredentials: false};
- }
- */
-
- return this._http.get(url, options).map((response: Response) => {
- try {
- const apiServiceResult: ApiServiceResult = new ApiServiceResult();
- apiServiceResult.status = response.status;
- apiServiceResult.statusText = response.statusText;
- apiServiceResult.body = response.json();
- apiServiceResult.url = url;
- return apiServiceResult;
- } catch (e) {
- return ApiService.handleError(response, url);
- }
- }).catch((error: any) => {
- return Observable.throw(ApiService.handleError(error, url));
- });
- }
-
- httpGetV2(url: string, options?: RequestOptionsArgs): Observable {
-
- if (!options) options = {withCredentials: true};
-
- url = (url.slice(0, 4) === 'http' ? url : environment.api + '/v2' + url);
-
- return this._http.get(url, options).map((response: Response) => {
- try {
- let apiServiceResult: ApiServiceResult = new ApiServiceResult();
- apiServiceResult.status = response.status;
- apiServiceResult.statusText = response.statusText;
- apiServiceResult.body = response.json();
- apiServiceResult.url = url;
- return apiServiceResult;
- } catch (e) {
- return ApiService.handleError(response, url);
- }
- }).catch((error: any) => {
- return Observable.throw(ApiService.handleError(error, url));
- });
- }
-
- httpGetBasicOnto(url: string, options?: RequestOptionsArgs): Observable {
-
- if (!options) options = {withCredentials: true};
-
- url = (url.slice(0, 4) === 'http' ? url : environment.api + url);
-
- return this._http.get(url, options).map((response: Response) => {
- try {
- let apiServiceResult: ApiServiceResult = new ApiServiceResult();
- apiServiceResult.status = response.status;
- apiServiceResult.statusText = response.statusText;
- apiServiceResult.body = response.json();
- apiServiceResult.url = url;
- return apiServiceResult;
- } catch (e) {
- return ApiService.handleError(response, url);
- }
- }).catch((error: any) => {
- return Observable.throw(ApiService.handleError(error, url));
- });
- }
-
-
-
- /**
- * Performs a HTTP POST url to the Knora API.
- * @param url
- * @param body
- * @param options
- * @returns {Observable}
- */
- httpPost(url: string, body?: any, options?: RequestOptionsArgs): Observable {
- if (!body) {
- body = {};
- }
-
- options = this.appendToOptions(options);
-
- return this._http.post(environment.api + url, body, options).map((response: Response) => {
- try {
- const apiServiceResult: ApiServiceResult = new ApiServiceResult();
- apiServiceResult.status = response.status;
- apiServiceResult.statusText = response.statusText;
- apiServiceResult.body = response.json();
- apiServiceResult.url = url;
- return apiServiceResult;
- } catch (e) {
- return ApiService.handleError(response, url);
- }
- }).catch((error: any) => {
- return Observable.throw(ApiService.handleError(error, url));
- });
- }
-
- /**
- * Performs a HTTP PUT url to the Knora API.
- * @param url
- * @param body
- * @param options
- * @returns {Observable}
- */
- httpPut(url: string, body?: any, options?: RequestOptionsArgs): Observable {
- if (!body) {
- body = {};
- }
-
- options = this.appendToOptions(options);
-
- return this._http.put(environment.api + url, body, options).map((response: Response) => {
- try {
- const apiServiceResult: ApiServiceResult = new ApiServiceResult();
- apiServiceResult.status = response.status;
- apiServiceResult.statusText = response.statusText;
- apiServiceResult.body = response.json();
- apiServiceResult.url = url;
- return apiServiceResult;
- } catch (e) {
- return ApiService.handleError(response, url);
- }
- }).catch((error: any) => {
- return Observable.throw(ApiService.handleError(error, url));
- });
- }
-
- /**
- * Performs a HTTP DELETE url to the Knora API.
- * @param url
- * @param options
- * @returns {Observable}
- */
- httpDelete(url: string, options?: RequestOptionsArgs): Observable {
-
- options = this.appendToOptions(options);
-
- return this._http.delete(environment.api + url, options).map((response: Response) => {
- try {
- const apiServiceResult: ApiServiceResult = new ApiServiceResult();
- apiServiceResult.status = response.status;
- apiServiceResult.statusText = response.statusText;
- apiServiceResult.body = response.json();
- apiServiceResult.url = url;
- return apiServiceResult;
- } catch (e) {
- return ApiService.handleError(response, url);
- }
- }).catch((error: any) => {
- return Observable.throw(ApiService.handleError(error, url));
- });
- }
-
- /**
- * Appends to existing options if they exist.
- * @param {RequestOptionsArgs} options
- * @returns {RequestOptionsArgs}
- */
- private appendToOptions(options: RequestOptionsArgs): RequestOptionsArgs {
- if (!options) {
- // no options
- options = {headers: this.appendAuthorizationHeader()}
- } else {
- // have options
- if (!options.headers) {
- // no headers set
- options.headers = this.appendAuthorizationHeader();
- } else {
- // have headers, need to append to those
- options.headers = this.appendAuthorizationHeader(options.headers);
- }
- }
- return options;
- }
-
- /**
- * Appends to existing headers if they exist.
- * @param {Headers} headers
- * @returns {Headers}
- */
- private appendAuthorizationHeader(headers?: Headers): Headers {
- if (!headers) {
- headers = new Headers;
- }
- if (JSON.parse(localStorage.getItem('currentUser'))) {
- const token = JSON.parse(localStorage.getItem('currentUser')).token;
- headers.append('Authorization', 'Bearer ' + token);
- }
- return headers;
- }
-}
diff --git a/src/app/model/services/authentication.service.spec.ts b/src/app/model/services/authentication.service.spec.ts
deleted file mode 100644
index 08eedcee..00000000
--- a/src/app/model/services/authentication.service.spec.ts
+++ /dev/null
@@ -1,115 +0,0 @@
-import {async, inject, TestBed} from '@angular/core/testing';
-import {HttpModule} from '@angular/http';
-import {environment} from '../../../environments/environment';
-import {CurrentUser} from '../webapi/knora/admin/authentication/current-user';
-
-import {AuthenticationService} from './authentication.service';
-import {ProjectsService} from './projects.service';
-import {UsersService} from './users.service';
-import {imagesUser, multiUser} from '../test-data/shared-test-data';
-import {current} from 'codelyzer/util/syntaxKind';
-
-describe('AuthenticationService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpModule
- ],
- providers: [
- AuthenticationService,
- UsersService,
- ProjectsService
- ]
- });
- });
-
- it('should be created', async(inject(
- [AuthenticationService], (service) => {
- expect(service).toBeDefined();
- }))
- );
-
- it('#extractCurrentUser should extract user and write to local storage', async(inject(
- [AuthenticationService], (service) => {
-
- service.extractCurrentUser(multiUser, 'faketoken')
-
- // check local storage
- const currentUser: CurrentUser = JSON.parse(localStorage.getItem('currentUser'));
- expect(currentUser).toBeTruthy();
- expect(currentUser.email).toEqual('multi.user@example.com');
- expect(currentUser.token).toEqual('faketoken');
-
- })));
-
- it('#extractProjectPermissions should extract user and write to session storage', async(inject(
- [AuthenticationService], (service) => {
-
- service.extractProjectPermissions(imagesUser);
-
- // check local storage
- const projectAdmin: string[] = JSON.parse(sessionStorage.getItem('projectAdmin'));
- // console.log(projectAdmin);
- expect(projectAdmin).toBeTruthy();
- expect(projectAdmin).toEqual([ 'http://rdfh.ch/projects/00FF' ]);
-
- })));
-
- if (environment.type === 'integration') {
-
- it('#login should login the user [it]', async(inject(
- [AuthenticationService], (service) => {
-
- expect(service).toBeDefined();
-
- service.login('user01.user1@example.com', 'test').subscribe(
- (result: boolean) => {
-
- // console.log('result: ', result);
-
- // login successful
- expect(result).toEqual(true);
-
- // check local storage to be sure
- const currentUser: CurrentUser = JSON.parse(localStorage.getItem('currentUser'));
-
- // console.log('currentUser: ', currentUser);
- expect(currentUser).toBeTruthy();
- expect(currentUser.email).toEqual('user01.user1@example.com');
- },
- (error) => {
- console.log('error: ', error);
- }
- );
-
-
- })));
-
- it('#authenticate should check if the user is logged in [it]', async(inject(
- [AuthenticationService], (service) => {
-
- expect(service).toBeDefined();
-
- service.login('user01.user1@example.com', 'test').subscribe(
- (result: boolean) => {
-
- // service call should be true if succeeded
- expect(result).toEqual(true);
-
- // check with authenticate
- const authRes = service.authenticate().subscribe(
- (authResult: boolean) => {
- expect(authResult).toEqual(true)
- }
- );
-
- }
- );
-
- })));
-
- } else {
- xit('Integration tests skipped. Run "ng test --env=it" to run integration tests.');
- }
-
-});
diff --git a/src/app/model/services/authentication.service.ts b/src/app/model/services/authentication.service.ts
deleted file mode 100644
index 62e48578..00000000
--- a/src/app/model/services/authentication.service.ts
+++ /dev/null
@@ -1,249 +0,0 @@
-import {Injectable} from '@angular/core';
-import {User} from '../webapi/knora/admin';
-import {CurrentUser} from '../webapi/knora/admin/authentication/current-user';
-import {ApiService} from './api.service';
-import {Observable} from 'rxjs/Observable';
-import {ApiServiceResult} from './api-service-result';
-import {ApiServiceError} from './api-service-error';
-import {Http} from '@angular/http';
-import {AppConfig} from '../../app.config';
-import {ProjectsService} from './projects.service';
-import {UsersService} from './users.service';
-import {PermissionData, Project, UserResponse} from '../webapi/knora';
-import {AuthenticationRequestPayload} from '../webapi/knora/admin/authentication/authentication-request-payload';
-
-@Injectable()
-export class AuthenticationService extends ApiService {
-
- private token: string;
-
- private isSysAdmin: boolean;
-
- constructor(_http: Http,
- private _userService: UsersService,
- private _projectsService: ProjectsService) {
- super(_http);
- const currentUser = JSON.parse(localStorage.getItem('currentUser'));
- this.token = currentUser && currentUser.token;
- }
-
- /**
- * Sends out a login request to the server with email/password inside the body and stores
- * the received token in local storage.
- * @param {string} email
- * @param {string} password
- * @returns {Observable}
- */
- login(email: string, password: string): Observable {
-
- // new login, so remove anything stale
- this.clearEverything();
-
- const authRequest: AuthenticationRequestPayload = {
- email: email,
- password: password
- };
-
- return this.doAuthentication(authRequest)
- // end of first observable. now we need to chain it with the second.
- // the flatMap has the return value of the first observable as the input parameter.
- .flatMap(
- (token: string) => {
- // get the user information
- return this._userService.getUserByEmail(email)
- .map(
- (user: User) => {
-
- // console.log("AuthenticationService - login - user: ", user);
-
- // extract user information and and write them to local storage
- this.extractCurrentUser(user, token);
-
- // get the project permissions and write them to session storage
- this.extractProjectPermissions(user);
-
- // return true to indicate successful login
- return true;
- },
- (error: ApiServiceError) => {
- console.log(error);
- console.error('AuthenticationService - login - getUserByEmail error: ' + error);
-
- // there was an error during login. remove anything from local storage
- localStorage.removeItem('currentUser');
- localStorage.removeItem('lang');
-
- // throw error
- throw error;
- });
- });
- };
-
-
- /**
- * Sends the authentication payload and returns the authentication token if successful.
- *
- * @param {AuthenticationRequestPayload} payload
- * @returns {Observable}
- */
- doAuthentication(payload: AuthenticationRequestPayload): Observable {
-
- // console.log('AuthenticationService - doAuthentication - payload: ', payload);
-
- return this.httpPost('/v2/authentication', payload)
- .map(
- (result: ApiServiceResult) => {
- // console.log('AuthenticationService - login - result:', result);
-
- const token = result.body && result.body.token;
-
- if (token) {
- return token;
- } else {
- // If login does fail, then we would gotten an error back. This case covers
- // a `positive` login outcome without a returned token. This is a bug in `webapi`
- throw new Error('Token not returned. Please report this as a possible bug.');
- }
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('AuthenticationService - doAuthentication - error: ' + errorMessage);
- throw error;
- });
- }
-
- /**
- * Checks if the user is logged in or not.
- *
- * @returns {Observable}
- */
- authenticate(): Observable {
-
- return this.httpGet('/v2/authentication')
- .map(
- (result: ApiServiceResult) => {
-
- if (result.status === 200) {
- // the stored credentials (token) is valid and a user is authenticated by the api server
- return true;
- } else {
- // the session is not valid!
- this.clearEverything();
- return false;
- }
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('AuthenticationService - authenticate - error: ' + errorMessage);
- throw error;
- });
- }
-
- /**
- * Extracts email and token, and stores it in local storage under current user.
- *
- * @param {User} user
- * @param {string} token
- */
- extractCurrentUser(user: User, token: string): void {
-
- // console.log('AuthenticationService - extractCurrentUser - user / token ', user, token);
-
- let isSysAdmin: boolean = false;
-
- const permissions = user.permissions;
- if (permissions.groupsPerProject[AppConfig.SystemProject]) {
- isSysAdmin = permissions.groupsPerProject[AppConfig.SystemProject].indexOf(AppConfig.SystemAdminGroup) > -1;
- }
-
- const currentUserObject: CurrentUser = {
- email: user.email,
- token: token,
- sysAdmin: isSysAdmin
- };
-
- // store username and jwt token in local storage to keep user logged in between page refreshes
- // and set the system admin property to true or false
- localStorage.setItem('currentUser', JSON.stringify(currentUserObject));
- localStorage.setItem('lang', user.lang);
-
- }
-
- /**
- * Extracts permission information from the user object and writes them to session storage
- *
- * @param {User} user
- * @returns {any}
- */
- extractProjectPermissions(user: User): void {
-
- // console.log('AuthenticationService - extractProjectPermissions - user ', user);
-
- const permissions: PermissionData = user.permissions;
- const projectsList: string[] = [];
- let isSysAdmin: boolean = false;
-
- if (permissions.groupsPerProject[AppConfig.SystemProject]) {
- isSysAdmin = permissions.groupsPerProject[AppConfig.SystemProject].indexOf(AppConfig.SystemAdminGroup) > -1;
- }
-
- if (isSysAdmin) {
- // the user is system admin and has all permission rights in every project
- // get all projects and set projectAdmin to true for every project
- this._projectsService.getAllProjects().subscribe(
- (projects: Project[]) => {
- for (const p of projects) {
- projectsList.push(p.id);
- }
- sessionStorage.setItem('projectAdmin', JSON.stringify(projectsList));
- },
- (error: ApiServiceError) => {
- console.log(error);
- sessionStorage.removeItem('projectAdmin');
- }
- );
- } else {
- // get the projects, where the user is admin of
- for (const project in permissions.groupsPerProject) {
- if (permissions.groupsPerProject[project].indexOf(AppConfig.ProjectAdminGroup) > -1) {
- projectsList.push(project);
- }
- }
- sessionStorage.setItem('projectAdmin', JSON.stringify(projectsList));
- }
-
- }
-
-
- /**
- * Sends a logout request to the server and removes any variables.
- */
- logout(): void {
-
- this.httpDelete('/v2/authentication')
- .subscribe(
- (result: ApiServiceResult) => {
- // console.log('AuthenticationService - logout - result:', result);
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('AuthenticationService - logout - error: ' + errorMessage);
- throw error;
- });
-
- // clear token remove user from local storage to log user out
- this.clearEverything();
- }
-
- /**
- * Clears any variables set during authentication in local and session storage
- */
- clearEverything(): void {
- // clear token remove user from local storage to log user out
- this.token = null;
- localStorage.removeItem('currentUser');
- localStorage.removeItem('lang');
- sessionStorage.clear();
- }
-
-}
diff --git a/src/app/model/services/basic-ontology.service.spec.ts b/src/app/model/services/basic-ontology.service.spec.ts
index 22a0a8e2..37ea73d6 100644
--- a/src/app/model/services/basic-ontology.service.spec.ts
+++ b/src/app/model/services/basic-ontology.service.spec.ts
@@ -1,6 +1,6 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {BasicOntologyService} from './basic-ontology.service';
+import { TestBed, inject } from '@angular/core/testing';
+import { AppModule } from '../../app.module';
+import { BasicOntologyService } from './basic-ontology.service';
describe('BasicOntologyService', () => {
@@ -15,7 +15,7 @@ describe('BasicOntologyService', () => {
});
});
- xit('nothing tested', inject([BasicOntologyService], (service: BasicOntologyService) => {
+ it('nothing tested', inject([BasicOntologyService], (service: BasicOntologyService) => {
expect(service).toBeTruthy();
}));
diff --git a/src/app/model/services/basic-ontology.service.ts b/src/app/model/services/basic-ontology.service.ts
index b49567bb..e4e5e10e 100644
--- a/src/app/model/services/basic-ontology.service.ts
+++ b/src/app/model/services/basic-ontology.service.ts
@@ -12,14 +12,16 @@
* License along with SALSAH. If not, see .
* */
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs';
+import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
-import {ApiService} from "./api.service";
-import {environment} from '../../../environments/environment';
+import { ApiService } from '@knora/core';
+import { environment } from '../../../environments/environment';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class BasicOntologyService extends ApiService {
/**
@@ -32,7 +34,9 @@ export class BasicOntologyService extends ApiService {
// return this.httpGet(url + '/data/base-data/basic-ontology.json', {withCredentials: false});
// }
getBasicOntology(): Observable {
- return this.httpGetBasicOnto('/ontology/knora-api/v2');
+ const url = environment.app;
+ return this.httpGet(url + '/data/base-data/basic-ontology.json');
+ // return this.httpGet(url + '/data/base-data/basic-ontology.json', {withCredentials: false});
}
}
diff --git a/src/app/model/services/beol.service.spec.ts b/src/app/model/services/beol.service.spec.ts
index 68c15129..af459bb5 100644
--- a/src/app/model/services/beol.service.spec.ts
+++ b/src/app/model/services/beol.service.spec.ts
@@ -1,22 +1,22 @@
-import {async, inject, TestBed} from '@angular/core/testing';
+import { async, inject, TestBed } from '@angular/core/testing';
-import {BeolService} from './beol.service';
-import {HttpClientModule} from '@angular/common/http';
-import {HttpModule} from '@angular/http';
+import { BeolService } from './beol.service';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpModule } from '@angular/http';
describe('BeolService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpModule,
- HttpClientModule
- ],
- providers: [BeolService]
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ HttpModule,
+ HttpClientModule
+ ],
+ providers: [BeolService]
+ });
});
- });
- xit('nothing tested', async(inject(
+ it('nothing tested', async(inject(
[BeolService], (service) => {
expect(service).toBeDefined();
}))
diff --git a/src/app/model/services/beol.service.ts b/src/app/model/services/beol.service.ts
index 144ccb43..986c238b 100644
--- a/src/app/model/services/beol.service.ts
+++ b/src/app/model/services/beol.service.ts
@@ -1,8 +1,10 @@
-import {Injectable} from '@angular/core';
-import {environment} from '../../../environments/environment';
-import {ExtendedSearchParams, SearchParamsService} from './search-params.service';
+import { Injectable } from '@angular/core';
+import { environment } from '../../../environments/environment';
+import { ExtendedSearchParams, SearchParamsService } from '@knora/core';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class BeolService {
constructor(private _searchParamsService: SearchParamsService) {
diff --git a/src/app/model/services/file.service.ts b/src/app/model/services/file.service.ts
index 71d27d54..760bb6c3 100644
--- a/src/app/model/services/file.service.ts
+++ b/src/app/model/services/file.service.ts
@@ -1,32 +1,33 @@
-import {Injectable} from '@angular/core';
-import {Http, Headers, RequestOptions} from '@angular/http';
-import {Observable} from 'rxjs/Observable';
-import {AppConfig} from '../../app.config';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/catch';
+import { throwError as observableThrowError, Observable } from 'rxjs';
+import { Injectable } from '@angular/core';
+import { Http, Headers, RequestOptions } from '@angular/http';
-@Injectable()
+// service unused and outdated
+
+@Injectable({
+ providedIn: 'root'
+})
export class FileService {
constructor(private http: Http) {
}
- upload(files, parameters) {
+ /* upload(files, parameters) {
const headers = new Headers();
- const options = new RequestOptions({headers: headers});
+ const options = new RequestOptions({ headers: headers });
options.params = parameters;
console.log('headers: ', headers);
console.log('options: ', options);
return this.http.post(AppConfig.FileServer + '/admin_upload', files, options)
.map(response => response.json())
- .catch(error => Observable.throw(error));
+ .catch(error => observableThrowError(error));
}
getImages() {
return this.http.get(AppConfig.FileServer + '/admin_upload')
.map(response => response.json())
- .catch(error => Observable.throw(error));
- }
+ .catch(error => observableThrowError(error));
+ } */
}
diff --git a/src/app/model/services/gravsearch-generation.service.spec.ts b/src/app/model/services/gravsearch-generation.service.spec.ts
deleted file mode 100644
index 2a00a2f8..00000000
--- a/src/app/model/services/gravsearch-generation.service.spec.ts
+++ /dev/null
@@ -1,435 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-
-import {GravsearchGenerationService} from './gravsearch-generation.service';
-import {PropertyWithValue} from "../../view/modules/search/extended-search/select-property/select-property.component";
-import {Property} from "./ontologycache.service";
-import {
- ComparisonOperatorAndValue, Equals, IRI, Like,
- ValueLiteral
-} from '../../view/modules/search/extended-search/select-property/specify-property-value/specify-property-value.component';
-import {SearchParamsService} from "./search-params.service";
-
-describe('GravsearchgenerationService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [GravsearchGenerationService, SearchParamsService]
- });
- });
-
- it('should be created', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
- expect(service).toBeTruthy();
- }));
-
- it('should create a Gravsearch query string with restriction to a resource class using offset 0', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const gravsearch = service.createGravsearchQuery([], "http://0.0.0.0:3333/ontology/0801/beol/v2#letter", 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
-
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
- ?mainRes a .
-
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
- }));
-
- it('should create a Gravsearch query string with restriction to a resource class using offset 1', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const gravsearch = service.createGravsearchQuery([], "http://0.0.0.0:3333/ontology/0801/beol/v2#letter", 1);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
-
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
- ?mainRes a .
-
-
-
- }
-
- OFFSET 1
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
- }));
-
- it('should create a Gravsearch query string with a text property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasFamilyName',
- 'http://api.knora.org/ontology/knora-api/v2#TextValue',
- 'Represents a family name.',
- 'Nachname',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Like(), new ValueLiteral('Bernoulli', 'http://www.w3.org/2001/XMLSchema#string'));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes ?propVal0 .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes ?propVal0 .
- knora-api:objectType .
- ?propVal0 a .
-
- FILTER regex(?propVal0, "Bernoulli"^^, "i")
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
- }));
-
- it('should create a Gravsearch query string with a date property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#creationDate',
- 'http://api.knora.org/ontology/knora-api/v2#DateValue',
- 'Date of creation',
- 'Date of creation',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Equals(), new ValueLiteral('GREGORIAN:2018-06-12', 'http://api.knora.org/ontology/knora-api/v2#DateValue'));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes ?propVal0 .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes ?propVal0 .
- knora-api:objectType .
- ?propVal0 a .
-
- FILTER(?propVal0 = "GREGORIAN:2018-06-12"^^)
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
-
- }));
-
- it('should create a Gravsearch query string with a decimal property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal',
- 'http://api.knora.org/ontology/knora-api/v2#DecimalValue',
- 'Decimal number',
- 'Decimal number',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Equals(), new ValueLiteral('1.5', 'http://www.w3.org/2001/XMLSchema#decimal'));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes ?propVal0 .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes ?propVal0 .
- knora-api:objectType .
- ?propVal0 a .
-
- FILTER(?propVal0 = "1.5"^^)
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
-
- }));
-
- it('should create a Gravsearch query string with an integer property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger',
- 'http://api.knora.org/ontology/knora-api/v2#IntValue',
- 'Integer',
- 'Integer',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Equals(), new ValueLiteral('1', 'http://www.w3.org/2001/XMLSchema#integer'));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes ?propVal0 .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes ?propVal0 .
- knora-api:objectType .
- ?propVal0 a .
-
- FILTER(?propVal0 = "1"^^)
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
- }));
-
- it('should create a Gravsearch query string with an Boolean property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean',
- 'http://api.knora.org/ontology/knora-api/v2#BooleanValue',
- 'Boolean value',
- 'Boolean value',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Equals(), new ValueLiteral('true', 'http://www.w3.org/2001/XMLSchema#boolean'));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes ?propVal0 .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes ?propVal0 .
- knora-api:objectType .
- ?propVal0 a .
-
- FILTER(?propVal0 = "true"^^)
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
- }));
-
- it('should create a Gravsearch query string with a URI property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri',
- 'http://api.knora.org/ontology/knora-api/v2#UriValue',
- 'URI',
- 'URI',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Equals(), new ValueLiteral('http://www.google.ch', 'http://www.w3.org/2001/XMLSchema#anyURI'));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes ?propVal0 .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes ?propVal0 .
- knora-api:objectType .
- ?propVal0 a .
-
- FILTER(?propVal0 = "http://www.google.ch"^^)
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
-
- }));
-
- it('should create a Gravsearch query string with a linking property matching a value', inject([GravsearchGenerationService], (service: GravsearchGenerationService) => {
-
- const prop = new Property(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasAuthor',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Author',
- 'Author',
- ['http://api.knora.org/ontology/knora-api/v2#hasLinkTo'],
- false,
- true,
- false
- );
-
- const value = new ComparisonOperatorAndValue(new Equals(), new IRI("http://rdfh.ch/biblio/QNWEqmjxQ9W-_hTwKlKP-Q"));
-
- const propWithVal = new PropertyWithValue(prop, value, false);
-
- const gravsearch = service.createGravsearchQuery([propWithVal], undefined, 0);
-
- const expectedGravsearch = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ?mainRes .
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
-
-
-
- ?mainRes .
- knora-api:objectType .
- a .
-
-
-
-
- }
-
- OFFSET 0
- `;
-
- expect(gravsearch).toContain(expectedGravsearch);
-
- }));
-
-
-});
diff --git a/src/app/model/services/gravsearch-generation.service.ts b/src/app/model/services/gravsearch-generation.service.ts
deleted file mode 100644
index 4b205745..00000000
--- a/src/app/model/services/gravsearch-generation.service.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import {Injectable} from '@angular/core';
-import {PropertyWithValue} from "../../view/modules/search/extended-search/select-property/select-property.component";
-import {Utils} from "../../utils";
-import {AppConfig, KnoraSchema} from '../../app.config';
-import {ExtendedSearchParams, SearchParamsService} from "./search-params.service";
-
-/**
- * Represents an error that occurred when generating Gravsearch.
- */
-class GravsearchGenerationError extends Error {
-
- constructor(msg: string) {
- super(msg);
- }
-}
-
-/**
- * Handles the generation of Gravsearch queries.
- */
-@Injectable()
-export class GravsearchGenerationService {
-
- // map of complex knora-api value types to simple ones
- static typeConversionComplexToSimple = {
- [AppConfig.IntValue]: AppConfig.xsdInteger, // use computed property name: http://www.ecma-international.org/ecma-262/6.0/#sec-object-initializer
- [AppConfig.DecimalValue]: AppConfig.xsdDecimal,
- [AppConfig.BooleanValue]: AppConfig.xsdBoolean,
- [AppConfig.TextValue]: AppConfig.xsdString,
- [AppConfig.DateValue]: AppConfig.dateSimple,
- [AppConfig.IntervalValue]: AppConfig.intervalSimple,
- [AppConfig.GeomValue]: AppConfig.geomSimple,
- [AppConfig.ColorValue]: AppConfig.colorSimple,
- [AppConfig.GeonameValue]: AppConfig.geonameSimple,
- [AppConfig.UriValue]: AppConfig.xsdUri,
- [AppConfig.StillImageFileValue]: AppConfig.fileSimple,
- [AppConfig.FileValue]: AppConfig.fileSimple,
- [AppConfig.MovingImageFileValue]: AppConfig.fileSimple,
- [AppConfig.DDDFileValue]: AppConfig.fileSimple,
- [AppConfig.AudioFileValue]: AppConfig.fileSimple,
- [AppConfig.DocumentFileValue]: AppConfig.fileSimple,
- [AppConfig.TextFileValue]: AppConfig.fileSimple,
- [AppConfig.ListValue]: AppConfig.xsdString
- };
-
- constructor(private _searchParamsService: SearchParamsService) {
- }
-
- /**
- * Converts a complex type Iri to a simple type Iri.
- *
- * @param {string} complexType the Iri of a value type (knora-api complex).
- * @returns {string} the corresponding Iri of the simple type (knora-api simple).
- */
- private convertComplexTypeToSimpleType(complexType: string): string {
-
- const simpleType: string = GravsearchGenerationService.typeConversionComplexToSimple[complexType];
-
- if (simpleType !== undefined) {
- return simpleType;
- } else {
- throw new GravsearchGenerationError(`complex type ${complexType} could not be converted to simple type.`);
- }
-
- }
-
-
- /**
- * Generates a Gravsearch query from the provided arguments.
- *
- * @param {PropertyWithValue[]} properties the properties specified by the user.
- * @param {string} mainResourceClassOption the class of the main resource, if specified.
- * @param offset the offset to be used (nth page of results).
- * @returns {string} a Gravsearch query string.
- */
- createGravsearchQuery(properties: PropertyWithValue[], mainResourceClassOption?: string, offset: number = 0): string {
-
- // class restriction for the resource searched for
- let mainResourceClass = '';
-
- // if given, create the class restriction for the main resource
- if (mainResourceClassOption !== undefined) {
- mainResourceClass = `?mainRes a <${Utils.convertComplexKnoraApiEntityIritoSimple(mainResourceClassOption)}> .`;
- }
-
- // criteria for the order by statement
- const orderByCriteria = [];
-
- // statements to be returned in query results
- let returnStatements = [];
-
- // loop over given properties and create statements and Filters and type annotations from them
- let props: string[] = properties.map(
- (propWithVal: PropertyWithValue, index: number) => {
-
- let propIriSimple = Utils.convertComplexKnoraApiEntityIritoSimple(propWithVal.property.id);
-
- let simpleType;
- if (!propWithVal.property.isLinkProperty) {
- simpleType = this.convertComplexTypeToSimpleType(propWithVal.property.objectType);
- } else {
- simpleType = AppConfig.resourceSimple;
- }
-
- // represents the object of a statement
- let propValue;
- if (!propWithVal.property.isLinkProperty || propWithVal.valueLiteral.comparisonOperator.getClassName() == 'Exists') {
- // it is not a linking property, create a variable for the value (to be used by a subsequent FILTER)
- // OR the comparison operator Exists is used in which case we do not need to specify the object any further
- propValue = `?propVal${index}`;
- } else {
- // it is a linking property and the comparison operator is not Exists, use its IRI
- propValue = propWithVal.valueLiteral.value.toSparql(KnoraSchema.simple);
- }
-
- // generate statement
- let statement: string = `?mainRes <${propIriSimple}> ${propValue} .`;
-
- // type annotations
- let propTypeAnnotation = `<${propIriSimple}> knora-api:objectType <${simpleType}> .`;
- let propValueAnnotation = `${propValue} a <${simpleType}> .`;
-
- // check if it is a linking property that has to be wrapped in a FILTER NOT EXISTS (comparison operator NOT_EQUALS) to negate it
- if (propWithVal.property.isLinkProperty && propWithVal.valueLiteral.comparisonOperator.getClassName() == 'NotEquals') {
- // do not include statement in results, because the query checks for the absence of this statement
- statement = `FILTER NOT EXISTS {
- ${statement}
- ${propTypeAnnotation}
- ${propValueAnnotation}
- }`;
- } else {
- // TODO: check if statement should be returned returned in results (Boolean flag from checkbox)
- returnStatements.push(statement);
- statement = `
- ${statement}
- ${propTypeAnnotation}
- ${propValueAnnotation}
- `;
- }
-
- // generate filter if comparison operator is not Exists
- let filter: string = '';
- // only create a FILTER if the comparison operator is not EXISTS and it is not a linking property
- if (!propWithVal.property.isLinkProperty && propWithVal.valueLiteral.comparisonOperator.getClassName() != 'Exists') {
-
- if (propWithVal.valueLiteral.comparisonOperator.getClassName() == 'Like') {
- // use regex function for LIKE
- filter = `FILTER regex(${propValue}, ${propWithVal.valueLiteral.value.toSparql(KnoraSchema.simple)}, "i")`;
- } else if (propWithVal.valueLiteral.comparisonOperator.getClassName() == 'Match') {
- // use contains function for MATCH
- filter = `FILTER <${AppConfig.matchFunction}>(${propValue}, ${propWithVal.valueLiteral.value.toSparql(KnoraSchema.simple)})`;
- } else {
- // convert to simple schema (the type might be a complex knora-api:DateValue)
- filter = `FILTER(${propValue} ${propWithVal.valueLiteral.comparisonOperator.type} ${propWithVal.valueLiteral.value.toSparql(KnoraSchema.simple)})`;
- }
- }
-
- // check if current value is a sort criterion
- if (propWithVal.isSortCriterion) orderByCriteria.push(propValue);
-
- return `${statement}
- ${filter}
- `;
-
- });
-
- let orderByStatement = '';
-
- if (orderByCriteria.length > 0) {
- orderByStatement = `
- ORDER BY ${orderByCriteria.join(' ')}
- `;
- }
-
- // template of the Gravsearch query with dynamic components
- let gravsearchTemplate = `
- PREFIX knora-api:
- CONSTRUCT {
-
- ?mainRes knora-api:isMainResource true .
-
- ${returnStatements.join('\n')}
-
- } WHERE {
-
- ?mainRes a knora-api:Resource .
-
- ${mainResourceClass}
-
- ${props.join('')}
-
- }
- ${orderByStatement}`;
-
- // offset component of the Gravsearch query
- let offsetTemplate = `
- OFFSET ${offset}
- `;
-
- // function that generates the same Gravsearch query with the given offset
- let generateGravsearchQueryWithCustomOffset = (localOffset: number): string => {
- let offsetCustomTemplate = `
- OFFSET ${localOffset}
- `;
-
- return gravsearchTemplate + offsetCustomTemplate;
- };
-
- if (offset === 0) {
- // store the function so another Gravsearch query can be created with an increased offset
- this._searchParamsService.changeSearchParamsMsg(new ExtendedSearchParams(generateGravsearchQueryWithCustomOffset));
- }
-
- return gravsearchTemplate + offsetTemplate;
-
- }
-
-}
diff --git a/src/app/model/services/groups.service.spec.ts b/src/app/model/services/groups.service.spec.ts
deleted file mode 100644
index d00094b9..00000000
--- a/src/app/model/services/groups.service.spec.ts
+++ /dev/null
@@ -1,117 +0,0 @@
-import {async, inject, TestBed} from '@angular/core/testing';
-
-import {GroupsService} from './groups.service';
-import {environment} from '../../../environments/environment';
-import {ApiServiceError} from './api-service-error';
-import {Group, GroupResponse, GroupsResponse} from '../webapi/knora';
-import {StoreService} from './store.service';
-import {ApiService} from './api.service';
-import {HttpClientModule} from '@angular/common/http';
-import {HttpModule} from '@angular/http';
-import {JsonConvert, OperationMode, ValueCheckingMode} from 'json2typescript';
-import {groupsResponseJson, groupsTestData, imagesReviewerGroup, imagesReviewerGroupResponseJson} from '../test-data/shared-test-data';
-
-describe('GroupsService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpModule,
- HttpClientModule
- ],
- providers: [
- ApiService,
- GroupsService,
- StoreService
- ]
- });
- });
-
- it('should be created', inject([GroupsService], (service: GroupsService) => {
- expect(service).toBeTruthy();
- }));
-
- it('should parse groups-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: GroupsResponse = jsonConvert.deserializeObject(groupsResponseJson, GroupsResponse);
-
- expect(result).toBeTruthy();
-
- // console.log('result: ', result);
- });
-
-
- it('should parse group-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: GroupResponse = jsonConvert.deserializeObject(imagesReviewerGroupResponseJson, GroupResponse);
-
- expect(result).toBeTruthy();
-
- // console.log('result: ', result);
- });
-
-
- if (environment.type === 'integration') {
-
- it('should load test data [it]', async(inject(
- [StoreService], (service) => {
-
- expect(service).toBeDefined();
-
- service.resetTriplestoreContent([])
- .subscribe(
- (result: string) => {
- expect(result).toBe('success');
- });
-
- })), 300000);
-
-
- it('#getAllGroups should return all groups [it]', async(inject(
- [GroupsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getAllGroups()
- .subscribe(
- (groups: Group[]) => {
- // console.log('groups: ' + JSON.stringify(groups));
- expect(groups.length).toBe(1);
- expect(groups).toEqual(groupsTestData)
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
-
- it('#getGroupByIri should return group [it]', async(inject(
- [GroupsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getGroupByIri('http://rdfh.ch/groups/00FF/images-reviewer')
- .subscribe(
- (group: Group) => {
- // console.log('group: ' + JSON.stringify(group));
- expect(group).toEqual(imagesReviewerGroup);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
-
- } else {
- xit('integration tests skipped. run "ng test --env=it".');
- }
-
-
-});
diff --git a/src/app/model/services/groups.service.ts b/src/app/model/services/groups.service.ts
deleted file mode 100644
index 757fa4aa..00000000
--- a/src/app/model/services/groups.service.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import {Injectable} from '@angular/core';
-import {Group, GroupsResponse} from '../webapi/knora';
-import {ApiServiceError} from './api-service-error';
-import {ApiServiceResult} from './api-service-result';
-import {Observable} from 'rxjs/Observable';
-import {ApiService} from './api.service';
-import {GroupResponse} from '../webapi/knora/admin';
-
-@Injectable()
-export class GroupsService extends ApiService {
-
- /**
- * returns a list of all groups
- *
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getAllGroups(): Observable {
-
- return this.httpGet('/admin/groups').map(
- (result: ApiServiceResult) => {
- // console.log('GroupsService - getAllGroups - result: ', JSON.stringify(result));
- const groups: Group[] = result.getBody(GroupsResponse).groups;
- // console.log('GroupsService - getAllGroups - groups: ', JSON.stringify(groups));
- return groups;
- },
- (error: ApiServiceError) => {
- console.error('GroupsService - getAllGroups - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * returns a group object
- *
- * @param iri (= group iri)
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getGroupByIri(iri: string): Observable {
-
- const url = '/admin/groups/' + encodeURIComponent(iri);
-
- return this.httpGet(url).map(
- (result: ApiServiceResult) => {
- // console.log('GroupsService - getGroupByIri - result: ', JSON.stringify(result));
- const group: Group = result.getBody(GroupResponse).group;
- // console.log('GroupsService - getGroupByIri - group: ', JSON.stringify(group));
- return group;
- },
- (error: ApiServiceError) => {
- console.error(error);
- throw error;
- }
- );
- }
-
-}
diff --git a/src/app/model/services/incoming.service.spec.ts b/src/app/model/services/incoming.service.spec.ts
deleted file mode 100644
index e7304277..00000000
--- a/src/app/model/services/incoming.service.spec.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-
-import {IncomingService} from './incoming.service';
-import {AppModule} from '../../app.module';
-
-describe('IncomingService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule
- ],
- providers: [IncomingService]
- });
- });
-
- xit('should be created', inject([IncomingService], (service: IncomingService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/incoming.service.ts b/src/app/model/services/incoming.service.ts
deleted file mode 100644
index d2ab4673..00000000
--- a/src/app/model/services/incoming.service.ts
+++ /dev/null
@@ -1,148 +0,0 @@
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs';
-
-import {SearchService} from "./search.service";
-
-@Injectable()
-export class IncomingService extends SearchService {
-
- /**
- * Returns all incoming regions for a particular resource.
- */
- getIncomingRegions(resourceIRI: string, offset: number): Observable {
- let sparqlQueryStr = `
- PREFIX knora-api:
-
- CONSTRUCT {
- ?region knora-api:isMainResource true .
-
- ?region knora-api:hasGeometry ?geom .
-
- ?region knora-api:hasComment ?comment .
-
- ?region knora-api:hasColor ?color .
- } WHERE {
- ?region a knora-api:Region .
- ?region a knora-api:Resource .
-
- ?region knora-api:isRegionOf <${resourceIRI}> .
- knora-api:isRegionOf knora-api:objectType knora-api:Resource .
-
- <${resourceIRI}> a knora-api:Resource .
-
- ?region knora-api:hasGeometry ?geom .
- knora-api:hasGeometry knora-api:objectType knora-api:Geom .
-
- ?geom a knora-api:Geom .
-
- ?region knora-api:hasComment ?comment .
- knora-api:hasComment knora-api:objectType xsd:string .
-
- ?comment a xsd:string .
-
- ?region knora-api:hasColor ?color .
- knora-api:hasColor knora-api:objectType knora-api:Color .
-
- ?color a knora-api:Color .
- } OFFSET ${offset}
- `;
-
- return this.doExtendedSearch(sparqlQueryStr);
- }
-
- /**
- * Returns all the StillImageRepresentations for the given resource, if any.
- * StillImageRepresentations link to the given resource via knora-base:isPartOf.
- *
- * @param resourceIri the Iri of the resource whose StillImageRepresentations should be returned.
- * @param offset the offset to be used for paging. 0 is the default and is used to get the first page of results.
- * @returns {Observable}
- */
- getStillImageRepresentationsForCompoundResource(resourceIri: string, offset: number): Observable {
- let sparqlQueryStr = `
- PREFIX knora-api:
-
- CONSTRUCT {
-
- ?page knora-api:isMainResource true .
-
- ?page knora-api:seqnum ?seqnum .
-
- ?page knora-api:hasStillImageFile ?file .
- } WHERE {
-
- ?page a knora-api:StillImageRepresentation .
- ?page a knora-api:Resource .
-
- ?page knora-api:isPartOf <${resourceIri}> .
- knora-api:isPartOf knora-api:objectType knora-api:Resource .
-
- <${resourceIri}> a knora-api:Resource .
-
- ?page knora-api:seqnum ?seqnum .
- knora-api:seqnum knora-api:objectType xsd:integer .
-
- ?seqnum a xsd:integer .
-
- ?page knora-api:hasStillImageFile ?file .
- knora-api:hasStillImageFile knora-api:objectType knora-api:File .
-
- ?file a knora-api:File .
-
- } ORDER BY ?seqnum
- OFFSET ${offset}
-`;
-
- return this.doExtendedSearch(sparqlQueryStr);
-
- }
-
-
- /**
- *
- * Returns all incoming links for the given resource Iri
- * but incoming regions and still image representations.
- *
- * @param {string} resourceIri the Iri of the resource whose incoming links should be returned.
- * @param offset the offset to be used for paging. 0 is the default and is used to get the first page of results.
- */
- getIncomingLinksForResource(resourceIri: string, offset: number): Observable {
- let sparqlQueryStr = `
- PREFIX knora-api:
-
-
- CONSTRUCT {
-
- ?incomingRes knora-api:isMainResource true .
-
- ?incomingRes ?incomingProp <${resourceIri}> .
-
- } WHERE {
-
- ?incomingRes a knora-api:Resource .
-
- ?incomingRes ?incomingProp <${resourceIri}> .
-
- <${resourceIri}> a knora-api:Resource .
-
- ?incomingProp knora-api:objectType knora-api:Resource .
-
- knora-api:isRegionOf knora-api:objectType knora-api:Resource .
- knora-api:isPartOf knora-api:objectType knora-api:Resource .
-
- FILTER NOT EXISTS {
- ?incomingRes knora-api:isRegionOf <${resourceIri}> .
- }
-
- FILTER NOT EXISTS {
- ?incomingRes knora-api:isPartOf <${resourceIri}> .
- }
-
- } OFFSET ${offset}
-
- `;
-
- return this.doExtendedSearch(sparqlQueryStr);
- }
-
-}
diff --git a/src/app/model/services/language.service.spec.ts b/src/app/model/services/language.service.spec.ts
index 28243f86..fb03820f 100644
--- a/src/app/model/services/language.service.spec.ts
+++ b/src/app/model/services/language.service.spec.ts
@@ -9,7 +9,7 @@ describe('LanguageService', () => {
});
});
- xit('should be created', inject([LanguageService], (service: LanguageService) => {
+ it('should be created', inject([LanguageService], (service: LanguageService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/src/app/model/services/language.service.ts b/src/app/model/services/language.service.ts
index 7a810dc1..aa4ce567 100644
--- a/src/app/model/services/language.service.ts
+++ b/src/app/model/services/language.service.ts
@@ -1,14 +1,15 @@
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {Subject} from 'rxjs/Subject';
+import { Injectable } from '@angular/core';
+import { Observable, Subject } from 'rxjs';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class LanguageService {
private subject = new Subject();
setLanguage(lang: string) {
- this.subject.next({var: lang});
+ this.subject.next({ var: lang });
}
getLanguage(): Observable {
return this.subject.asObservable();
diff --git a/src/app/model/services/lists.service.spec.ts b/src/app/model/services/lists.service.spec.ts
deleted file mode 100644
index 98a568b7..00000000
--- a/src/app/model/services/lists.service.spec.ts
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {async, inject, TestBed} from '@angular/core/testing';
-
-import {ListsService} from './lists.service';
-import {ApiService} from './api.service';
-import {
- imagesProjectIri,
- listsResponseJson,
- listsTestData,
- yesNodeInfoTestData,
- yesNoMaybeListResponseJson,
- yesNoMaybeListTestData
-} from '../test-data/shared-test-data';
-import {JsonConvert, OperationMode, ValueCheckingMode} from 'json2typescript';
-import {HttpModule} from '@angular/http';
-import {HttpClientModule} from '@angular/common/http';
-import {StoreService} from './store.service';
-import {List, ListCreatePayload, ListInfo, ListNodeInfo, ListResponse, ListsResponse} from '../webapi/knora/admin';
-import {environment} from '../../../environments/environment';
-import {ApiServiceError} from './api-service-error';
-import {StringLiteralV2} from '../webapi/knora/v2';
-import {ListInfoUpdatePayload} from '../webapi/knora/admin/lists/list-info-update-payload';
-import {AuthenticationService} from './authentication.service';
-import {UsersService} from './users.service';
-import {ProjectsService} from './projects.service';
-
-describe('ListsService', () => {
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpModule,
- HttpClientModule
- ],
- providers: [
- ApiService,
- AuthenticationService,
- ListsService,
- ProjectsService,
- StoreService,
- UsersService
- ]
- });
- });
-
- it('should be created', async(inject(
- [ListsService], (service) => {
- expect(service).toBeDefined();
- }))
- );
-
- it('should parse lists-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: ListsResponse = jsonConvert.deserializeObject(listsResponseJson, ListsResponse);
-
- expect(result).toBeTruthy();
- });
-
- it('should parse list-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result = jsonConvert.deserializeObject(yesNoMaybeListResponseJson, ListResponse);
-
- expect(result).toBeTruthy();
- });
-
-
- if (environment.type === 'integration') {
-
- it('should load test data [it]', async(inject(
- [StoreService], (service) => {
-
- expect(service).toBeDefined();
-
- service.resetTriplestoreContent([])
- .subscribe(
- (result: string) => {
- expect(result).toBe('success');
- });
-
- })), 300000);
-
- it('#getLists should return all lists [it]', async(inject(
- [ListsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getLists()
- .subscribe(
- (lists: List[]) => {
- // console.log('lists: ' + JSON.stringify(lists));
- expect(lists.length).toBe(1);
- expect(lists).toEqual(listsTestData);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getList should return a list [it]', async(inject(
- [ListsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getList('http://rdfh.ch/lists/FFFF/ynm01')
- .subscribe(
- (list: List) => {
- // console.log('list: ' + JSON.stringify(list));
- expect(list).toEqual(yesNoMaybeListTestData);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getListInfo should return a list info [it]', async(inject(
- [ListsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getListInfo('http://rdfh.ch/lists/FFFF/ynm01')
- .subscribe(
- (listinfo: ListInfo) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(listinfo).toEqual(yesNoMaybeListTestData.listinfo);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getListNodeInfo should return a list node info [it]', async(inject(
- [ListsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getListNodeInfo('http://rdfh.ch/lists/FFFF/ynm01-01')
- .subscribe(
- (nodeinfo: ListNodeInfo) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(nodeinfo).toEqual(yesNodeInfoTestData);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- /* Create and update tests */
-
- it('#createList should create a list [it]', async(inject(
- [ListsService, AuthenticationService], (service, auth) => {
-
- expect(service).toBeDefined();
- expect(auth).toBeDefined();
-
- // we need to login as project admin
- auth.login('user02.user@example.com', 'test')
- .map(
- (result: boolean) => {
-
- // login successful
- expect(result).toEqual(true);
-
- // create payload
- const payload: ListCreatePayload = {
- projectIri: imagesProjectIri,
- labels: [{value: 'Neue Liste', language: 'de'}],
- comments: []
- };
- service.createList(payload).subscribe(
- (list: List) => {
- // console.log('users: ' + JSON.stringify(users));
-
- const listInfo = list.listinfo;
- const labels: StringLiteralV2[] = list.listinfo.labels;
-
- const expectedLabel: StringLiteralV2 = {value: 'Neue Liste', language: 'de'};
- const children = list.children;
-
- expect(listInfo.projectIri).toEqual(imagesProjectIri);
- expect(labels[0].value).toEqual(expectedLabel.value);
- expect(labels[0].language).toEqual(expectedLabel.language);
- expect(children.length).toEqual(0);
-
- // save for next test. don't know if this is the best approach for storing between tests.
- localStorage.setItem('newListInfoId', listInfo.id) ;
- });
- });
- })));
-
- it('#updateListInfo should update a list info [it]', async(inject(
- [ListsService, AuthenticationService], (service, auth) => {
-
- expect(service).toBeDefined();
-
- // need the list IRI from the previous test
- const newList = localStorage.getItem('newListInfoId');
- expect(newList).toBeDefined();
-
- // need to login
- auth.login('user01.user1@example.com', 'test')
- .map(
- (result: boolean) => {
-
- // login successful
- expect(result).toEqual(true);
-
- const updatePayload: ListInfoUpdatePayload = {
- listIri: newList,
- projectIri: imagesProjectIri,
- labels: [{value: 'Neue geänderte Liste', language: 'de'}],
- comments: []
- };
-
- service.updateListInfo(updatePayload)
- .subscribe(
- (listinfo: ListInfo) => {
- // console.log('users: ' + JSON.stringify(users));
-
- const labels: StringLiteralV2[] = listinfo.labels;
-
- const expectedLabel: StringLiteralV2 = {value: 'Neue geänderte Liste', language: 'de'};
-
- expect(labels[0].value).toBe(expectedLabel.value);
- expect(labels[0].language).toBe(expectedLabel.language);
- },
- (error: ApiServiceError) => {
- fail(error);
- });
-
- });
- })));
-
- } else {
- xit('integration tests skipped. run "ng test --env=it".');
- }
-});
diff --git a/src/app/model/services/lists.service.ts b/src/app/model/services/lists.service.ts
deleted file mode 100644
index 34a877df..00000000
--- a/src/app/model/services/lists.service.ts
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {ApiServiceError} from './api-service-error';
-import {ApiServiceResult} from './api-service-result';
-import {ApiService} from './api.service';
-import {List, ListInfo, ListInfoResponse, ListNodeInfo, ListNodeInfoResponse, ListResponse, ListsResponse, ListCreatePayload} from '../webapi/knora/admin';
-import {ListInfoUpdatePayload} from '../webapi/knora/admin/lists/list-info-update-payload';
-
-
-@Injectable()
-export class ListsService extends ApiService {
-
- /**
- * Retrieves information about lists. If the 'projectIri' is supplied, then only
- * information about lists belonging to this project are returned. If no 'projectIri' is
- * supplied, then all lists are returned. The returned lists don't include any children!
- *
- * @param projectIri
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getLists(projectIri?: string): Observable {
-
- let url: string;
- const empty: List[] = [];
-
- url = '/admin/lists';
-
- if (projectIri) {
- url = url + '?projectIri=' + encodeURIComponent(projectIri)
- }
-
- return this.httpGet(url).map(
- (result: ApiServiceResult) => {
- const received: List[] = result.getBody(ListsResponse).lists;
- // console.log('ListsService - getLists - projectIri: ' + projectIri + ' , lists: ', received);
- if (received.length > 0) {
- return received;
- } else {
- return empty;
- }
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.log('ListsService - getLists - error: ', errorMessage);
- throw error;
- }
- );
- }
-
-
- /**
- * Retrieves the complete list given the list's IRI.
- *
- * @param listIri
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getList(listIri: string): Observable {
-
- return this.httpGet('/admin/lists/' + encodeURIComponent(listIri)).map(
- (result: ApiServiceResult) => {
- const received: List = result.getBody(ListResponse).list;
- // console.log('ListsService - getLists - listIri: ' + listIri + ' , list: ', received);
- return received;
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('ListsService - getList - error: ' + errorMessage);
- throw error;
- }
- )
-
- }
-
- /**
- * Retrieves the basic list information given the list's IRI.
- *
- * @param {string} listIri
- * @returns {Observable}
- */
- getListInfo(listIri: string): Observable {
- return this.httpGet('/admin/lists/infos/' + encodeURIComponent(listIri)).map(
- (result: ApiServiceResult) => {
- const received: ListInfo = result.getBody(ListInfoResponse).listinfo;
- // console.log('ListsService - getListInfo - listIri: ' + listIri + ' , listinfo: ', received);
- return received;
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('ListsService - getListInfo - error: ' + errorMessage);
- throw error;
- }
- )
- }
-
- /**
- * Retrieves the basic list (child) node information.
- *
- * @param nodeIri
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getListNodeInfo(nodeIri: string): Observable {
- return this.httpGet('/admin/lists/nodes/' + encodeURIComponent(nodeIri)).map(
- (result: ApiServiceResult) => {
- const received: ListNodeInfo = result.getBody(ListNodeInfoResponse).nodeinfo;
- // console.log('ListsService - getLists - listIri: ' + nodeIri + ' , list: ', received);
- return received
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.log('ListsService - getList - error: ' + errorMessage);
- throw error;
- }
- )
-
- }
-
- /**
- * Create a new list.
- *
- * @param {ListCreatePayload} payload
- * @returns {Observable}
- */
- createList(payload: ListCreatePayload): Observable {
- return this.httpPost('/admin/lists', payload, {}).map(
- (result: ApiServiceResult) => {
- const received: List = result.getBody(ListResponse).list;
- // console.log('ListsService - createList - result:', result);
- return received;
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('ListsService - createList - error: ' + errorMessage);
- throw error;
- }
- )
- }
-
- /**
- * Updates the list's basic information.
- *
- * @param {ListInfoUpdatePayload} payload
- * @returns {Observable}
- */
- updateListInfo(payload: ListInfoUpdatePayload): Observable {
- console.log('service payload: ', payload);
- return this.httpPut('/admin/lists/infos/' + encodeURIComponent(payload.listIri), payload, {}).map(
- (result: ApiServiceResult) => {
- const received: ListInfo = result.getBody(ListInfoResponse).listinfo;
- // console.log('ListsService - updateListInfo - result:', result);
- return received;
- },
- (error: ApiServiceError) => {
- const errorMessage = error;
- console.error('ListsService - updateListInfo - error: ' + errorMessage);
- throw error;
- }
- )
- }
-
-}
diff --git a/src/app/model/services/ontology.service.spec.ts b/src/app/model/services/ontology.service.spec.ts
deleted file mode 100644
index 4a77bf7d..00000000
--- a/src/app/model/services/ontology.service.spec.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {ApiService} from './api.service';
-import {OntologyService} from './ontology.service';
-
-describe('OntologyService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule,
- AppRoutingModule
- ],
- providers: [
- ApiService,
- OntologyService
- ]
- });
- });
-
- xit('should be created', inject([OntologyService], (service: OntologyService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/ontology.service.ts b/src/app/model/services/ontology.service.ts
deleted file mode 100644
index b0750126..00000000
--- a/src/app/model/services/ontology.service.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {Injectable} from '@angular/core';
-import {ApiService} from './api.service';
-import {Observable} from 'rxjs/Observable';
-import {ApiServiceResult} from "./api-service-result";
-
-@Injectable()
-export class OntologyService extends ApiService {
-
- /**
- * Requests the metadata about existing ontologies from Knora's ontologies route.
- *
- * @returns {Observable}
- */
- getOntologiesMetadata(): Observable {
- return this.httpGetV2('/ontologies/metadata');
- }
-
- /**
- * Requests all entity definitions for the given ontologies from Knora's ontologies route.
- *
- * @param ontologyIris the Iris of the named graphs whose resource classes are to be returned.
- * @returns {any}
- */
- getAllEntityDefinitionsForOntologies(ontologyIri: string): Observable {
-
- return this.httpGetV2('/ontologies/allentities/' + encodeURIComponent(ontologyIri));
-
- }
-
- /**
- * Requests information about the given resource classes from Knora's ontologies route.
- *
- * @param resourceClassIris the Iris of the resource classes to be queried.
- * @returns {any}
- */
- getResourceClasses(resourceClassIris: Array): Observable {
-
- if (resourceClassIris.length === 0) {
- // no resource class Iris are given to query for, return a failed Observer
- return Observable.create(observer => observer.error('No resource class Iris given for call of OntologyService.getResourceClasses'));
- }
-
- let resClassUriEnc = '';
-
- resourceClassIris.forEach(function (resClassIri) {
- resClassUriEnc = resClassUriEnc + '/' + encodeURIComponent(resClassIri.toString())
- });
-
- return this.httpGetV2('/ontologies/classes' + resClassUriEnc);
- }
-
- /**
- * Requests properties from Knora's ontologies route.
- *
- * @param propertyIris the Iris of the properties to be queried.
- * @returns {any}
- */
- getProperties(propertyIris: string[]) {
-
- if (propertyIris.length === 0) {
- // no resource class Iris are given to query for, return a failed Observer
- return Observable.create(observer => observer.error('No property Iris given for call of OntologyService.getProperties'));
- }
-
- let propertiesUriEnc = '';
-
- propertyIris.forEach(function (resClassIri) {
- propertiesUriEnc = propertiesUriEnc + '/' + encodeURIComponent(resClassIri.toString())
- });
-
- return this.httpGetV2('/ontologies/properties' + propertiesUriEnc);
-
- }
-
- newOntology() {
- /*
-
- // post route: /v2/ontologies/
-
- // the knora api needs the following data:
- {
- "knora-api:ontologyName": "example",
- "knora-api:projectIri": "$projectWithProjectID",
- "@context": {
- "knora-api": "${OntologyConstants.KnoraApiV2WithValueObjects.KnoraApiV2PrefixExpansion}" // e.g. knora-api url incl. #
- }
- }
- */
- }
-
-}
diff --git a/src/app/model/services/ontologycache.service.spec.ts b/src/app/model/services/ontologycache.service.spec.ts
deleted file mode 100644
index a21d728f..00000000
--- a/src/app/model/services/ontologycache.service.spec.ts
+++ /dev/null
@@ -1,814 +0,0 @@
-import { async, inject, TestBed } from '@angular/core/testing';
-import { AppModule } from '../../app.module';
-import { AppRoutingModule } from '../../app-routing.module';
-import { ApiService } from './api.service';
-import {
- Cardinality,
- CardinalityOccurrence,
- OntologyCacheService,
- OntologyInformation,
- Properties,
- Property,
- ResourceClass,
- ResourceClasses,
- ResourceClassIrisForOntology
-} from './ontologycache.service';
-import { OntologyService } from './ontology.service';
-import { BaseRequestOptions, Http, Response, ResponseOptions } from '@angular/http'; // https://blog.thecodecampus.de/angular-http-testing-syntaxerror-unexpected-token-o-json-position-1/
-import { MockBackend } from '@angular/http/testing';
-import { Observable } from 'rxjs/Observable';
-
-
-describe('OntologyCacheService', () => {
-
- let originalTimeout;
-
- beforeEach(function() {
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
- });
-
- afterEach(function () {
- jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
- });
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule,
- AppRoutingModule
- ],
- providers: [
- ApiService,
- OntologyCacheService,
- OntologyService,
- MockBackend,
- BaseRequestOptions,
- {
- provide: Http,
- useFactory: (backend, options) => new Http(backend, options),
- deps: [MockBackend, BaseRequestOptions]
- }
- ]
- }).compileComponents();
- }));
-
- beforeEach(async(inject([OntologyCacheService, MockBackend], (service: OntologyCacheService, mockBackend) => {
-
-
- // define different mock responses for different API calls
- const responses = {};
- responses['http://0.0.0.0:3333/v2/ontologies/allentities/http%3A%2F%2F0.0.0.0%3A3333%2Fontology%2F0801%2Fbeol%2Fv2'] = new Response(new ResponseOptions({body: require('../test-data/ontologycache/beol-complex-onto.json')}));
- responses['http://0.0.0.0:3333/v2/ontologies/allentities/http%3A%2F%2Fapi.knora.org%2Fontology%2Fknora-api%2Fv2'] = new Response(new ResponseOptions({body: require('../test-data/ontologycache/knora-api-complex-onto.json')}));
- responses['http://0.0.0.0:3333/v2/ontologies/allentities/http%3A%2F%2F0.0.0.0%3A3333%2Fontology%2F0001%2Fsomething%2Fv2'] = new Response(new ResponseOptions({body: require('../test-data/ontologycache/something-complex-onto.json')}));
- responses['http://0.0.0.0:3333/v2/ontologies/allentities/http%3A%2F%2F0.0.0.0%3A3333%2Fontology%2F0001%2Fanything%2Fv2'] = new Response(new ResponseOptions({body: require('../test-data/ontologycache/anything-complex-onto.json')}));
-
-
- mockBackend.connections.subscribe(c => {
- const response = responses[c.request.url];
- c.mockRespond(response);
- });
-
- })));
-
- it('should be created', inject([OntologyCacheService], (service: OntologyCacheService) => {
- expect(service).toBeTruthy();
- }));
-
- it('should convert and cache the BEOL ontology complex', async(inject([OntologyCacheService], (service: OntologyCacheService) => {
-
- const ontoResponseObs: Observable = service.getEntityDefinitionsForOntologies(['http://0.0.0.0:3333/ontology/0801/beol/v2']);
-
- ontoResponseObs.subscribe(
- (ontoRes: OntologyInformation) => {
-
- const resClassesForBEOL = ontoRes.getResourceClassForOntology();
-
- expect(resClassesForBEOL['http://0.0.0.0:3333/ontology/0801/beol/v2']).toEqual(resClassesInBEOL)
-
- }
- );
-
- })));
-
- it('should convert and cache the anything ontology complex', async(inject([OntologyCacheService], (service: OntologyCacheService) => {
-
- const ontoResponseObs: Observable = service.getEntityDefinitionsForOntologies(['http://0.0.0.0:3333/ontology/0001/anything/v2']);
-
- ontoResponseObs.subscribe(
- (ontoRes: OntologyInformation) => {
-
- const resClassesForAnything: ResourceClassIrisForOntology = ontoRes.getResourceClassForOntology();
-
- expect(resClassesForAnything['http://0.0.0.0:3333/ontology/0001/anything/v2']).toEqual(resClassesInAnything)
-
- }
- );
-
- })));
-
- it('should convert and cache the something ontology complex', async(inject([OntologyCacheService], (service: OntologyCacheService) => {
-
- const ontoResponseObs: Observable = service.getEntityDefinitionsForOntologies(['http://0.0.0.0:3333/ontology/0001/something/v2']);
-
- ontoResponseObs.subscribe(
- (ontoRes: OntologyInformation) => {
-
- const resClassesForSomething: ResourceClassIrisForOntology = ontoRes.getResourceClassForOntology();
-
- expect(resClassesForSomething['http://0.0.0.0:3333/ontology/0001/something/v2']).toEqual(resClassesInSomething);
-
- const resourceClasses: ResourceClasses = ontoRes.getResourceClasses();
-
- const expectedCards = [
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#attachedToProject'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#attachedToUser'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#creationDate'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#hasPermissions'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#lastModificationDate'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://www.w3.org/2000/01/rdf-schema#label'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/something/v2#hasOtherSomething'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/something/v2#hasOtherSomethingValue'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasText'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPictureValue'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThing'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThingValue'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBlueThingValue'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBlueThing'
- )
- ];
-
- const expectedSomething = new ResourceClass(
- 'http://0.0.0.0:3333/ontology/0001/something/v2#Something',
- 'something.png',
- 'A something is a thing.',
- 'Something',
- expectedCards
- );
-
- expect(resourceClasses['http://0.0.0.0:3333/ontology/0001/something/v2#Something']).toEqual(expectedSomething);
-
- const expectedProps = {
- 'http://api.knora.org/ontology/knora-api/v2#attachedToProject': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#attachedToProject',
- 'http://api.knora.org/ontology/knora-api/v2#knoraProject',
- 'Connects something to a project',
- 'attached to project',
- [],
- false,
- false,
- false),
- 'http://api.knora.org/ontology/knora-api/v2#attachedToUser': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#attachedToUser',
- 'http://api.knora.org/ontology/knora-api/v2#User',
- 'Connects something to a user',
- 'attached to user',
- [],
- false,
- false,
- false),
- 'http://api.knora.org/ontology/knora-api/v2#creationDate': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#creationDate',
- 'http://www.w3.org/2001/XMLSchema#dateTimeStamp',
- 'Indicates when a resource was created',
- undefined,
- [],
- false,
- false,
- false),
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- 'Indicates that this resource referred to by another resource',
- 'has incoming links',
- ['http://api.knora.org/ontology/knora-api/v2#hasLinkToValue'],
- false,
- false,
- true),
- 'http://api.knora.org/ontology/knora-api/v2#hasPermissions': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#hasPermissions',
- 'http://www.w3.org/2001/XMLSchema#string',
- undefined,
- undefined,
- [],
- false,
- false,
- false),
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo',
- 'http://api.knora.org/ontology/knora-api/v2#Resource',
- 'Represents a link in standoff markup from one resource to another.',
- 'has Standoff Link to',
- ['http://api.knora.org/ontology/knora-api/v2#hasLinkTo'],
- false,
- true,
- false),
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- 'Represents a link in standoff markup from one resource to another.',
- 'has Standoff Link to',
- ['http://api.knora.org/ontology/knora-api/v2#hasLinkToValue'],
- false,
- false,
- true),
- 'http://api.knora.org/ontology/knora-api/v2#lastModificationDate': new Property(
- 'http://api.knora.org/ontology/knora-api/v2#lastModificationDate',
- 'http://www.w3.org/2001/XMLSchema#dateTimeStamp',
- undefined,
- undefined,
- [],
- false,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem',
- 'http://api.knora.org/ontology/knora-api/v2#ListValue',
- undefined,
- 'List element',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem',
- 'http://api.knora.org/ontology/knora-api/v2#ListValue',
- undefined,
- 'Other list element',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/something/v2#hasOtherSomething': new Property(
- 'http://0.0.0.0:3333/ontology/0001/something/v2#hasOtherSomething',
- 'http://0.0.0.0:3333/ontology/0001/something/v2#Something',
- 'Has another something.',
- 'has other something',
- ['http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThing'],
- true,
- true,
- false),
- 'http://0.0.0.0:3333/ontology/0001/something/v2#hasOtherSomethingValue': new Property(
- 'http://0.0.0.0:3333/ontology/0001/something/v2#hasOtherSomethingValue',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- 'Has another something.',
- 'has other something',
- ['http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue'],
- true,
- false,
- true),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext',
- 'http://api.knora.org/ontology/knora-api/v2#TextValue',
- undefined,
- 'Text',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasText': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasText',
- 'http://api.knora.org/ontology/knora-api/v2#TextValue',
- undefined,
- 'Text',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate',
- 'http://api.knora.org/ontology/knora-api/v2#DateValue',
- undefined,
- 'Date',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger',
- 'http://api.knora.org/ontology/knora-api/v2#IntValue',
- undefined,
- 'Integer',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal',
- 'http://api.knora.org/ontology/knora-api/v2#DecimalValue',
- undefined,
- 'Decimal number',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean',
- 'http://api.knora.org/ontology/knora-api/v2#BooleanValue',
- undefined,
- 'Boolean value',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri',
- 'http://api.knora.org/ontology/knora-api/v2#UriValue',
- undefined,
- 'URI',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval',
- 'http://api.knora.org/ontology/knora-api/v2#IntervalValue',
- undefined,
- 'Time interval',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor',
- 'http://api.knora.org/ontology/knora-api/v2#ColorValue',
- undefined,
- 'Color',
- ['http://api.knora.org/ontology/knora-api/v2#hasValue'],
- true,
- false,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#ThingPicture',
- undefined,
- 'Picture of a thing',
- ['http://api.knora.org/ontology/knora-api/v2#hasRepresentation'],
- true,
- true,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPictureValue': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPictureValue',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- undefined,
- 'Picture of a thing',
- ['http://api.knora.org/ontology/knora-api/v2#hasRepresentationValue'],
- true,
- false,
- true),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThing': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThing',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#Thing',
- undefined,
- 'is part of',
- ['http://api.knora.org/ontology/knora-api/v2#isPartOf'],
- true,
- true,
- false),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThingValue': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThingValue',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- undefined,
- 'is part of',
- ['http://api.knora.org/ontology/knora-api/v2#isPartOfValue'],
- true,
- false,
- true),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBlueThingValue': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBlueThingValue',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- undefined,
- 'A blue thing',
- ['http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue'],
- true,
- false,
- true),
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBlueThing': new Property(
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBlueThing',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#BlueThing',
- undefined,
- 'A blue thing',
- ['http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThing'],
- true,
- true,
- false)
- };
-
- const expectedProperties = new Properties();
-
- for (const propIri in expectedProps) {
- expectedProperties[propIri] = expectedProps[propIri];
- }
-
- expect(Object.keys(expectedProperties)).toEqual(Object.keys(expectedProps));
-
- const props = ontoRes.getProperties();
-
- expect(props).toEqual(expectedProperties)
-
- }
- );
-
- })));
-
- it('should get an internal representation of a resource class from the cache', async(inject([OntologyCacheService], (service: OntologyCacheService) => {
-
- const ontoResponseObs: Observable = service.getEntityDefinitionsForOntologies(['http://0.0.0.0:3333/ontology/0801/beol/v2']);
-
- ontoResponseObs.subscribe(
- (ontoRes: OntologyInformation) => {
-
- const resourceClasses = ontoRes.getResourceClasses();
-
- const personExpected = new ResourceClass(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'person.png',
- 'A resource representing a person',
- 'Person',
- [
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#attachedToProject'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#attachedToUser'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#creationDate'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#hasPermissions'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkTo'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://api.knora.org/ontology/knora-api/v2#hasStandoffLinkToValue'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://api.knora.org/ontology/knora-api/v2#lastModificationDate'
- ),
- new Cardinality(
- CardinalityOccurrence.card,
- 1,
- 'http://www.w3.org/2000/01/rdf-schema#label'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasFamilyName'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasGivenName'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#personHasTitle'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasAlternativeName'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#beolIDs'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasIAFIdentifier'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasBirthDate'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasDeathDate'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasFloruitDate'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasMarriageDate'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasBirthPlace'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasDeathPlace'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasFloruitPlace'
- ),
- new Cardinality(
- CardinalityOccurrence.maxCard,
- 1,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasMarriagePlace'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSonValue'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSon'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasDictionaryEntries'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#comment'
- ),
- new Cardinality(
- CardinalityOccurrence.minCard,
- 0,
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#mentionedIn'
- )
-
- ]
- );
-
- expect(resourceClasses['http://0.0.0.0:3333/ontology/0801/beol/v2#person']).toEqual(personExpected);
-
- }
- );
-
- })));
-
- it('should get an internal representation of a property from the cache', async(inject([OntologyCacheService], (service: OntologyCacheService) => {
-
- const ontoResponseObs: Observable = service.getEntityDefinitionsForOntologies(['http://0.0.0.0:3333/ontology/0801/beol/v2']);
-
- ontoResponseObs.subscribe(
- (ontoRes: OntologyInformation) => {
-
- const props = ontoRes.getProperties();
-
- const commentExpected = new Property(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#comment',
- 'http://api.knora.org/ontology/knora-api/v2#TextValue',
- 'Comment',
- 'Comment',
- ['http://api.knora.org/ontology/knora-api/v2#hasComment'],
- true,
- false,
- false
- );
-
- expect(props['http://0.0.0.0:3333/ontology/0801/beol/v2#comment']).toEqual(commentExpected);
-
- const sonExpected = new Property(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSon',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Repräsentiert eine Vater-Sohn Beziehung',
- 'has son',
- ['http://api.knora.org/ontology/knora-api/v2#hasLinkTo'],
- true,
- true,
- false
- );
-
- expect(props['http://0.0.0.0:3333/ontology/0801/beol/v2#hasSon']).toEqual(sonExpected);
-
- const sonValueExpected = new Property(
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSonValue',
- 'http://api.knora.org/ontology/knora-api/v2#LinkValue',
- 'Repräsentiert eine Vater-Sohn Beziehung',
- 'has son',
- ['http://api.knora.org/ontology/knora-api/v2#hasLinkToValue'],
- true,
- false,
- true
- );
-
- expect(props['http://0.0.0.0:3333/ontology/0801/beol/v2#hasSonValue']).toEqual(sonValueExpected);
-
- }
- );
-
-
- })));
-
-
- it('should convert and cache the Knora-API ontology complex', async(inject([OntologyCacheService], (service: OntologyCacheService) => {
-
- const ontoResponseObs: Observable = service.getEntityDefinitionsForOntologies(['http://api.knora.org/ontology/knora-api/v2']);
-
- ontoResponseObs.subscribe(
- (ontoRes: OntologyInformation) => {
-
- const resClassesForKnoraApi = ontoRes.getResourceClassForOntology();
-
- expect(resClassesForKnoraApi['http://api.knora.org/ontology/knora-api/v2']).toEqual(resClassesInKnoraApi);
-
- }
- );
-
- })));
-});
-
-// expected resources classes defined in the BEOL ontology
-const resClassesInBEOL = [
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#Archive',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#figure',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#introduction',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#letter',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#manuscript',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#page',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#publishedLetter',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#section',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#writtenSource'];
-
-// expected resource classes defined in the knora api ontology
-const resClassesInKnoraApi = [
- 'http://api.knora.org/ontology/knora-api/v2#Annotation',
- 'http://api.knora.org/ontology/knora-api/v2#AudioRepresentation',
- 'http://api.knora.org/ontology/knora-api/v2#DDDRepresentation',
- 'http://api.knora.org/ontology/knora-api/v2#DocumentRepresentation',
- 'http://api.knora.org/ontology/knora-api/v2#LinkObj',
- 'http://api.knora.org/ontology/knora-api/v2#MovingImageRepresentation',
- 'http://api.knora.org/ontology/knora-api/v2#Region',
- 'http://api.knora.org/ontology/knora-api/v2#Representation',
- 'http://api.knora.org/ontology/knora-api/v2#StillImageRepresentation',
- 'http://api.knora.org/ontology/knora-api/v2#TextRepresentation',
- 'http://api.knora.org/ontology/knora-api/v2#XSLTransformation'
-];
-
-const resClassesInSomething = [
- 'http://0.0.0.0:3333/ontology/0001/something/v2#Something'
-];
-
-const resClassesInAnything = [
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#BlueThing',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#Thing',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#ThingPicture'
-];
diff --git a/src/app/model/services/ontologycache.service.ts b/src/app/model/services/ontologycache.service.ts
deleted file mode 100644
index 316a271d..00000000
--- a/src/app/model/services/ontologycache.service.ts
+++ /dev/null
@@ -1,876 +0,0 @@
-import {Injectable} from '@angular/core';
-import {OntologyService} from './ontology.service';
-import {ApiServiceResult} from './api-service-result';
-import {Observable} from 'rxjs/Observable';
-import {AppConfig} from '../../app.config';
-import {Utils} from '../../utils';
-
-import 'rxjs/add/operator/mergeMap';
-import 'rxjs/add/observable/fromPromise';
-import 'rxjs/add/observable/of';
-import 'rxjs/add/operator/map';
-import {forkJoin} from 'rxjs/observable/forkJoin';
-
-declare let require: any; // http://stackoverflow.com/questions/34730010/angular2-5-minute-install-bug-require-is-not-defined
-const jsonld = require('jsonld');
-
-/**
- * Represents an error occurred in OntologyCacheService.
- */
-class OntologyCacheError extends Error {
-
- constructor(readonly message: string) {
- super(message)
- }
-
-}
-
-/**
- * Represents an ontology's metadata.
- */
-export class OntologyMetadata {
-
- /**
- *
- * @param {string} id Iri identifying the ontology.
- * @param {string} label a label describing the ontology.
- */
- constructor(readonly id: string,
- readonly label: string) {
-
- }
-
-}
-
-/**
- * Occurrence of a property for a resource class.
- */
-export enum CardinalityOccurrence {
- minCard = 0,
- card = 1,
- maxCard = 2
-}
-
-/**
- * Cardinality of a property for the given resource class.
- */
-export class Cardinality {
-
- /**
- *
- * @param {CardinalityOccurrence} occurrence type of given occurrence.
- * @param {number} value numerical value of given occurrence.
- * @param {string} property the property the given occurrence applies to.
- */
- constructor(readonly occurrence: CardinalityOccurrence,
- readonly value: number,
- readonly property: string) {
- }
-}
-
-/**
- * A resource class definition.
- */
-export class ResourceClass {
-
- /**
- *
- * @param {string} id Iri identifying the resource class.
- * @param {string} icon path to an icon representing the resource class.
- * @param {string} comment comment on the resource class.
- * @param {string} label label for the resource class.
- * @param {Array} cardinalities the resource class's properties.
- */
- constructor(readonly id: string,
- readonly icon: string,
- readonly comment: string,
- readonly label: string,
- readonly cardinalities: Array) {
-
- }
-}
-
-/**
- * A map of resource class Iris to resource class definitions.
- */
-export class ResourceClasses {
- [index: string]: ResourceClass;
-}
-
-/**
- * A property definition.
- */
-export class Property {
-
- /**
- *
- * @param {string} id Iri identifying the property definition.
- * @param {string} objectType the property's object constraint.
- * @param {string} comment comment on the property definition.
- * @param {string} label label for the property definition.
- * @param {Array} subPropertyOf Iris of properties the given property is a subproperty of.
- * @param {Boolean} isEditable indicates whether the given property can be edited by the client.
- * @param {Boolean} isLinkProperty indicates whether the given property is a linking property.
- * @param {Boolean} isLinkValueProperty indicates whether the given property refers to a link value.
- */
- constructor(readonly id: string,
- readonly objectType: string,
- readonly comment: string,
- readonly label: string,
- readonly subPropertyOf: Array,
- readonly isEditable: Boolean,
- readonly isLinkProperty: Boolean,
- readonly isLinkValueProperty: Boolean) {
-
- }
-}
-
-/**
- * A map of property Iris to property definitions.
- */
-export class Properties {
- [index: string]: Property;
-}
-
-/**
- * Groups resource classes by the ontology they are defined in.
- *
- * A map of ontology Iris to an array of resource class Iris.
- */
-export class ResourceClassIrisForOntology {
- [index: string]: Array;
-}
-
-/**
- * Represents cached ontology information (only used by this service internally).
- */
-class OntologyCache {
-
- /**
- * An Array of all existing ontologies.
- */
- ontologies: Array;
-
- /**
- * A list of all resource class Iris for a named graph.
- */
- resourceClassIrisForOntology: ResourceClassIrisForOntology;
-
- /**
- * Resource class definitions.
- */
- resourceClasses: ResourceClasses;
-
- /**
- * Property definitions.
- */
- properties: Properties;
-
- constructor() {
- this.ontologies = [];
-
- this.resourceClassIrisForOntology = new ResourceClassIrisForOntology();
-
- this.resourceClasses = new ResourceClasses();
-
- this.properties = new Properties();
- }
-
-
-}
-
-/**
- * Represents ontology information requested from this service.
- */
-export class OntologyInformation {
-
- /**
- *
- * @param {ResourceClassIrisForOntology} resourceClassesForOntology all resource class Iris for a given ontology. TODO: can this be removed?
- * @param {ResourceClasses} resourceClasses resource class definitions.
- * @param {Properties} properties property definitions.
- */
- constructor(private resourceClassesForOntology: ResourceClassIrisForOntology, private resourceClasses: ResourceClasses, private properties: Properties) {
- }
-
- /**
- *
- * Merge the given [[OntologyInformation]] into the current instance,
- * updating the existing information.
- *
- * @params ontologyInfo the given [[OntologyInformation]] that has to be integrated.
- */
- updateOntologyInformation(ontologyInfo: OntologyInformation): void {
-
- // update resourceClassIrisForOntology
- const newResourceClassesForOntology = ontologyInfo.getResourceClassForOntology();
-
- for (const newResClassForOntology in newResourceClassesForOntology) {
- this.resourceClassesForOntology[newResClassForOntology] = newResourceClassesForOntology[newResClassForOntology]
- }
-
- // update resourceClasses
- const newResourceClasses = ontologyInfo.getResourceClasses();
-
- for (const newResClass in newResourceClasses) {
- this.resourceClasses[newResClass] = newResourceClasses[newResClass];
- }
-
- // update properties
- const newProperties = ontologyInfo.getProperties();
-
- for (const newProp in newProperties) {
- this.properties[newProp] = newProperties[newProp];
- }
-
- }
-
- /**
- * Gets resource classes definitions for ontologies.
- *
- * @returns {ResourceClassIrisForOntology}
- */
- getResourceClassForOntology(): ResourceClassIrisForOntology {
- return this.resourceClassesForOntology;
- }
-
- /**
- * Gets all resource classes as an object.
- *
- * @returns {ResourceClasses}
- */
- getResourceClasses(): ResourceClasses {
- return this.resourceClasses;
- }
-
- /**
- * Gets all resource classes as an Array.
- *
- * @returns {Array}
- */
- getResourceClassesAsArray(): Array {
-
- const resClasses: Array = [];
-
- for (const resClassIri in this.resourceClasses) {
- const resClass: ResourceClass = this.resourceClasses[resClassIri];
- resClasses.push(resClass);
- }
-
- return resClasses;
-
- }
-
- /**
- * Returns a resource class's label.
- *
- * @param {string} resClass to query for.
- * @returns {string} the resource class's label.
- */
- getLabelForResourceClass(resClass: string): string {
-
- if (resClass !== undefined) {
-
- const resClassDef = this.resourceClasses[resClass];
-
- if (resClassDef !== undefined && resClassDef.label !== undefined) {
- return resClassDef.label
- } else {
- // console.log(`OntologyInformation: no resource class ${resClass} found in resourceClasses`);
- return resClassDef.id;
- }
- } else {
- console.log('call of OntologyInformation.getLabelForResourceClass without argument resClass');
- }
- }
-
- /**
- * Get all properties as an object.
- *
- * @returns {Properties}
- */
- getProperties() {
- return this.properties;
- }
-
- /**
- * Gets all properties as an Array.
- *
- * @returns {Array}
- */
- getPropertiesAsArray() {
-
- const properties: Array = [];
-
- for (const propIri in this.properties) {
- const prop: Property = this.properties[propIri];
- properties.push(prop);
- }
-
- return properties;
-
- }
-
- /**
- * Returns a property's label.
- *
- * @param {string} property to query for.
- * @returns {string} the property's label.
- */
- getLabelForProperty(property: string): string {
-
- if (property !== undefined) {
-
- const propDef = this.properties[property];
-
- if (propDef !== undefined && propDef.label !== undefined) {
- return propDef.label
- } else {
- // console.log(`OntologyInformation: no label found for ${property} in properties`);
- return propDef.id;
- }
- } else {
- console.log('call of OntologyInformation.getLabelForProperty without argument property');
- }
- }
-
-}
-
-@Injectable()
-/**
- * Adds and retrieves information to and from the LocalStorage.
- * If an information is not cached already, it is requested from Knora and added to the cache.
- */
-export class OntologyCacheService {
-
- private excludedOntologies: Array = [AppConfig.SalsahGuiOntology, AppConfig.StandoffOntology];
-
- // properties that Knora is not responsible for and
- // that have to be ignored because they cannot be resolved at the moment
- private excludedProperties: Array = [AppConfig.RdfsLabel];
-
- // class definitions that are not be treated as Knora resource classes
- private nonResourceClasses: Array = [AppConfig.ForbiddenResource, AppConfig.XMLToStandoffMapping, AppConfig.ListNode];
-
- private cacheOntology: OntologyCache = new OntologyCache();
-
- constructor(private _ontologyService: OntologyService) {
- }
-
- /**
- * Requests the Iris of all the named graphs from Knora.
- *
- @returns {Observable} an Observable representing the required information.
- */
- private getOntologiesMetadataFromKnora(): Observable {
- const ontoResponse = this._ontologyService.getOntologiesMetadata().flatMap(
- // this would return an Observable of a PromiseObservable -> combine them into one Observable
- // http://reactivex.io/documentation/operators/flatmap.html
- // http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-mergeMap
- (ontRes: ApiServiceResult) => {
- const ontPromises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const ontPromise = ontPromises.compact(ontRes.body, {});
-
- // convert promise to Observable and return it
- // https://www.learnrxjs.io/operators/creation/frompromise.html
- return Observable.fromPromise(ontPromise);
- }
- );
-
- return ontoResponse;
- }
-
- /**
- * Requests all entity definitions for the given ontology from Knora.
- *
- * @param ontologyIri the Iri of the requested ontology.
- */
- private getAllEntityDefinitionsForOntologyFromKnora(ontologyIri: string): Observable {
-
- return this._ontologyService.getAllEntityDefinitionsForOntologies(ontologyIri).flatMap(
- // this would return an Observable of a PromiseObservable -> combine them into one Observable
- // http://reactivex.io/documentation/operators/flatmap.html
- // http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-mergeMap
- (ontRes: ApiServiceResult) => {
- const ontPromises = jsonld.promises;
- //compact JSON-LD using an empty context: expands all Iris
- const ontPromise = ontPromises.compact(ontRes.body, {});
-
- // convert promise to Observable and return it
- // https://www.learnrxjs.io/operators/creation/frompromise.html
- return Observable.fromPromise(ontPromise);
- }
- );
-
- }
-
- /**
- * Writes all the ontologies' metadata returned by Knora to the cache.
- *
- * @param {string[]} ontologies metadata of all existing ontologies.
- */
- private convertAndWriteOntologiesMetadataToCache(ontologies: object[]) {
-
- this.cacheOntology.ontologies = ontologies.map(
- ontology => {
- return new OntologyMetadata(ontology['@id'], ontology[AppConfig.RdfsLabel]);
- }
- );
- }
-
- /**
- * Gets all ontologies' metadata from the cache and returns them.
- *
- * @returns {Array}
- */
- private getAllOntologiesMetadataFromCache(): Array {
-
- return this.cacheOntology.ontologies;
-
- }
-
- /**
- * Gets resource class definitions from the ontology response.
- * `knora-api:Resource` will be excluded.
- *
- * @param {Object} classDefinitions the `hasClasses` section of an ontology response.
- * @returns {string[]}
- */
- private getResourceClassIrisFromOntologyResponse(classDefinitions: Array): string[] {
- const resourceClassIris: string[] = [];
-
- for (const classDef of classDefinitions) {
- const classIri = classDef['@id'];
-
- // check that class name is not listed as a non resource class and that the isResourceClass flag is present and set to true
- if (classIri !== AppConfig.Resource && this.nonResourceClasses.indexOf(classIri) === -1 && (classDef[AppConfig.IsResourceClass] !== undefined && classDef[AppConfig.IsResourceClass] === true)) {
- // it is not a value class, but a resource class definition
- resourceClassIris.push(classIri)
- }
- }
-
- return resourceClassIris;
- }
-
- /**
- * Converts a Knora response for all entity definitions for the requested ontology
- * into an internal representation and caches it.
- *
- * Knora automatically includes the resource class definitions for the given ontology and the property definitions
- * which are referred to in the cardinalities of the resource classes that have been returned.
- *
- * @param {Object} ontology the ontology to be cached.
- */
- private convertAndWriteAllEntityDefinitionsForOntologyToCache(ontology: Object): void {
-
- const graph = ontology['@graph'];
-
- const classDefs = graph.filter(
- (entity: Object) => {
- const entityType = entity['@type'];
- return entityType === AppConfig.OwlClass;
- });
-
- const propertyDefs = graph.filter(
- (entity: Object) => {
- const entityType = entity['@type'];
- return entityType === AppConfig.OwlObjectProperty ||
- entityType === AppConfig.OwlDatatypeProperty ||
- entityType === AppConfig.OwlAnnotationProperty ||
- entityType === AppConfig.RdfProperty
- });
-
- this.cacheOntology.resourceClassIrisForOntology[ontology['@id']] = this.getResourceClassIrisFromOntologyResponse(classDefs);
-
- this.convertAndWriteEntityDefinitionsToCache(classDefs, propertyDefs);
-
- }
-
- /**
- * Gets resource class definitions for the requested ontologies from the cache.
- *
- * @param {string[]} ontologyIris the ontologies for which resource classes should be returned.
- * @returns {OntologyInformation} an [[OntologyInformation]] representing the requested information.
- */
- private getOntologyInformationFromCache(ontologyIris: string[]): Observable {
-
- const resourceClassesForOntology = new ResourceClassIrisForOntology();
-
- // collect resource class Iris for all requested named graphs
- let allResourceClassIris = [];
-
- for (const ontologyIri of ontologyIris) {
-
- if (this.cacheOntology.resourceClassIrisForOntology[ontologyIri] === undefined) {
- throw new OntologyCacheError(`getResourceClassesForOntologiesFromCache: ontology not found in cache: ${ontologyIri}`);
- }
-
- // add information for the given named graph
- resourceClassesForOntology[ontologyIri] = this.cacheOntology.resourceClassIrisForOntology[ontologyIri];
-
- // add all resource class Iris of this named graph
- allResourceClassIris = allResourceClassIris.concat(this.cacheOntology.resourceClassIrisForOntology[ontologyIri]);
- }
-
- // get resource class definitions for all named graphs
- return this.getResourceClassDefinitions(allResourceClassIris).map(
- resClassDefs => {
- return new OntologyInformation(resourceClassesForOntology, resClassDefs.getResourceClasses(), resClassDefs.getProperties())
- }
- );
-
- }
-
- /**
- * Converts a Knora ontology response into an internal representation and caches it.
- *
- * @param {Object} resourceClassDefinitions the resource class definitions returned by Knora.
- * @param {Object} propertyClassDefinitions the property definitions returned by Knora.
- */
- private convertAndWriteEntityDefinitionsToCache(resourceClassDefinitions: Array, propertyClassDefinitions: Array): void {
-
- // convert and cache each given resource class definition
- for (const resClass of resourceClassDefinitions) {
-
- const resClassIri = resClass['@id'];
-
- // represents all cardinalities of this resource class
- const cardinalities: Cardinality[] = [];
-
- if (resClass[AppConfig.RdfsSubclassOf] !== undefined) {
- // get cardinalities for the properties of a resource class
- for (const curCard of resClass[AppConfig.RdfsSubclassOf]) {
-
- // make sure it is a cardinality (it could also be an Iri of a superclass)
- if (curCard instanceof Object && curCard['@type'] !== undefined && curCard['@type'] === AppConfig.OwlRestriction) {
-
- let newCard;
-
- // get occurrence
- if (curCard[AppConfig.OwlMinCardinality] !== undefined) {
- newCard = new Cardinality(CardinalityOccurrence.minCard, curCard[AppConfig.OwlMinCardinality], curCard[AppConfig.OwlOnProperty]['@id']);
- } else if (curCard[AppConfig.OwlCardinality] !== undefined) {
- newCard = new Cardinality(CardinalityOccurrence.card, curCard[AppConfig.OwlCardinality], curCard[AppConfig.OwlOnProperty]['@id']);
- } else if (curCard[AppConfig.OwlMaxCardinality] !== undefined) {
- newCard = new Cardinality(CardinalityOccurrence.maxCard, curCard[AppConfig.OwlMaxCardinality], curCard[AppConfig.OwlOnProperty]['@id']);
- } else {
- // no known occurrence found
- throw new TypeError(`cardinality type invalid for ${resClass['@id']} ${curCard[AppConfig.OwlOnProperty]}`);
- }
-
- // add cardinality
- cardinalities.push(newCard);
-
- }
-
- }
- }
-
- const resClassObj = new ResourceClass(
- resClassIri,
- resClass[AppConfig.ResourceIcon],
- resClass[AppConfig.RdfsComment],
- resClass[AppConfig.RdfsLabel],
- cardinalities
- );
-
- // write this resource class definition to the cache object
- this.cacheOntology.resourceClasses[resClassIri] = resClassObj;
- }
-
- // cache the property definitions referred to by the cardinalities of the given resource classes
- this.convertAndWriteKnoraPropertyDefinitionsToOntologyCache(propertyClassDefinitions);
- }
-
- /**
- * Gets information about resource classes from the cache.
- * The answer includes the property definitions referred to by the cardinalities og the given resource classes.
- *
- * @param resClassIris the given resource class Iris
- * @returns {ResourceClasses} an [[OntologyCache]] representing the requested resource classes.
- */
- private getResourceClassDefinitionsFromCache(resClassIris: string[]): Observable {
- // collect the definitions for each resource class from the cache
- const resClassDefs = new ResourceClasses();
-
- // collect the properties from the cardinalities of the given resource classes
- const propertyIris = [];
-
- resClassIris.forEach(
- resClassIri => {
-
- if (this.cacheOntology.resourceClasses[resClassIri] === undefined) {
- throw new OntologyCacheError(`getResourceClassDefinitionsFromCache: resource class not found in cache: ${resClassIri}`);
- }
-
- // add resource class definition to answer
- resClassDefs[resClassIri] = this.cacheOntology.resourceClasses[resClassIri];
-
- // get properties for the current resource class
- this.cacheOntology.resourceClasses[resClassIri].cardinalities.forEach(
- card => {
- propertyIris.push(card.property)
- }
- )
- }
- );
-
- // get the property definitions for which cardinalities exist
- return this.getPropertyDefinitions(propertyIris).map(
- propDefs => {
- return new OntologyInformation(new ResourceClassIrisForOntology(), resClassDefs, propDefs.getProperties());
- }
- );
-
- }
-
- /**
- * Convert a Knora response for ontology information about properties
- * into an internal representation and cache it.
- *
- * @param {Object} propertyDefinitionsFromKnora the property definitions returned by Knora
- */
- private convertAndWriteKnoraPropertyDefinitionsToOntologyCache(propertyDefinitionsFromKnora: Array): void {
-
- // convert and cache each given property definition
- for (const propDef of propertyDefinitionsFromKnora) {
-
- const propIri = propDef['@id'];
-
- let isEditable = false;
- if (propDef[AppConfig.isEditable] !== undefined && propDef[AppConfig.isEditable] === true) {
- isEditable = true;
- }
-
- let isLinkProperty = false;
- if (propDef[AppConfig.isLinkProperty] !== undefined && propDef[AppConfig.isLinkProperty] === true) {
- isLinkProperty = true;
- }
-
- let isLinkValueProperty = false;
- if (propDef[AppConfig.isLinkValueProperty] !== undefined && propDef[AppConfig.isLinkValueProperty] === true) {
- isLinkValueProperty = true;
- }
-
- let subPropertyOf = [];
- if (propDef[AppConfig.subPropertyOf] !== undefined && Array.isArray(propDef[AppConfig.subPropertyOf])) {
- subPropertyOf = propDef[AppConfig.subPropertyOf].map((superProp: Object) => superProp['@id']);
- } else if (propDef[AppConfig.subPropertyOf] !== undefined) {
- subPropertyOf.push(propDef[AppConfig.subPropertyOf]['@id']);
- }
-
- let objectType;
- if (propDef[AppConfig.ObjectType] !== undefined) {
- objectType = propDef[AppConfig.ObjectType]['@id'];
- }
-
- // cache property definition
- this.cacheOntology.properties[propIri] = new Property(
- propIri,
- objectType,
- propDef[AppConfig.RdfsComment],
- propDef[AppConfig.RdfsLabel],
- subPropertyOf,
- isEditable,
- isLinkProperty,
- isLinkValueProperty
- );
-
- }
-
- }
-
- /**
- * Gets property definitions from the cache.
- *
- * @param {string[]} propertyIris the property definitions to be returned.
- * @returns {OntologyCache}
- */
- private getPropertyDefinitionsFromCache(propertyIris: string[]): OntologyInformation {
-
- const propertyDefs = new Properties();
-
- propertyIris.forEach(
- propIri => {
- // ignore non Knora props: if propIri is contained in excludedProperties, skip this propIri
- if (this.excludedProperties.indexOf(propIri) > -1) {
- return;
- }
-
- if (this.cacheOntology.properties[propIri] === undefined) {
- throw new OntologyCacheError(`getPropertyDefinitionsFromCache: property not found in cache: ${propIri}`);
- }
-
- propertyDefs[propIri] = this.cacheOntology.properties[propIri];
- }
- );
-
- return new OntologyInformation(new ResourceClassIrisForOntology(), new ResourceClasses(), propertyDefs);
-
- }
-
- /**
- * Gets all named graphs.
- *
- * @returns {Observable>}
- */
- public getOntologiesMetadata(): Observable> {
-
- if (this.cacheOntology.ontologies.length === 0) {
- return this.getOntologiesMetadataFromKnora().map(
- metadata => {
- this.convertAndWriteOntologiesMetadataToCache(metadata['@graph'].filter((onto) => {
- // ignore excluded ontologies
- return this.excludedOntologies.indexOf(onto['@id']) == -1
- }));
-
- return this.getAllOntologiesMetadataFromCache();
-
- }
- )
- } else {
- return Observable.of(this.getAllOntologiesMetadataFromCache());
- }
-
- }
-
-
- /**
- * Gets the requested ontologies from Knora if necessary, adding them to the cache.
- *
- * @param {string[]} ontologyIris Iris of the ontologies to be queried.
- */
- public getAndCacheOntologies(ontologyIris: string[]): Observable {
-
- const observables = [];
-
- ontologyIris.forEach(ontologyIri => {
- observables.push(this.getAllEntityDefinitionsForOntologyFromKnora(ontologyIri).map(
- (ontology: Object) => {
-
- // write to cache
- this.convertAndWriteAllEntityDefinitionsForOntologyToCache(ontology);
- }
- ));
- });
-
- return forkJoin(observables);
-
- }
-
-
- /**
- * Get the entity definitions for the given ontologies.
- *
- * @param {string[]} ontologyIris Iris of the ontologies to be queried.
- */
- public getEntityDefinitionsForOntologies(ontologyIris: string[]): Observable {
-
- const ontologyIrisToQuery = ontologyIris.filter(
- ontologyIri => {
- // return the ontology Iris that are not cached yet
- return this.cacheOntology.resourceClassIrisForOntology[ontologyIri] === undefined;
- });
-
- if (ontologyIrisToQuery.length > 0) {
-
- return this.getAndCacheOntologies(ontologyIrisToQuery).flatMap(
- results => {
-
- return this.getOntologyInformationFromCache(ontologyIris);
- }
- )
-
- } else {
-
- return this.getOntologyInformationFromCache(ontologyIris)
- }
-
- }
-
- /**
- * Get definitions for the given resource class Iris.
- * If the definitions are not already in the cache, the will be retrieved from Knora and cached.
- *
- * @param resourceClassIris the given resource class Iris
- * @returns {Observable} an OntologyCache instance representing the requested resource classes (including properties).
- */
- public getResourceClassDefinitions(resourceClassIris: string[]): Observable {
-
- const resClassIrisToQueryFor: string[] = resourceClassIris.filter(
- resClassIri => {
-
- // return the resource class Iris that are not cached yet
- return this.cacheOntology.resourceClasses[resClassIri] === undefined;
-
- });
-
- if (resClassIrisToQueryFor.length > 0) {
-
- // get a set of ontology Iris that have to be queried to obtain the missing resource classes
- const ontologyIris: string[] = resClassIrisToQueryFor.map(
- resClassIri => {
- return Utils.getOntologyIriFromEntityIri(resClassIri)
- }
- ).filter(Utils.filterOutDuplicates);
-
- // obtain missing resource class information
- return this.getAndCacheOntologies(ontologyIris).flatMap(
- results => {
-
- return this.getResourceClassDefinitionsFromCache(resourceClassIris);
- }
- )
-
- } else {
-
- // console.log("from cache");
-
- return this.getResourceClassDefinitionsFromCache(resourceClassIris);
- }
- }
-
- /**
- * Get definitions for the given property Iris.
- * If the definitions are not already in the cache, the will be retrieved from Knora and cached.
- *
- * @param {string[]} propertyIris the Iris of the properties to be returned .
- * @returns {Observable} an OntologyCache instance containing the requested properties.
- */
- public getPropertyDefinitions(propertyIris: string[]): Observable {
-
- const propertiesToQuery: string[] = propertyIris.filter(
- propIri => {
-
- // ignore non Knora props: if propIri is contained in excludedProperties, skip this propIri
- if (this.excludedProperties.indexOf(propIri) > -1) {
- return false;
- }
-
- // return the property Iris that are not cached yet
- return this.cacheOntology.properties[propIri] === undefined;
- }
- );
-
- if (propertiesToQuery.length > 0) {
-
- // get a set of ontology Iris that have to be queried to obtain the missing properties
- const ontologyIris: string[] = propertiesToQuery.map(
- propIri => {
- return Utils.getOntologyIriFromEntityIri(propIri);
- }
- ).filter(Utils.filterOutDuplicates);
-
- // obtain missing resource class information
- return this.getAndCacheOntologies(ontologyIris).map(
- results => {
-
- return this.getPropertyDefinitionsFromCache(propertyIris);
- }
- );
- } else {
- return Observable.of(this.getPropertyDefinitionsFromCache(propertyIris));
- }
- }
-}
diff --git a/src/app/model/services/projects.service.spec.ts b/src/app/model/services/projects.service.spec.ts
deleted file mode 100644
index aac92884..00000000
--- a/src/app/model/services/projects.service.spec.ts
+++ /dev/null
@@ -1,215 +0,0 @@
-import {async, inject, TestBed} from '@angular/core/testing';
-import {HttpModule} from '@angular/http';
-import {ApiService} from './api.service';
-import {ProjectsService} from './projects.service';
-import {environment} from '../../../environments/environment';
-import {StoreService} from './store.service';
-import {HttpClientModule} from '@angular/common/http';
-import {ApiServiceError} from './api-service-error';
-import {Project, ProjectResponse} from '../webapi/knora';
-import {
- anythingProject,
- anythingProjectResponseJson,
- imagesProject,
- imagesProjectResponseJson, incunabulaProject,
- incunabulaProjectResponseJson,
- projectsResponseJson,
- projectsTestData
-} from '../test-data/shared-test-data';
-import {JsonConvert, OperationMode, ValueCheckingMode} from 'json2typescript';
-import {ProjectsResponse} from '../webapi/knora/admin';
-
-describe('ProjectsService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpModule,
- HttpClientModule
- ],
- providers: [
- ApiService,
- ProjectsService,
- StoreService
- ]
- });
- });
-
- it('should be created', async(inject(
- [ProjectsService], (service) => {
- expect(service).toBeDefined();
- }))
- );
-
-
- it('should parse projects-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: ProjectsResponse = jsonConvert.deserializeObject(projectsResponseJson, ProjectsResponse);
-
- expect(result).toBeTruthy();
- });
-
- it('should parse project-response (images)', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: ProjectResponse = jsonConvert.deserializeObject(imagesProjectResponseJson, ProjectResponse);
-
- expect(result).toBeTruthy();
- });
-
- it('should parse project-response (incunabula)', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: ProjectResponse = jsonConvert.deserializeObject(incunabulaProjectResponseJson, ProjectResponse);
-
- expect(result).toBeTruthy();
- });
-
- it('should parse project-response (anything)', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: ProjectResponse = jsonConvert.deserializeObject(anythingProjectResponseJson, ProjectResponse);
-
- expect(result).toBeTruthy();
- });
-
-
- if (environment.type === 'integration') {
-
- it('should load test data [it]', async(inject(
- [StoreService], (service) => {
-
- expect(service).toBeDefined();
-
- service.resetTriplestoreContent([])
- .subscribe(
- (result: string) => {
- expect(result).toBe('success');
- });
-
- })), 300000);
-
-
- it('#getAllProjects should return all projects [it]', async(inject(
- [ProjectsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getAllProjects()
- .subscribe(
- (projects: Project[]) => {
- // console.log('projects: ' + JSON.stringify(projects));
- expect(projects.length).toBe(8);
- expect(projects).toEqual(projectsTestData);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
-
- it('#getProjectByIri should return project (images) [it]', async(inject(
- [ProjectsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getProjectByIri('http://rdfh.ch/projects/00FF')
- .subscribe(
- (project: Project) => {
- // console.log('project: ' + JSON.stringify(project));
- expect(project).toEqual(imagesProject);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getProjectByIri should return project (incunabula) [it]', async(inject(
- [ProjectsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getProjectByIri('http://rdfh.ch/projects/77275339')
- .subscribe(
- (project: Project) => {
- // console.log('project: ' + JSON.stringify(project));
- expect(project).toEqual(incunabulaProject);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getProjectByIri should return project (anything) [it]', async(inject(
- [ProjectsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getProjectByIri('http://rdfh.ch/projects/anything')
- .subscribe(
- (project: Project) => {
- // console.log('project: ' + JSON.stringify(project));
- expect(project).toEqual(anythingProject);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getProjectByShortname should return project (images) [it]', async(inject(
- [ProjectsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getProjectByShortname('images')
- .subscribe(
- (project: Project) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(project).toEqual(imagesProject);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
-
- it('#getProjectByShortcode should return project (images) [it]', async(inject(
- [ProjectsService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getProjectByShortcode('00FF')
- .subscribe(
- (project: Project) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(project).toEqual(imagesProject);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
-
-
- } else {
- xit('integration tests skipped. run "ng test --env=it".');
- }
-
-
-});
diff --git a/src/app/model/services/projects.service.ts b/src/app/model/services/projects.service.ts
deleted file mode 100644
index 096c5a8f..00000000
--- a/src/app/model/services/projects.service.ts
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {Project, ProjectMembersResponse, ProjectResponse, ProjectsResponse, UserResponse} from '../webapi/knora';
-import {ApiServiceError} from './api-service-error';
-import {ApiServiceResult} from './api-service-result';
-
-import {ApiService} from './api.service';
-import {User} from '../webapi/knora/admin';
-
-@Injectable()
-export class ProjectsService extends ApiService {
-
- /**
- * returns a list of all projects
- *
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getAllProjects(): Observable {
-
- return this.httpGet('/admin/projects').map(
- (result: ApiServiceResult) => {
- // console.log('ProjectsService - getAllProjects - result: ', JSON.stringify(result));
- const projects: Project[] = result.getBody(ProjectsResponse).projects;
-
- // console.log('ProjectsService - getAllProjects - projects: ', JSON.stringify(projects));
- return projects;
- },
- (error: ApiServiceError) => {
- console.error('ProjectsService - getAllProjects - error: ', JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * returns a project object
- *
- * @param iri (= project iri)
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProjectByIri(iri: string): Observable {
-
- const url = '/admin/projects/' + encodeURIComponent(iri);
- return this.getProject(url);
- }
-
- /**
- * returns a project object
- *
- * @param shortname
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProjectByShortname(shortname: string): Observable {
- const url = '/admin/projects/' + shortname + '?identifier=shortname';
- return this.getProject(url);
- }
-
- /**
- * returns a project object
- *
- * @param shortname
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProjectByShortcode(shortcode: string): Observable {
- const url = '/admin/projects/' + shortcode + '?identifier=shortcode';
- return this.getProject(url);
- }
-
- /**
- * Helper method combining project retrieval
- *
- * @param url
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProject(url: string): Observable {
- return this.httpGet(url).map(
- (result: ApiServiceResult) => {
- // console.log('ProjectsService - getProject - result: ', JSON.stringify(result));
- // console.log('ProjectsService - getProject: ' + url + ' , project: ', JSON.stringify(project));
- return result.getBody(ProjectResponse).project;
- },
- (error: ApiServiceError) => {
- console.error(error);
- throw error;
- }
- );
- }
-
- /**
- * returns all project members
- *
- * @param iri (= project iri)
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProjectMembersByIri(iri: string): Observable {
-
- // console.log('ProjectsService - getProjectMembersByIri - iri: ' + iri);
-
- const url = '/admin/projects/members/' + encodeURIComponent(iri);
- return this.getProjectMembers(url);
- }
-
- /**
- * returns all project members
- *
- * @param shortname (= project shortname)
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProjectMembersByShortname(shortname: string): Observable {
- const url = '/admin/projects/members/' + shortname + '?identifier=shortname';
- return this.getProjectMembers(url);
- }
-
- /**
- * Helper method combining project member retrieval
- *
- * @param url
- * @returns {Observable}
- * @throws {ApiServiceError}
- */
- getProjectMembers(url: string): Observable {
- return this.httpGet(url).map(
- (result: ApiServiceResult) => {
- const members: User[] = result.getBody(ProjectMembersResponse).members;
-
- // console.log('ProjectsService - getProjectMembers - url: ' + JSON.stringify(url) + ' , members: ' + JSON.stringify(members));
- return members;
- },
- (error: ApiServiceError) => {
- console.error(error);
- throw error;
- }
- )
- }
-
- createProject(data: any): Observable {
- return this.httpPost('/admin/projects', data).map(
- (result: ApiServiceResult) => {
- const received: Project = result.getBody(ProjectResponse).project;
- return received;
- },
- (error: ApiServiceError) => {
- console.error('ProjectsService - createProject - error: ' + JSON.stringify(error));
- throw error;
- }
- )
- }
-
- updateProject(iri: string, data: any): Observable {
-
- return this.httpPut('/admin/projects/' + encodeURIComponent(iri), data, {}).map(
- (result: ApiServiceResult) => {
- const received: Project = result.getBody(ProjectResponse).project;
- return received;
- },
- (error: ApiServiceError) => {
- console.error('ProjectsService - updateProject - error: ' + JSON.stringify(error));
- throw error;
- }
- )
- }
-
- /**
- * Deletes (deactivates) a project by setting it's status to false.
- *
- * @param {string} iri
- * @returns {Observable}
- */
- deleteProject(iri: string): Observable {
- return this.httpDelete('/admin/projects/' + encodeURIComponent(iri)).map(
- (result: ApiServiceResult) => {
- const project: Project = result.getBody(ProjectResponse).project;
-
- // console.log('ProjectsService - deleteProject - iri: ' + JSON.stringify(iri) + ' , project: ' + JSON.stringify(project));
- return project;
- },
- (error: ApiServiceError) => {
- console.error(error);
- throw error;
- }
- )
- }
-
- /**
- * Activates (un-deletes) a project.
- *
- * @param {string} iri
- * @returns {Observable}
- */
- activateProject(iri: string): Observable {
- const data: any = {
- status: true
- };
-
- return this.httpPut('/admin/projects/' + encodeURIComponent(iri), data).map(
- (result: ApiServiceResult) => {
- const project: Project = result.getBody(ProjectResponse).project;
-
- // console.log('ProjectsService - activateProject - iri: ' + JSON.stringify(iri) + ' , project: ' + JSON.stringify(project));
- return project;
- },
- (error: ApiServiceError) => {
- console.error(error);
- throw error;
- }
- )
- }
-
-
-}
diff --git a/src/app/model/services/properties.service.spec.ts b/src/app/model/services/properties.service.spec.ts
index f6c46395..dc9c8b0c 100644
--- a/src/app/model/services/properties.service.spec.ts
+++ b/src/app/model/services/properties.service.spec.ts
@@ -1,8 +1,9 @@
-import {async, inject, TestBed} from '@angular/core/testing';
-import {ApiService} from './api.service';
-import {PropertiesService} from './properties.service';
-import {HttpClientModule} from '@angular/common/http';
-import {HttpModule} from '@angular/http';
+import { async, inject, TestBed } from '@angular/core/testing';
+
+import { PropertiesService } from './properties.service';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpModule } from '@angular/http';
+import { ApiService, KuiCoreConfig } from '@knora/core';
describe('PropertiesService', () => {
beforeEach(() => {
@@ -13,13 +14,14 @@ describe('PropertiesService', () => {
],
providers: [
ApiService,
- PropertiesService
+ PropertiesService,
+ { provide: 'config', useValue: KuiCoreConfig },
]
});
});
- xit('should be created', async(inject(
+ it('should be created', async(inject(
[PropertiesService], (service) => {
expect(service).toBeDefined();
}))
diff --git a/src/app/model/services/properties.service.ts b/src/app/model/services/properties.service.ts
index 6e9c402d..f8bccdd1 100644
--- a/src/app/model/services/properties.service.ts
+++ b/src/app/model/services/properties.service.ts
@@ -12,11 +12,13 @@
* License along with SALSAH. If not, see .
* */
-import {Injectable} from '@angular/core';
-import {ApiService} from './api.service';
-import {Observable} from 'rxjs/Observable';
+import { Injectable } from '@angular/core';
+import { ApiService } from '@knora/core';
+import { Observable } from 'rxjs';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class PropertiesService extends ApiService {
getPropertiesByResType(rid: string): Observable {
diff --git a/src/app/model/services/resource-types.service.spec.ts b/src/app/model/services/resource-types.service.spec.ts
index f13731f8..4a4eaa11 100644
--- a/src/app/model/services/resource-types.service.spec.ts
+++ b/src/app/model/services/resource-types.service.spec.ts
@@ -1,8 +1,9 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {ApiService} from './api.service';
-import {ResourceTypesService} from './resource-types.service';
+import { TestBed, inject } from '@angular/core/testing';
+import { AppModule } from '../../app.module';
+import { AppRoutingModule } from '../../app-routing.module';
+
+import { ResourceTypesService } from './resource-types.service';
+import { ApiService } from '@knora/core';
describe('ResourceTypesService', () => {
beforeEach(() => {
@@ -18,7 +19,7 @@ describe('ResourceTypesService', () => {
});
});
- xit('should ...', inject([ResourceTypesService], (service: ResourceTypesService) => {
+ it('should be created', inject([ResourceTypesService], (service: ResourceTypesService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/src/app/model/services/resource-types.service.ts b/src/app/model/services/resource-types.service.ts
index fc6eba19..8f864a07 100644
--- a/src/app/model/services/resource-types.service.ts
+++ b/src/app/model/services/resource-types.service.ts
@@ -12,11 +12,13 @@
* License along with SALSAH. If not, see .
* */
-import {Injectable} from '@angular/core';
-import {ApiService} from './api.service';
-import {Observable} from 'rxjs/Observable';
+import { Injectable } from '@angular/core';
+import { ApiService } from '@knora/core';
+import { Observable } from 'rxjs';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class ResourceTypesService extends ApiService {
/**
diff --git a/src/app/model/services/resource.service.spec.ts b/src/app/model/services/resource.service.spec.ts
deleted file mode 100644
index c222c8f6..00000000
--- a/src/app/model/services/resource.service.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {ApiService} from './api.service';
-import {ResourceService} from './resource.service';
-
-
-describe('ResourceService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule,
- AppRoutingModule
- ],
- providers: [
- ApiService,
- ResourceService
- ]
- });
- });
-
- xit('should ...', inject([ResourceService], (service: ResourceService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/resource.service.ts b/src/app/model/services/resource.service.ts
deleted file mode 100644
index c599f2c2..00000000
--- a/src/app/model/services/resource.service.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {Injectable} from '@angular/core';
-import {ApiService} from './api.service';
-import {Observable} from 'rxjs/Observable';
-import {Project, ProjectResponse} from '../webapi/knora';
-import {ApiServiceResult} from './api-service-result';
-import {ApiServiceError} from './api-service-error';
-
-@Injectable()
-export class ResourceService extends ApiService {
-
- /**
- * Given the Iri, requests the representation of a resource.
- *
- * @param iri Iri of the resource (already URL encoded).
- * @returns {Observable}
- */
- getResource(iri): Observable {
- return this.httpGetV2('/resources/' + encodeURIComponent(iri));
- }
-
-}
diff --git a/src/app/model/services/search-params.service.spec.ts b/src/app/model/services/search-params.service.spec.ts
deleted file mode 100644
index 5d18eed4..00000000
--- a/src/app/model/services/search-params.service.spec.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { TestBed, inject } from '@angular/core/testing';
-
-import { SearchParamsService } from './search-params.service';
-
-describe('SearchParamsService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [SearchParamsService]
- });
- });
-
- xit('should be created', inject([SearchParamsService], (service: SearchParamsService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/search-params.service.ts b/src/app/model/services/search-params.service.ts
deleted file mode 100644
index 5d6cec25..00000000
--- a/src/app/model/services/search-params.service.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import {Injectable} from '@angular/core';
-import {BehaviorSubject} from "rxjs/BehaviorSubject";
-
-
-/**
- * Represents the parameters of an extended search.
- */
-export class ExtendedSearchParams {
-
- /**
- *
- * @param generateGravsearch a function the generates Gravsearch.
- * @param generateGravsearch a function the generates Gravsearch.
- * The function is expected to take the offset
- * as a parameter and return a Gravsearch query string.
- */
- constructor(public generateGravsearch: (offset: number) => string) {
-
- }
-
-}
-
-
-
-@Injectable()
-/**
- * Temporarily stores the parameters of an extended search.
- */
-export class SearchParamsService {
-
- // init with a dummy function
- private searchParamsMessage = new BehaviorSubject(new ExtendedSearchParams((offset: number) => ''));
- currentSearchParams = this.searchParamsMessage.asObservable();
-
- constructor() {
- }
-
- /**
- * Update the parameters of an extended seacrh.
- *
- * @param {ExtendedSearchParams} searchParams
- */
- changeSearchParamsMsg(searchParams: ExtendedSearchParams) {
- this.searchParamsMessage.next(searchParams);
- }
-
-
-}
diff --git a/src/app/model/services/search.service.spec.ts b/src/app/model/services/search.service.spec.ts
deleted file mode 100644
index c492e6bb..00000000
--- a/src/app/model/services/search.service.spec.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {ApiService} from './api.service';
-import {SearchService} from './search.service';
-
-describe('SearchService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule,
- AppRoutingModule
- ],
- providers: [
- ApiService,
- SearchService
- ]
- });
- });
-
- xit('should ...', inject([SearchService], (service: SearchService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/search.service.ts b/src/app/model/services/search.service.ts
deleted file mode 100644
index 6fca68de..00000000
--- a/src/app/model/services/search.service.ts
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-
-import {ApiService} from './api.service';
-import {ApiServiceResult} from "./api-service-result";
-
-@Injectable()
-export class SearchService extends ApiService {
-
- /**
- * Perform a fulltext search.
- *
- * @param searchTerm the term to search for.
- * @param offset the offset to be used (for paging, first offset is 0).
- * @returns {Observable}
- */
- doFulltextSearch(searchTerm: string, offset: number = 0): Observable {
-
- if (searchTerm === undefined || searchTerm.length == 0) {
- return Observable.create(observer => observer.error('No search term given for call of SearchService.doFulltextSearch'));
- }
-
- return this.httpGetV2("/search/" + searchTerm + '?offset='+ offset);
- }
-
- /**
- * Perform a fulltext search count query.
- *
- * @param searchTerm the term to search for.
- * @returns {Observable}
- */
- doFulltextSearchCountQuery(searchTerm: string): Observable {
-
- if (searchTerm === undefined || searchTerm.length == 0) {
- return Observable.create(observer => observer.error('No search term given for call of SearchService.doFulltextSearchCountQuery'));
- }
-
- return this.httpGetV2("/search/count/" + searchTerm);
- }
-
- /**
- * Perform an extended search.
- *
- * @param sparqlString the Sparql query string to be sent to Knora.
- * @returns {Observable}
- */
- doExtendedSearch(sparqlString: string): Observable {
-
- if (sparqlString === undefined || sparqlString.length == 0) {
- return Observable.create(observer => observer.error('No Sparql string given for call of SearchService.doExtendedSearch'));
- }
-
- return this.httpPost("/v2/searchextended", sparqlString);
-
- }
-
- /**
- * Perform an extended search count query.
- *
- * @param sparqlString the Sparql query string to be sent to Knora.
- * @returns {Observable}
- */
- doExtendedSearchCountQuery(sparqlString: string): Observable {
-
- if (sparqlString === undefined || sparqlString.length == 0) {
- return Observable.create(observer => observer.error('No Sparql string given for call of SearchService.doExtendedSearchCountQuery'));
- }
-
- return this.httpPost("/v2/searchextended/count", sparqlString);
-
- }
-
- /**
- * Perform a search by a resource's rdfs:label.
- *
- * @param {string} searchTerm the term to search for.
- * @param resourceClassIRI restrict search to given resource class.
- * @param projectIri restrict search to given project.
- * @returns {Observable}
- */
- searchByLabel(searchTerm: string, resourceClassIRI?: string, projectIri?: string): Observable {
-
- if (searchTerm === undefined || searchTerm.length == 0) {
- return Observable.create(observer => observer.error("No search term given for call of SearchService.doFulltextSearch"));
- }
-
- let params = {};
-
- if (resourceClassIRI !== undefined) {
- params['limitToResourceClass'] = resourceClassIRI;
- }
-
- if (projectIri !== undefined) {
- params['limitToProject'] = projectIri;
- }
-
- return this.httpGetV2("/searchbylabel/" + encodeURIComponent(searchTerm), {params: params});
-
- }
-
-}
diff --git a/src/app/model/services/status-msg-service.service.spec.ts b/src/app/model/services/status-msg-service.service.spec.ts
deleted file mode 100644
index f19afcda..00000000
--- a/src/app/model/services/status-msg-service.service.spec.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import {TestBed, inject} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {ApiService} from './api.service';
-import {StatusMsgServiceService} from './status-msg-service.service';
-
-describe('SessionService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- AppModule,
- AppRoutingModule
- ],
- providers: [
- ApiService,
- StatusMsgServiceService
- ]
- });
- });
-
- xit('should ...', inject([StatusMsgServiceService], (service: StatusMsgServiceService) => {
- expect(service).toBeTruthy();
- }));
-});
diff --git a/src/app/model/services/status-msg-service.service.ts b/src/app/model/services/status-msg-service.service.ts
deleted file mode 100644
index 6fb50bec..00000000
--- a/src/app/model/services/status-msg-service.service.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Injectable } from '@angular/core';
-import {ApiService} from './api.service';
-import {Observable} from 'rxjs/Observable';
-
-import {environment} from '../../../environments/environment';
-
-@Injectable()
-export class StatusMsgServiceService extends ApiService {
-
- getStatusMsg(): Observable {
- const url = environment.url;
- return this.httpGet(url + '/assets/i18n/statusMsg.json', {withCredentials: false});
- };
-
-}
diff --git a/src/app/model/services/status-msg.service.spec.ts b/src/app/model/services/status-msg.service.spec.ts
new file mode 100644
index 00000000..9f3f9498
--- /dev/null
+++ b/src/app/model/services/status-msg.service.spec.ts
@@ -0,0 +1,22 @@
+import { TestBed, inject } from '@angular/core/testing';
+import { AppModule } from '../../app.module';
+import { AppRoutingModule } from '../../app-routing.module';
+import { StatusMsgService } from './status-msg.service';
+
+describe('SessionService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ AppModule,
+ AppRoutingModule
+ ],
+ providers: [
+ StatusMsgService
+ ]
+ });
+ });
+
+ it('should be created', inject([StatusMsgService], (service: StatusMsgService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/src/app/model/services/status-msg.service.ts b/src/app/model/services/status-msg.service.ts
new file mode 100644
index 00000000..a69fc392
--- /dev/null
+++ b/src/app/model/services/status-msg.service.ts
@@ -0,0 +1,38 @@
+import { Inject, Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+
+import { HttpClient } from '@angular/common/http';
+import { KuiCoreConfig } from '@knora/core';
+import { map } from 'rxjs/operators';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class StatusMsgService {
+
+ constructor(private _http: HttpClient,
+ @Inject('config') public config: KuiCoreConfig) {
+ }
+
+ /**
+ * this method get the status messages from the statusMsg.json file
+ * which are defined here: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
+ * and here: http://www.w3schools.com/tags/ref_httpmessages.asp
+ *
+ */
+ getStatusMsg(): Observable {
+
+ return this._http.get(this.config.app + '/assets/i18n/statusMsg.json')
+ .pipe(map(
+ (res: any) => {
+ return res;
+ },
+ err => {
+ console.error(err);
+ }
+ )
+ );
+
+ };
+
+}
diff --git a/src/app/model/services/store.service.spec.ts b/src/app/model/services/store.service.spec.ts
index 5090eae3..2f710533 100644
--- a/src/app/model/services/store.service.spec.ts
+++ b/src/app/model/services/store.service.spec.ts
@@ -1,7 +1,7 @@
-import {environment} from '../../../environments/environment';
-import {async, inject, TestBed} from '@angular/core/testing';
-import {StoreService} from './store.service';
-import {HttpClientModule} from '@angular/common/http';
+import { environment } from '../../../environments/environment';
+import { async, inject, TestBed } from '@angular/core/testing';
+import { StoreService } from './store.service';
+import { HttpClientModule } from '@angular/common/http';
describe('StoreService', () => {
@@ -34,12 +34,12 @@ describe('StoreService', () => {
.subscribe(
(result: string) => {
expect(result).toBe('success');
- });
+ });
})), 300000);
} else {
- xit('integration tests skipped. run "ng test --env=it".');
+ it('integration tests skipped. run "ng test --env=it".');
}
});
diff --git a/src/app/model/services/store.service.ts b/src/app/model/services/store.service.ts
index 5cf174ef..c02bb3ae 100644
--- a/src/app/model/services/store.service.ts
+++ b/src/app/model/services/store.service.ts
@@ -12,17 +12,20 @@
* License along with SALSAH. If not, see .
* */
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {HttpClient, HttpErrorResponse} from '@angular/common/http';
-import {RdfDataObject, ResetTriplestoreContentResponse} from '../webapi/knora/admin';
-import {environment} from '../../../environments/environment';
+import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+import { catchError, map } from 'rxjs/operators';
+import { HttpClient, HttpErrorResponse } from '@angular/common/http';
+import { RdfDataObject, ResetTriplestoreContentResponse } from '@knora/core';
+import { environment } from '../../../environments/environment';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class StoreService {
- constructor(private http: HttpClient) {}
+ constructor(private http: HttpClient) { }
/**
* resets the content of the triplestore
@@ -32,21 +35,23 @@ export class StoreService {
*/
resetTriplestoreContent(rdfDataObjects: RdfDataObject[]): Observable {
- return this.http.post(environment.api + '/admin/store/ResetTriplestoreContent', rdfDataObjects).map(
- (data) => {
- const result: ResetTriplestoreContentResponse = data;
- // console.log('StoreService - resetTriplestoreContent: ', result);
- return result.message;
- },
- (error: HttpErrorResponse) => {
- if (error.error instanceof Error) {
- console.log('StoreService - resetTriplestoreContent - Client-side error occurred.', error);
- } else {
- console.log('StoreService - resetTriplestoreContent - Server-side error occurred.', error);
- }
- throw error;
- }
- );
+ return this.http.post(environment.api + '/admin/store/ResetTriplestoreContent', rdfDataObjects)
+ .pipe(
+ map(
+ (data) => {
+ const result: ResetTriplestoreContentResponse = data;
+ // console.log('StoreService - resetTriplestoreContent: ', result);
+ return result.message;
+ },
+ (error: HttpErrorResponse) => {
+ if (error.error instanceof Error) {
+ console.log('StoreService - resetTriplestoreContent - Client-side error occurred.', error);
+ } else {
+ console.log('StoreService - resetTriplestoreContent - Server-side error occurred.', error);
+ }
+ throw error;
+ }
+ ));
}
diff --git a/src/app/model/services/test.service.spec.ts b/src/app/model/services/test.service.spec.ts
index 52f5a5f2..2d533841 100644
--- a/src/app/model/services/test.service.spec.ts
+++ b/src/app/model/services/test.service.spec.ts
@@ -9,7 +9,7 @@ describe('TestService', () => {
});
});
- xit('should be created', inject([TestService], (service: TestService) => {
+ it('should be created', inject([TestService], (service: TestService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/src/app/model/services/test.service.ts b/src/app/model/services/test.service.ts
index 416d4b10..5ccfb565 100644
--- a/src/app/model/services/test.service.ts
+++ b/src/app/model/services/test.service.ts
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class TestService {
constructor() { }
diff --git a/src/app/model/services/users.service.spec.ts b/src/app/model/services/users.service.spec.ts
deleted file mode 100644
index ef7868d2..00000000
--- a/src/app/model/services/users.service.spec.ts
+++ /dev/null
@@ -1,129 +0,0 @@
-import {environment} from '../../../environments/environment';
-import {UsersService} from './users.service';
-import {HttpModule} from '@angular/http';
-import {async, inject, TestBed} from '@angular/core/testing';
-import {ApiService} from './api.service';
-import {HttpClientModule} from '@angular/common/http';
-import {ApiServiceError} from './api-service-error';
-import {User, UserResponse, UsersResponse} from '../webapi/knora/admin';
-import {JsonConvert, OperationMode, ValueCheckingMode} from 'json2typescript';
-import {multiUser, multiUserResponseJson, usersResponseJson, usersTestData} from '../test-data/shared-test-data';
-import {StoreService} from './store.service';
-
-
-describe('UsersService', () => {
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [
- HttpModule,
- HttpClientModule
- ],
- providers: [
- ApiService,
- UsersService,
- StoreService
- ]
- });
- });
-
- it('should be created', async(inject(
- [UsersService], (service) => {
- expect(service).toBeDefined();
- }))
- );
-
- it('should parse users-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result: UsersResponse = jsonConvert.deserializeObject(usersResponseJson, UsersResponse);
-
- expect(result).toBeTruthy();
- });
-
- it('should parse user-response', () => {
-
- const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
-
- const result = jsonConvert.deserializeObject(multiUserResponseJson, UserResponse);
-
- expect(result).toBeTruthy();
- });
-
-
- if (environment.type === 'integration') {
-
- it('should load test data [it]', async(inject(
- [StoreService], (service) => {
-
- expect(service).toBeDefined();
-
- service.resetTriplestoreContent([])
- .subscribe(
- (result: string) => {
- expect(result).toBe('success');
- });
-
- })), 300000);
-
- it('#getAllUsers should return all users [it]', async(inject(
- [UsersService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getAllUsers()
- .subscribe(
- (users: User[]) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(users.length).toBe(21);
- expect(users).toEqual(usersTestData);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getUserByEmail should return user [it]', async(inject(
- [UsersService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getUserByEmail('multi.user@example.com')
- .subscribe(
- (user: User) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(user).toEqual(multiUser);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- it('#getUserByIri should return user [it]', async(inject(
- [UsersService], (service) => {
-
- expect(service).toBeDefined();
-
- service.getUserByIri('http://rdfh.ch/users/multiuser')
- .subscribe(
- (user: User) => {
- // console.log('users: ' + JSON.stringify(users));
- expect(user).toEqual(multiUser);
- },
- (error: ApiServiceError) => {
- fail(error);
- }
- );
-
- })));
-
- } else {
- xit('integration tests skipped. run "ng test --env=it".');
- }
-
-});
diff --git a/src/app/model/services/users.service.ts b/src/app/model/services/users.service.ts
deleted file mode 100644
index 97c2d495..00000000
--- a/src/app/model/services/users.service.ts
+++ /dev/null
@@ -1,303 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {User, UserResponse, UsersResponse} from '../webapi/knora';
-import {ApiServiceError} from './api-service-error';
-import {ApiServiceResult} from './api-service-result';
-import {ApiService} from './api.service';
-
-
-@Injectable()
-export class UsersService extends ApiService {
-
- /**
- * returns all users
- *
- * @returns {Observable}
- */
- getAllUsers(): Observable {
-
- return this.httpGet('/admin/users').map(
- (result: ApiServiceResult) => {
- // console.log('UsersService - getAllUsers - result: ', JSON.stringify(result));
- const response: UsersResponse = result.getBody(UsersResponse);
- // console.log('UsersService - getAllUsers - response: ' + JSON.stringify(response));
- const users: User[] = response.users;
- // console.log('UsersService - getAllUsers - users: ' + JSON.stringify(users));
- return users;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - getAllUsers - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * returns a user profile
- *
- * @param iri
- * @returns {Observable}
- */
- getUserByIri(iri: string): Observable {
- return this.httpGet('/admin/users/' + encodeURIComponent(iri)).map(
- (result: ApiServiceResult) => {
- // console.log('UsersService - getUserByIri - result: ', JSON.stringify(result));
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - getUserByIri - user: ', JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - getUserByIri - error: ', JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * returns a user profile
- *
- * @param email
- * @returns {Observable}
- */
- getUserByEmail(email: string): Observable {
- return this.httpGet('/admin/users/' + encodeURIComponent(email) + '?identifier=email').map(
- (result: ApiServiceResult) => {
- // console.log('UsersService - getUserByEmail - result: ', JSON.stringify(result));
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - getUserByIri: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - getUserByIri - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
-
-
- /**
- * Creates a new user.
- *
- * @param data
- * @returns {Observable}
- */
- createUser(data: any): Observable {
-
-// const headers: Headers = new Headers();
-// console.log(headers);
-// console.log(data);
-// headers.append("Authorization", "Basic " + btoa(email + ":" + password));
- /*
- email: String,
- givenName: String,
- familyName: String,
- password: String,
- status: Boolean = true,
- lang: String = "en",
- systemAdmin: Boolean = false
- */
-
- return this.httpPost('/admin/users', data).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - getUserByIri: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - getUserByIri - error: ' + JSON.stringify(error));
- throw error;
- }
- );
-
- }
-
- /**
- * Adds a user to a project.
- *
- * @param {string} uIri
- * @param {string} pIri
- * @returns {Observable}
- */
- addUserToProject(uIri: string, pIri: string): Observable {
- return this.httpPost('/admin/users/projects/' + encodeURIComponent(uIri) + '/' + encodeURIComponent(pIri)).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
-
- // console.log('UsersService - addUserToProject: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - addUserToProject - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * Removes a user from a project.
- *
- * @param {string} uIri
- * @param {string} pIri
- * @returns {Observable}
- */
- removeUserFromProject(uIri: string, pIri: string): Observable {
- return this.httpDelete('/admin/users/projects/' + encodeURIComponent(uIri) + '/' + encodeURIComponent(pIri)).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - removeUserFromProject: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - removeUserFromProject - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * Add user to a project admin group.
- *
- * @param {string} uIri
- * @param {string} pIri
- * @returns {Observable}
- */
- addUserToProjectAdmin(uIri: string, pIri: string): Observable {
- return this.httpPost('/admin/users/projects-admin/' + encodeURIComponent(uIri) + '/' + encodeURIComponent(pIri)).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - addUserToProjectAdmin: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - addUserToProjectAdmin - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * Removes a user from a project admin group.
- *
- * @param {string} uIri
- * @param {string} pIri
- * @returns {Observable}
- */
- removeUserFromProjectAdmin(uIri: string, pIri: string): Observable {
- return this.httpDelete('/admin/users/projects-admin/' + encodeURIComponent(uIri) + '/' + encodeURIComponent(pIri)).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - removeUserFromProjectAdmin: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - removeUserFromProjectAdmin - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * Add user to system admin groups.
- *
- * @param {string} uIri
- * @param data
- * @returns {Observable}
- */
- addUserToSystemAdmin(uIri: string, data: any): Observable {
- return this.httpPut('/admin/users/' + encodeURIComponent(uIri), data).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - activateUser: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - activateUser - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- /**
- * Delete (deactivate) user.
- *
- * @param {string} iri
- * @returns {Observable}
- */
- deleteUser(iri: string): Observable {
- return this.httpDelete('/admin/users/' + encodeURIComponent(iri)).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - deleteUser: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - deleteUser - error: ' + JSON.stringify(error));
- throw error;
- }
- );
-
- }
-
- /**
- * Activate (undelete) user.
- *
- * @param {string} iri
- * @returns {Observable}
- */
- activateUser(iri: string): Observable {
- const data: any = {
- status: true
- };
- return this.httpPut('/admin/users/' + encodeURIComponent(iri), data).map(
- (result: ApiServiceResult) => {
- const user: User = result.getBody(UserResponse).user;
- // console.log('UsersService - activateUser: ' + JSON.stringify(user));
- return user;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - activateUser - error: ' + JSON.stringify(error));
- throw error;
- }
- );
- }
-
- updateUsersPassword(userIri: string, requesterPassword: string, newPassword: string): Observable {
- const data = {
- newPassword: newPassword,
- requesterPassword: requesterPassword
- };
- return this.updateUser(userIri, data);
- }
-
- updateUser(iri: string, data: any): Observable {
-
- return this.httpPut('/admin/users/' + encodeURIComponent(iri), data, {}).map(
- (result: ApiServiceResult) => {
- const received: User = result.getBody(UserResponse).user;
- return received;
- },
- (error: ApiServiceError) => {
- console.error('UsersService - updateUser - error: ' + JSON.stringify(error));
- throw error;
- }
- )
- }
-
-
-
-}
diff --git a/src/app/model/test-data/basic-ontology.ts b/src/app/model/test-data/basic-ontology.ts
index 78b6b837..06de9a0d 100644
--- a/src/app/model/test-data/basic-ontology.ts
+++ b/src/app/model/test-data/basic-ontology.ts
@@ -30,7 +30,7 @@ import { PropertyItem } from '../webapi/knora/v1/properties/property-item';
* user: logged in project user
* admin: logged in project (or system) admin user
*/
-@JsonObject
+@JsonObject('Permissions')
export class Permissions {
@JsonProperty('everyone', String)
@@ -46,7 +46,7 @@ export class Permissions {
public admin: string = undefined;
}
-@JsonObject
+@JsonObject('Gui')
export class Gui {
@JsonProperty('element', String)
@@ -60,7 +60,7 @@ export class Gui {
}
-@JsonObject
+@JsonObject('Property')
export class Property {
@JsonProperty('label', String)
@@ -85,7 +85,7 @@ export class Property {
* the class includes the default properties as an array. The property id is the key in the array
*/
-@JsonObject
+@JsonObject('ResourceClass')
export class ResourceClass {
@JsonProperty('id', String, true)
@@ -119,7 +119,7 @@ export class ResourceClass {
* is an array of resource classes. The id of the resource class is the key in the array
*/
-@JsonObject
+@JsonObject('BasicOntology')
export class BasicOntology {
// defaultProperties
@@ -136,7 +136,7 @@ export class BasicOntology {
}
-@JsonObject
+@JsonObject('PropertyObject')
export class PropertyObject {
@JsonProperty('key', String)
public key: string = undefined;
diff --git a/src/app/model/test-data/shared-test-data.ts b/src/app/model/test-data/shared-test-data.ts
index 85cd8296..21a46a88 100644
--- a/src/app/model/test-data/shared-test-data.ts
+++ b/src/app/model/test-data/shared-test-data.ts
@@ -1,3 +1,4 @@
+import { JsonConvert, OperationMode, ValueCheckingMode } from 'json2typescript';
import {
Group,
GroupResponse,
@@ -11,67 +12,66 @@ import {
User,
UserResponse,
UsersResponse
-} from '../webapi/knora/admin';
-import {JsonConvert, OperationMode, ValueCheckingMode} from 'json2typescript';
+} from '@knora/core';
const jsonConvert: JsonConvert = new JsonConvert(OperationMode.ENABLE, ValueCheckingMode.ALLOW_NULL);
// ---- Projects ----
export const dokubibProjectIri = 'http://rdfh.ch/projects/00FE';
-export const projectsResponseJson: any = {'projects': [{'ontologies': ['http://www.knora.org/ontology/00FE/dokubib'], 'shortname': 'dokubib', 'description': [{'value': 'Dokubib'}], 'shortcode': '00FE', 'logo': null, 'id': 'http://rdfh.ch/projects/00FE', 'status': false, 'selfjoin': false, 'keywords': [], 'longname': 'Dokubib'}, {'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}, {'ontologies': ['http://www.knora.org/ontology/08AE/webern'], 'shortname': 'webern', 'description': [{'value': 'Historisch-kritische Edition des Gesamtschaffens von Anton Webern.'}], 'shortcode': '08AE', 'logo': null, 'id': 'http://rdfh.ch/projects/08AE', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anton Webern Gesamtausgabe'}, {'ontologies': ['http://www.knora.org/ontology/incunabula'], 'shortname': 'incunabula', 'description': [{'value': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n
'}], 'shortcode': null, 'logo': 'incunabula_logo.png', 'id': 'http://rdfh.ch/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': ['Basel', 'Basler Frühdrucke', 'Bilderfolgen', 'Contectualisation of images', 'Inkunabel', 'Kunsthistorisches Seminar Universität Basel', 'Late Middle Ages', 'Letterpress Printing', 'Narrenschiff', 'Sebastian Brant', 'Wiegendrucke', 'early print', 'incunabula', 'ship of fools'], 'longname': 'Bilderfolgen Basler Frühdrucke'}, {'ontologies': ['http://www.knora.org/ontology/biblio'], 'shortname': 'biblio', 'description': [{'value': 'Bibliography'}], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/DczxPs-sR6aZN91qV92ZmQ', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Bibliography'}, {'ontologies': ['http://www.knora.org/ontology/anything'], 'shortname': 'anything', 'description': [{'value': 'Anything Project'}], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/anything', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anything Project'}, {'ontologies': ['http://www.knora.org/ontology/beol'], 'shortname': 'beol', 'description': [{'value': 'Bernoulli-Euler Online'}], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/yTerZGyxjZVqFMNNKXCDPF', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Bernoulli-Euler Online'}, {'ontologies': ['http://www.knora.org/ontology/knora-base'], 'shortname': 'SystemProject', 'description': [{'value': 'Knora System Project', 'language': 'en'}], 'shortcode': 'FFFF', 'logo': null, 'id': 'http://www.knora.org/ontology/knora-base#SystemProject', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Knora System Project'}]};
+export const projectsResponseJson: any = { 'projects': [{ 'ontologies': ['http://www.knora.org/ontology/00FE/dokubib'], 'shortname': 'dokubib', 'description': [{ 'value': 'Dokubib' }], 'shortcode': '00FE', 'logo': null, 'id': 'http://rdfh.ch/projects/00FE', 'status': false, 'selfjoin': false, 'keywords': [], 'longname': 'Dokubib' }, { 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' }, { 'ontologies': ['http://www.knora.org/ontology/08AE/webern'], 'shortname': 'webern', 'description': [{ 'value': 'Historisch-kritische Edition des Gesamtschaffens von Anton Webern.' }], 'shortcode': '08AE', 'logo': null, 'id': 'http://rdfh.ch/projects/08AE', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anton Webern Gesamtausgabe' }, { 'ontologies': ['http://www.knora.org/ontology/incunabula'], 'shortname': 'incunabula', 'description': [{ 'value': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n' }], 'shortcode': null, 'logo': 'incunabula_logo.png', 'id': 'http://rdfh.ch/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': ['Basel', 'Basler Frühdrucke', 'Bilderfolgen', 'Contectualisation of images', 'Inkunabel', 'Kunsthistorisches Seminar Universität Basel', 'Late Middle Ages', 'Letterpress Printing', 'Narrenschiff', 'Sebastian Brant', 'Wiegendrucke', 'early print', 'incunabula', 'ship of fools'], 'longname': 'Bilderfolgen Basler Frühdrucke' }, { 'ontologies': ['http://www.knora.org/ontology/biblio'], 'shortname': 'biblio', 'description': [{ 'value': 'Bibliography' }], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/DczxPs-sR6aZN91qV92ZmQ', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Bibliography' }, { 'ontologies': ['http://www.knora.org/ontology/anything'], 'shortname': 'anything', 'description': [{ 'value': 'Anything Project' }], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/anything', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anything Project' }, { 'ontologies': ['http://www.knora.org/ontology/beol'], 'shortname': 'beol', 'description': [{ 'value': 'Bernoulli-Euler Online' }], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/yTerZGyxjZVqFMNNKXCDPF', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Bernoulli-Euler Online' }, { 'ontologies': ['http://www.knora.org/ontology/knora-base'], 'shortname': 'SystemProject', 'description': [{ 'value': 'Knora System Project', 'language': 'en' }], 'shortcode': 'FFFF', 'logo': null, 'id': 'http://www.knora.org/ontology/knora-base#SystemProject', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Knora System Project' }] };
export const projectsResponse: ProjectsResponse = jsonConvert.deserializeObject(projectsResponseJson, ProjectsResponse);
export const projectsTestData: Project[] = projectsResponse.projects;
export const imagesProjectIri = 'http://rdfh.ch/projects/00FF';
-export const imagesProjectResponseJson: any = {'project': {'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}};
+export const imagesProjectResponseJson: any = { 'project': { 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' } };
export const imagesProjectResponse: ProjectResponse = jsonConvert.deserializeObject(imagesProjectResponseJson, ProjectResponse);
export const imagesProject: Project = imagesProjectResponse.project;
export const incunabulaProjectIri = 'http://rdfh.ch/projects/77275339';
-export const incunabulaProjectResponseJson: any = {'project': {'ontologies': ['http://www.knora.org/ontology/incunabula'], 'shortname': 'incunabula', 'description': [{'value': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n'}], 'shortcode': null, 'logo': 'incunabula_logo.png', 'id': 'http://rdfh.ch/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': ['Basel', 'Basler Frühdrucke', 'Bilderfolgen', 'Contectualisation of images', 'Inkunabel', 'Kunsthistorisches Seminar Universität Basel', 'Late Middle Ages', 'Letterpress Printing', 'Narrenschiff', 'Sebastian Brant', 'Wiegendrucke', 'early print', 'incunabula', 'ship of fools'], 'longname': 'Bilderfolgen Basler Frühdrucke'}};
+export const incunabulaProjectResponseJson: any = { 'project': { 'ontologies': ['http://www.knora.org/ontology/incunabula'], 'shortname': 'incunabula', 'description': [{ 'value': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n' }], 'shortcode': null, 'logo': 'incunabula_logo.png', 'id': 'http://rdfh.ch/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': ['Basel', 'Basler Frühdrucke', 'Bilderfolgen', 'Contectualisation of images', 'Inkunabel', 'Kunsthistorisches Seminar Universität Basel', 'Late Middle Ages', 'Letterpress Printing', 'Narrenschiff', 'Sebastian Brant', 'Wiegendrucke', 'early print', 'incunabula', 'ship of fools'], 'longname': 'Bilderfolgen Basler Frühdrucke' } };
export const incunabulaProjectResponse: ProjectResponse = jsonConvert.deserializeObject(incunabulaProjectResponseJson, ProjectResponse);
export const incunabulaProject: Project = incunabulaProjectResponse.project;
export const anythingProjectIri = 'http://rdfh.ch/projects/anything';
-export const anythingProjectResponseJson: any = {'project': {'ontologies': ['http://www.knora.org/ontology/anything'], 'shortname': 'anything', 'description': [{'value': 'Anything Project'}], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/anything', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anything Project'}};
+export const anythingProjectResponseJson: any = { 'project': { 'ontologies': ['http://www.knora.org/ontology/anything'], 'shortname': 'anything', 'description': [{ 'value': 'Anything Project' }], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/anything', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anything Project' } };
export const anythingProjectResponse: ProjectResponse = jsonConvert.deserializeObject(anythingProjectResponseJson, ProjectResponse);
export const anythingProject: Project = anythingProjectResponse.project;
// ---- Groups ----
-export const groupsResponseJson: any = {'groups': [{'name': 'Image reviewer', 'project': {'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}, 'description': 'A group for image reviewers.', 'id': 'http://rdfh.ch/groups/00FF/images-reviewer', 'status': true, 'selfjoin': false}]};
+export const groupsResponseJson: any = { 'groups': [{ 'name': 'Image reviewer', 'project': { 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' }, 'description': 'A group for image reviewers.', 'id': 'http://rdfh.ch/groups/00FF/images-reviewer', 'status': true, 'selfjoin': false }] };
export const groupsResponse: GroupsResponse = jsonConvert.deserializeObject(groupsResponseJson, GroupsResponse);
export const groupsTestData: Group[] = groupsResponse.groups;
-export const imagesReviewerGroupResponseJson: any = {'group': {'name': 'Image reviewer', 'project': {'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}, 'description': 'A group for image reviewers.', 'id': 'http://rdfh.ch/groups/00FF/images-reviewer', 'status': true, 'selfjoin': false}};
+export const imagesReviewerGroupResponseJson: any = { 'group': { 'name': 'Image reviewer', 'project': { 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' }, 'description': 'A group for image reviewers.', 'id': 'http://rdfh.ch/groups/00FF/images-reviewer', 'status': true, 'selfjoin': false } };
export const imagesReviewerGroupResponse: GroupResponse = jsonConvert.deserializeObject(imagesReviewerGroupResponseJson, GroupResponse);
export const imagesReviewerGroup: Group = imagesReviewerGroupResponse.group;
// ---- Users ----
-export const usersResponseJson: any = {'users': [{'familyName': 'Admin-alt', 'givenName': 'Administrator-alt', 'email': 'root-alt@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/91e19f1e01', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'User02', 'email': 'user02.user@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/97cec4000f', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User01', 'givenName': 'Anything', 'email': 'anything.user01@example.org', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'Admin', 'givenName': 'Anything', 'email': 'anything.admin@example.org', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/AnythingAdminUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User02', 'givenName': 'Anything', 'email': 'anything.user02@example.org', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'BEOL', 'givenName': 'BEOL', 'email': 'beol@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/PSGbemdjZi4kQ6GHJVkLGE', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'BEOL', 'givenName': 'BEOL', 'email': 't.schweizer@unibas.ch', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/PSGbemdjZi4kQ6GHJVkLGF', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'biblio', 'givenName': 'biblio', 'email': 'biblio@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/Q-6Sssu8TBWrcCGuVJ0lVw', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'Test', 'givenName': 'User', 'email': 'user.test@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/b83acc5f05', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'User01', 'email': 'user01.user1@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/c266a56709', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'User03', 'email': 'images-reviewer-user@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/images-reviewer-user', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'Inactive', 'email': 'inactive.user@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/inactiveuser', 'status': false, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User2', 'givenName': 'Test', 'email': 'test.user2@test.ch', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/incunabulaMemberUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'Multi', 'email': 'multi.user@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/multiuser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'Normal', 'email': 'normal.user@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/normaluser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'Administrator', 'givenName': 'System', 'email': 'root@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/root', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'User', 'givenName': 'Super', 'email': 'super.user@example.com', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/superuser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'Webern', 'givenName': 'Admin', 'email': 'webern-admin@example.ch', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/webernProjectAdmin', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'Webern', 'givenName': 'Nutzer', 'email': 'webern-nutzer@example.ch', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://rdfh.ch/users/webernProjectMember', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null}, {'familyName': 'Anonymous', 'givenName': 'Knora', 'email': 'anonymous@localhost', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://www.knora.org/ontology/knora-base#AnonymousUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'en', 'password': null}, {'familyName': 'System', 'givenName': 'Knora', 'email': 'system@localhost', 'permissions': {'groupsPerProject': {}, 'administrativePermissionsPerProject': {}}, 'groups': [], 'id': 'http://www.knora.org/ontology/knora-base#SystemUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'en', 'password': null}]};
+export const usersResponseJson: any = { 'users': [{ 'familyName': 'Admin-alt', 'givenName': 'Administrator-alt', 'email': 'root-alt@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/91e19f1e01', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'User02', 'email': 'user02.user@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/97cec4000f', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User01', 'givenName': 'Anything', 'email': 'anything.user01@example.org', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'Admin', 'givenName': 'Anything', 'email': 'anything.admin@example.org', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/AnythingAdminUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User02', 'givenName': 'Anything', 'email': 'anything.user02@example.org', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'BEOL', 'givenName': 'BEOL', 'email': 'beol@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/PSGbemdjZi4kQ6GHJVkLGE', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'BEOL', 'givenName': 'BEOL', 'email': 't.schweizer@unibas.ch', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/PSGbemdjZi4kQ6GHJVkLGF', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'biblio', 'givenName': 'biblio', 'email': 'biblio@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/Q-6Sssu8TBWrcCGuVJ0lVw', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'Test', 'givenName': 'User', 'email': 'user.test@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/b83acc5f05', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'User01', 'email': 'user01.user1@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/c266a56709', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'User03', 'email': 'images-reviewer-user@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/images-reviewer-user', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'Inactive', 'email': 'inactive.user@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/inactiveuser', 'status': false, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User2', 'givenName': 'Test', 'email': 'test.user2@test.ch', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/incunabulaMemberUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'Multi', 'email': 'multi.user@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/multiuser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'Normal', 'email': 'normal.user@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/normaluser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'Administrator', 'givenName': 'System', 'email': 'root@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/root', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'User', 'givenName': 'Super', 'email': 'super.user@example.com', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/superuser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'Webern', 'givenName': 'Admin', 'email': 'webern-admin@example.ch', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/webernProjectAdmin', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'Webern', 'givenName': 'Nutzer', 'email': 'webern-nutzer@example.ch', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://rdfh.ch/users/webernProjectMember', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'de', 'password': null }, { 'familyName': 'Anonymous', 'givenName': 'Knora', 'email': 'anonymous@localhost', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://www.knora.org/ontology/knora-base#AnonymousUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'en', 'password': null }, { 'familyName': 'System', 'givenName': 'Knora', 'email': 'system@localhost', 'permissions': { 'groupsPerProject': {}, 'administrativePermissionsPerProject': {} }, 'groups': [], 'id': 'http://www.knora.org/ontology/knora-base#SystemUser', 'status': true, 'token': null, 'sessionId': null, 'projects': [], 'lang': 'en', 'password': null }] };
export const usersResponse: UsersResponse = jsonConvert.deserializeObject(usersResponseJson, UsersResponse);
export const usersTestData: User[] = usersResponse.users;
-export const multiUserResponseJson: any = {'user': {'familyName': 'User', 'givenName': 'Multi', 'email': 'multi.user@example.com', 'permissions': {'groupsPerProject': {'http://rdfh.ch/projects/77275339': ['http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin'], 'http://rdfh.ch/projects/00FF': ['http://rdfh.ch/groups/00FF/images-reviewer', 'http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin'], 'http://rdfh.ch/projects/anything': ['http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin']}, 'administrativePermissionsPerProject': {'http://rdfh.ch/projects/77275339': [{'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null}, {'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null}], 'http://rdfh.ch/projects/00FF': [{'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null}, {'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null}], 'http://rdfh.ch/projects/anything': [{'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null}, {'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null}]}}, 'groups': [{'name': 'Image reviewer', 'project': {'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}, 'description': 'A group for image reviewers.', 'id': 'http://rdfh.ch/groups/00FF/images-reviewer', 'status': true, 'selfjoin': false}], 'id': 'http://rdfh.ch/users/multiuser', 'status': true, 'token': null, 'sessionId': null, 'projects': [{'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}, {'ontologies': ['http://www.knora.org/ontology/incunabula'], 'shortname': 'incunabula', 'description': [{'value': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n'}], 'shortcode': null, 'logo': 'incunabula_logo.png', 'id': 'http://rdfh.ch/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': ['Basel', 'Basler Frühdrucke', 'Bilderfolgen', 'Contectualisation of images', 'Inkunabel', 'Kunsthistorisches Seminar Universität Basel', 'Late Middle Ages', 'Letterpress Printing', 'Narrenschiff', 'Sebastian Brant', 'Wiegendrucke', 'early print', 'incunabula', 'ship of fools'], 'longname': 'Bilderfolgen Basler Frühdrucke'}, {'ontologies': ['http://www.knora.org/ontology/anything'], 'shortname': 'anything', 'description': [{'value': 'Anything Project'}], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/anything', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anything Project'}], 'lang': 'de', 'password': null}};
+export const multiUserResponseJson: any = { 'user': { 'familyName': 'User', 'givenName': 'Multi', 'email': 'multi.user@example.com', 'permissions': { 'groupsPerProject': { 'http://rdfh.ch/projects/77275339': ['http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin'], 'http://rdfh.ch/projects/00FF': ['http://rdfh.ch/groups/00FF/images-reviewer', 'http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin'], 'http://rdfh.ch/projects/anything': ['http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin'] }, 'administrativePermissionsPerProject': { 'http://rdfh.ch/projects/77275339': [{ 'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null }, { 'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null }], 'http://rdfh.ch/projects/00FF': [{ 'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null }, { 'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null }], 'http://rdfh.ch/projects/anything': [{ 'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null }, { 'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null }] } }, 'groups': [{ 'name': 'Image reviewer', 'project': { 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' }, 'description': 'A group for image reviewers.', 'id': 'http://rdfh.ch/groups/00FF/images-reviewer', 'status': true, 'selfjoin': false }], 'id': 'http://rdfh.ch/users/multiuser', 'status': true, 'token': null, 'sessionId': null, 'projects': [{ 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' }, { 'ontologies': ['http://www.knora.org/ontology/incunabula'], 'shortname': 'incunabula', 'description': [{ 'value': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n' }], 'shortcode': null, 'logo': 'incunabula_logo.png', 'id': 'http://rdfh.ch/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': ['Basel', 'Basler Frühdrucke', 'Bilderfolgen', 'Contectualisation of images', 'Inkunabel', 'Kunsthistorisches Seminar Universität Basel', 'Late Middle Ages', 'Letterpress Printing', 'Narrenschiff', 'Sebastian Brant', 'Wiegendrucke', 'early print', 'incunabula', 'ship of fools'], 'longname': 'Bilderfolgen Basler Frühdrucke' }, { 'ontologies': ['http://www.knora.org/ontology/anything'], 'shortname': 'anything', 'description': [{ 'value': 'Anything Project' }], 'shortcode': null, 'logo': null, 'id': 'http://rdfh.ch/projects/anything', 'status': true, 'selfjoin': false, 'keywords': [], 'longname': 'Anything Project' }], 'lang': 'de', 'password': null } };
export const multiUserResponse: UserResponse = jsonConvert.deserializeObject(multiUserResponseJson, UserResponse);
export const multiUser: User = multiUserResponse.user;
-export const imagesUserResponseJson: any = {'user': {'familyName': 'User', 'givenName': 'User01', 'email': 'user01.user1@example.com', 'permissions': {'groupsPerProject': {'http://rdfh.ch/projects/00FF': ['http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin']}, 'administrativePermissionsPerProject': {'http://rdfh.ch/projects/00FF': [{'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null}, {'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null}]}}, 'groups': [], 'id': 'http://rdfh.ch/users/c266a56709', 'status': true, 'token': null, 'sessionId': null, 'projects': [{'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{'value': 'A demo project of a collection of images', 'language': 'en'}], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo'}], 'lang': 'de', 'password': null}};
+export const imagesUserResponseJson: any = { 'user': { 'familyName': 'User', 'givenName': 'User01', 'email': 'user01.user1@example.com', 'permissions': { 'groupsPerProject': { 'http://rdfh.ch/projects/00FF': ['http://www.knora.org/ontology/knora-base#ProjectMember', 'http://www.knora.org/ontology/knora-base#ProjectAdmin'] }, 'administrativePermissionsPerProject': { 'http://rdfh.ch/projects/00FF': [{ 'name': 'ProjectAdminAllPermission', 'additionalInformation': null, 'v1Code': null }, { 'name': 'ProjectResourceCreateAllPermission', 'additionalInformation': null, 'v1Code': null }] } }, 'groups': [], 'id': 'http://rdfh.ch/users/c266a56709', 'status': true, 'token': null, 'sessionId': null, 'projects': [{ 'ontologies': ['http://www.knora.org/ontology/00FF/images'], 'shortname': 'images', 'description': [{ 'value': 'A demo project of a collection of images', 'language': 'en' }], 'shortcode': '00FF', 'logo': null, 'id': 'http://rdfh.ch/projects/00FF', 'status': true, 'selfjoin': false, 'keywords': ['collection', 'images'], 'longname': 'Image Collection Demo' }], 'lang': 'de', 'password': null } };
export const imagesUserResponse: UserResponse = jsonConvert.deserializeObject(imagesUserResponseJson, UserResponse);
export const imagesUser: User = imagesUserResponse.user;
// ---- Lists ----
-export const listsResponseJson: any = {'lists': [{'listinfo': {'id': 'http://rdfh.ch/lists/FFFF/ynm01', 'projectIri': 'http://www.knora.org/ontology/knora-base#SystemProject', 'labels': [{'value': 'The Yes, No, Maybe List', 'language': 'en'}, {'value': 'Die Ja, Nein, Vielleicht Liste', 'language': 'de'}], 'comments': [{'value': 'This list can be used by all projects.', 'language': 'en'}, {'value': 'Diese Liste kann von allen Projekten verwendet werden.', 'language': 'de'}]}, 'children': []}]};
+export const listsResponseJson: any = { 'lists': [{ 'listinfo': { 'id': 'http://rdfh.ch/lists/FFFF/ynm01', 'projectIri': 'http://www.knora.org/ontology/knora-base#SystemProject', 'labels': [{ 'value': 'The Yes, No, Maybe List', 'language': 'en' }, { 'value': 'Die Ja, Nein, Vielleicht Liste', 'language': 'de' }], 'comments': [{ 'value': 'This list can be used by all projects.', 'language': 'en' }, { 'value': 'Diese Liste kann von allen Projekten verwendet werden.', 'language': 'de' }] }, 'children': [] }] };
export const listsResponse: ListsResponse = jsonConvert.deserializeObject(listsResponseJson, ListsResponse);
export const listsTestData: List[] = listsResponse.lists;
-export const yesNoMaybeListResponseJson: any = {'list': {'listinfo': {'id': 'http://rdfh.ch/lists/FFFF/ynm01', 'projectIri': 'http://www.knora.org/ontology/knora-base#SystemProject', 'labels': [{'value': 'The Yes, No, Maybe List', 'language': 'en'}, {'value': 'Die Ja, Nein, Vielleicht Liste', 'language': 'de'}], 'comments': [{'value': 'This list can be used by all projects.', 'language': 'en'}, {'value': 'Diese Liste kann von allen Projekten verwendet werden.', 'language': 'de'}]}, 'children': [{'children': [], 'name': 'yes', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-01', 'labels': [{'value': 'Yes'}], 'position': 0, 'comments': []}, {'children': [], 'name': 'no', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-02', 'labels': [{'value': 'No'}], 'position': 1, 'comments': []}, {'children': [], 'name': 'maybe', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-03', 'labels': [{'value': 'Maybe'}], 'position': 2, 'comments': []}]}};
+export const yesNoMaybeListResponseJson: any = { 'list': { 'listinfo': { 'id': 'http://rdfh.ch/lists/FFFF/ynm01', 'projectIri': 'http://www.knora.org/ontology/knora-base#SystemProject', 'labels': [{ 'value': 'The Yes, No, Maybe List', 'language': 'en' }, { 'value': 'Die Ja, Nein, Vielleicht Liste', 'language': 'de' }], 'comments': [{ 'value': 'This list can be used by all projects.', 'language': 'en' }, { 'value': 'Diese Liste kann von allen Projekten verwendet werden.', 'language': 'de' }] }, 'children': [{ 'children': [], 'name': 'yes', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-01', 'labels': [{ 'value': 'Yes' }], 'position': 0, 'comments': [] }, { 'children': [], 'name': 'no', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-02', 'labels': [{ 'value': 'No' }], 'position': 1, 'comments': [] }, { 'children': [], 'name': 'maybe', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-03', 'labels': [{ 'value': 'Maybe' }], 'position': 2, 'comments': [] }] } };
export const yesNoMaybeListResponse: ListResponse = jsonConvert.deserializeObject(yesNoMaybeListResponseJson, ListResponse);
export const yesNoMaybeListTestData: List = yesNoMaybeListResponse.list;
-export const yesNodeInfoResponseJson: any = {'nodeinfo': {'name': 'yes', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-01', 'labels': [{'value': 'Yes', 'language': 'en'}, {'value': 'Ja', 'language': 'de'}], 'position': 0, 'comments': []}};
+export const yesNodeInfoResponseJson: any = { 'nodeinfo': { 'name': 'yes', 'id': 'http://rdfh.ch/lists/FFFF/ynm01-01', 'labels': [{ 'value': 'Yes', 'language': 'en' }, { 'value': 'Ja', 'language': 'de' }], 'position': 0, 'comments': [] } };
export const yesNodeInfoResponse: ListNodeInfoResponse = jsonConvert.deserializeObject(yesNodeInfoResponseJson, ListNodeInfoResponse);
export const yesNodeInfoTestData: ListNodeInfo = yesNodeInfoResponse.nodeinfo;
diff --git a/src/app/model/webapi/knora/admin/authentication/authentication-request-payload.ts b/src/app/model/webapi/knora/admin/authentication/authentication-request-payload.ts
deleted file mode 100644
index 6aa405c6..00000000
--- a/src/app/model/webapi/knora/admin/authentication/authentication-request-payload.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-export interface AuthenticationRequestPayload {
-
- email: string;
-
- password: string;
-}
diff --git a/src/app/model/webapi/knora/admin/authentication/authentication-response.ts b/src/app/model/webapi/knora/admin/authentication/authentication-response.ts
deleted file mode 100644
index 647c5688..00000000
--- a/src/app/model/webapi/knora/admin/authentication/authentication-response.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-
-@JsonObject
-export class AuthenticationResponse {
-
- @JsonProperty('token', String)
- public token: string = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/authentication/current-user.ts b/src/app/model/webapi/knora/admin/authentication/current-user.ts
deleted file mode 100644
index 276ee253..00000000
--- a/src/app/model/webapi/knora/admin/authentication/current-user.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-export interface CurrentUser {
-
- email: string;
-
- token: string;
-
- sysAdmin: boolean;
-}
diff --git a/src/app/model/webapi/knora/admin/groups/group-response.ts b/src/app/model/webapi/knora/admin/groups/group-response.ts
deleted file mode 100644
index 12e10a62..00000000
--- a/src/app/model/webapi/knora/admin/groups/group-response.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {Group} from './group';
-
-@JsonObject
-export class GroupResponse {
-
- @JsonProperty('group', Group)
- public group: Group = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/groups/group.ts b/src/app/model/webapi/knora/admin/groups/group.ts
deleted file mode 100644
index 478750d4..00000000
--- a/src/app/model/webapi/knora/admin/groups/group.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {Project} from '../projects/project';
-
-@JsonObject
-export class Group {
-
- @JsonProperty('id', String)
- public id: string = undefined;
-
- @JsonProperty('name', String)
- public name: string = undefined;
-
- @JsonProperty('description', String)
- public description: string = undefined;
-
- @JsonProperty('project', Project, false)
- public project: Project = undefined;
-
- @JsonProperty('status', Boolean)
- public status: boolean = undefined;
-
- @JsonProperty('selfjoin', Boolean)
- public selfjoin: boolean = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/groups/groups-response.ts b/src/app/model/webapi/knora/admin/groups/groups-response.ts
deleted file mode 100644
index 258bd14a..00000000
--- a/src/app/model/webapi/knora/admin/groups/groups-response.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {Group} from './group';
-
-@JsonObject
-export class GroupsResponse {
-
- @JsonProperty('groups', [Group])
- public groups: Group[] = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/index.ts b/src/app/model/webapi/knora/admin/index.ts
deleted file mode 100644
index a58a7ef8..00000000
--- a/src/app/model/webapi/knora/admin/index.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-/**
- * Interfaces for groups
- */
-export * from './groups/group';
-export * from './groups/group-response';
-export * from './groups/groups-response';
-
-
-/**
- * Interface for lists
- */
-export * from './lists/list';
-export * from './lists/list-info';
-export * from './lists/list-info-response';
-export * from './lists/list-node';
-export * from './lists/list-node-info';
-export * from './lists/list-node-info-response';
-export * from './lists/list-response';
-export * from './lists/lists-response';
-export * from './lists/list-create-payload';
-
-
-/**
- * Interface for ontologies
- */
-export * from './ontologies/ontology-info-short';
-
-
-/**
- * Interfaces for permissions
- */
-export * from './permissions/permission-data'
-
-
-/**
- * Interfaces for projects
- */
-export * from './projects/project';
-export * from './projects/project-members-response';
-export * from './projects/project-response';
-export * from './projects/projects-response';
-
-
-/**
- * Interfaces for store
- */
-export * from './store/rdf-data-object';
-export * from './store/reset-triplestore-content-response';
-
-
-/**
- * Interfaces for users
- */
-export * from './users/users-response';
-export * from './users/user-response';
-export * from './users/user';
diff --git a/src/app/model/webapi/knora/admin/lists/list-create-payload.ts b/src/app/model/webapi/knora/admin/lists/list-create-payload.ts
deleted file mode 100644
index e90045c0..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-create-payload.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import {StringLiteralV2} from '../../v2';
-
-
-export interface ListCreatePayload {
-
- // always needed
- projectIri: string;
-
- // should have at least one label
- labels: StringLiteralV2[];
-
- // can be empty
- comments: StringLiteralV2[];
-}
diff --git a/src/app/model/webapi/knora/admin/lists/list-info-response.ts b/src/app/model/webapi/knora/admin/lists/list-info-response.ts
deleted file mode 100644
index 0ba86349..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-info-response.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {ListInfo} from './list-info';
-
-@JsonObject
-export class ListInfoResponse {
-
- @JsonProperty('listinfo', ListInfo, false)
- public listinfo: ListInfo = undefined;
-}
-
-
diff --git a/src/app/model/webapi/knora/admin/lists/list-info-update-payload.ts b/src/app/model/webapi/knora/admin/lists/list-info-update-payload.ts
deleted file mode 100644
index ee20a6b7..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-info-update-payload.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import {StringLiteralV2} from '../../v2';
-
-
-export interface ListInfoUpdatePayload {
-
- // required
- listIri: string
-
- // required
- projectIri: string
-
- // can be an empty array
- labels: StringLiteralV2[]
-
- // can be an empty array
- comments: StringLiteralV2[]
-}
diff --git a/src/app/model/webapi/knora/admin/lists/list-info.ts b/src/app/model/webapi/knora/admin/lists/list-info.ts
deleted file mode 100644
index c2afaa12..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-info.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {StringLiteralV2} from '../../v2/shared/strings';
-
-@JsonObject
-export class ListInfo {
-
- @JsonProperty('id', String, false)
- public id: string = undefined;
-
- @JsonProperty('projectIri', String, false)
- public projectIri: string = undefined;
-
- @JsonProperty('labels', [StringLiteralV2], true)
- public labels: StringLiteralV2[] = undefined;
-
- @JsonProperty('comments', [StringLiteralV2], true)
- public comments: StringLiteralV2[] = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/lists/list-node-info-response.ts b/src/app/model/webapi/knora/admin/lists/list-node-info-response.ts
deleted file mode 100644
index faef0278..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-node-info-response.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {ListNodeInfo} from './list-node-info';
-
-@JsonObject
-export class ListNodeInfoResponse {
-
- @JsonProperty('nodeinfo', ListNodeInfo, false)
- public nodeinfo: ListNodeInfo = undefined;
-}
-
-
diff --git a/src/app/model/webapi/knora/admin/lists/list-node-info.ts b/src/app/model/webapi/knora/admin/lists/list-node-info.ts
deleted file mode 100644
index 8b299125..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-node-info.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {StringLiteralV2} from '../../v2/index';
-
-@JsonObject
-export class ListNodeInfo {
-
- @JsonProperty('id', String, false)
- public id: string = undefined;
-
- @JsonProperty('labels', [StringLiteralV2], false)
- public labels: StringLiteralV2[] = undefined;
-
- @JsonProperty('comments', [StringLiteralV2], false)
- public comments: StringLiteralV2[] = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/lists/list-node.ts b/src/app/model/webapi/knora/admin/lists/list-node.ts
deleted file mode 100644
index ac996d9b..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-node.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-
-@JsonObject
-export class ListNode {
- @JsonProperty('id', String, false)
- public id: string = undefined;
-
- @JsonProperty('name', String, true)
- public name: string = undefined;
-
- @JsonProperty('label', String, true)
- public label: string = undefined;
-
- @JsonProperty('children', [ListNode], true)
- public children: ListNode[] = undefined;
-
- @JsonProperty('level', Number, true)
- public level: number = undefined;
-
- @JsonProperty('position', Number, true)
- public position: number = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/lists/list-response.ts b/src/app/model/webapi/knora/admin/lists/list-response.ts
deleted file mode 100644
index 471753d3..00000000
--- a/src/app/model/webapi/knora/admin/lists/list-response.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {List} from './list';
-
-@JsonObject
-export class ListResponse {
-
- @JsonProperty('list', List, false)
- public list: List = undefined;
-}
-
-
diff --git a/src/app/model/webapi/knora/admin/lists/list.ts b/src/app/model/webapi/knora/admin/lists/list.ts
deleted file mode 100644
index f8614033..00000000
--- a/src/app/model/webapi/knora/admin/lists/list.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {ListInfo} from './list-info';
-import {ListNode} from './list-node';
-
-@JsonObject
-export class List {
-
- @JsonProperty('listinfo', ListInfo, false)
- public listinfo: ListInfo = undefined;
-
- @JsonProperty('children', [ListNode], false)
- public children: ListNode[] = undefined;
-}
-
-
diff --git a/src/app/model/webapi/knora/admin/lists/lists-response.ts b/src/app/model/webapi/knora/admin/lists/lists-response.ts
deleted file mode 100644
index 15880409..00000000
--- a/src/app/model/webapi/knora/admin/lists/lists-response.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {List} from './list';
-
-@JsonObject
-export class ListsResponse {
-
- @JsonProperty('lists', [List], false)
- public lists: List[] = undefined;
-}
-
-
diff --git a/src/app/model/webapi/knora/admin/ontologies/ontology-info-short.ts b/src/app/model/webapi/knora/admin/ontologies/ontology-info-short.ts
deleted file mode 100644
index cfa7fbb3..00000000
--- a/src/app/model/webapi/knora/admin/ontologies/ontology-info-short.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-
-@JsonObject
-export class OntologyInfoShort {
-
- @JsonProperty('ontologyIri', String)
- public ontologyIri: string = undefined;
-
- @JsonProperty('ontologyName', String)
- public ontologyName: string = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/permissions/permission-data.ts b/src/app/model/webapi/knora/admin/permissions/permission-data.ts
deleted file mode 100644
index 34457a4b..00000000
--- a/src/app/model/webapi/knora/admin/permissions/permission-data.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-
-@JsonObject
-export class PermissionData {
-
- @JsonProperty('groupsPerProject', Object)
- public groupsPerProject: any = undefined;
-
- @JsonProperty('administrativePermissionsPerProject', Object)
- public administrativePermissionsPerProject: any = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/projects/project-members-response.ts b/src/app/model/webapi/knora/admin/projects/project-members-response.ts
deleted file mode 100644
index ad9608a2..00000000
--- a/src/app/model/webapi/knora/admin/projects/project-members-response.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {User} from '../users/user';
-
-@JsonObject
-export class ProjectMembersResponse {
- @JsonProperty('members', [User])
- public members: User[] = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/projects/project-response.ts b/src/app/model/webapi/knora/admin/projects/project-response.ts
deleted file mode 100644
index 5490a3dd..00000000
--- a/src/app/model/webapi/knora/admin/projects/project-response.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import { JsonObject, JsonProperty } from 'json2typescript';
-import {Project} from './project';
-
-
-@JsonObject
-export class ProjectResponse {
-
- @JsonProperty('project', Project)
- public project: Project = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/projects/project.ts b/src/app/model/webapi/knora/admin/projects/project.ts
deleted file mode 100644
index 2d21f2d1..00000000
--- a/src/app/model/webapi/knora/admin/projects/project.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {StringLiteralV2} from '../../v2/shared/strings';
-
-@JsonObject
-export class Project {
-
- @JsonProperty('id', String)
- public id: string = undefined;
-
- @JsonProperty('shortname', String)
- public shortname: string = undefined;
-
- @JsonProperty('shortcode', String, true)
- public shortcode: string = undefined;
-
- @JsonProperty('longname', String, true)
- public longname: string = undefined;
-
- @JsonProperty('description', [StringLiteralV2], true)
- public description: StringLiteralV2[] = [new StringLiteralV2()];
-
- @JsonProperty('keywords', [String], true)
- public keywords: string[] = undefined;
-
- @JsonProperty('logo', String, true)
- public logo: string = undefined;
-
- @JsonProperty('institution', String, true)
- public institution: string = undefined;
-
- @JsonProperty('ontologies', [String])
- public ontologies: string[] = undefined;
-
- @JsonProperty('status', Boolean)
- public status: boolean = undefined;
-
- @JsonProperty('selfjoin', Boolean)
- public selfjoin: boolean = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/projects/projects-response.ts b/src/app/model/webapi/knora/admin/projects/projects-response.ts
deleted file mode 100644
index bd21171a..00000000
--- a/src/app/model/webapi/knora/admin/projects/projects-response.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {Project} from './project';
-
-@JsonObject
-export class ProjectsResponse {
-
- @JsonProperty('projects', [Project])
- public projects: Project[] = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/admin/store/rdf-data-object.ts b/src/app/model/webapi/knora/admin/store/rdf-data-object.ts
deleted file mode 100644
index 00fb6055..00000000
--- a/src/app/model/webapi/knora/admin/store/rdf-data-object.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-export interface RdfDataObject {
- path: string;
- name: string;
-}
diff --git a/src/app/model/webapi/knora/admin/store/reset-triplestore-content-response.ts b/src/app/model/webapi/knora/admin/store/reset-triplestore-content-response.ts
deleted file mode 100644
index eae2379b..00000000
--- a/src/app/model/webapi/knora/admin/store/reset-triplestore-content-response.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-export interface ResetTriplestoreContentResponse {
- message: string;
-}
diff --git a/src/app/model/webapi/knora/admin/users/user-response.ts b/src/app/model/webapi/knora/admin/users/user-response.ts
deleted file mode 100644
index e13ce5b0..00000000
--- a/src/app/model/webapi/knora/admin/users/user-response.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {User} from './user';
-
-@JsonObject
-export class UserResponse {
-
- @JsonProperty('user', User)
- public user: User = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/users/user.ts b/src/app/model/webapi/knora/admin/users/user.ts
deleted file mode 100644
index 900529a3..00000000
--- a/src/app/model/webapi/knora/admin/users/user.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {Group} from '../groups/group';
-import {PermissionData} from '../permissions/permission-data';
-import {Project} from '../projects/project';
-
-@JsonObject
-export class User {
-
- @JsonProperty('id', String)
- public id: string = undefined;
-
- @JsonProperty('email', String)
- public email: string = undefined;
-
- @JsonProperty('password', String, true)
- public password: string = undefined;
-
- @JsonProperty('token', String, true)
- public token: string = undefined;
-
- @JsonProperty('givenName', String)
- public givenName: string = undefined;
-
- @JsonProperty('familyName', String)
- public familyName: string = undefined;
-
- @JsonProperty('status', Boolean)
- public status: boolean = undefined;
-
- @JsonProperty('lang', String)
- public lang: string = undefined;
-
- @JsonProperty('groups', [Group])
- public groups: Group[] = undefined;
-
- @JsonProperty('projects', [Project])
- public projects: Project[] = undefined;
-
- @JsonProperty('sessionId', String, true)
- public sessionId: string = undefined;
-
- @JsonProperty('permissions', PermissionData)
- public permissions: PermissionData = undefined;
-
- @JsonProperty('systemAdmin', Boolean, true)
- public systemAdmin?: boolean = false;
-
-
-}
diff --git a/src/app/model/webapi/knora/admin/users/users-list.ts b/src/app/model/webapi/knora/admin/users/users-list.ts
deleted file mode 100644
index ed09e925..00000000
--- a/src/app/model/webapi/knora/admin/users/users-list.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {User} from './user';
-
-@JsonObject
-export class UsersList {
-
- @JsonProperty('users', [User])
- public users: User[] = undefined;
-
-}
-
-@JsonObject
-export class NewUserData {
-
- @JsonProperty('email', String, true)
- public email: string = undefined;
-
- @JsonProperty('firstname', String, true)
- public givenName: string = undefined;
-
- @JsonProperty('lastname', String, true)
- public familyName: string = undefined;
-
- @JsonProperty('user_profile', User, true)
- public user_profile: User = undefined;
-}
-
-@JsonObject
-export class NewUsersList {
- @JsonProperty('users', [NewUserData])
- public users: NewUserData[] = undefined;
-}
diff --git a/src/app/model/webapi/knora/admin/users/users-response.ts b/src/app/model/webapi/knora/admin/users/users-response.ts
deleted file mode 100644
index 3a587776..00000000
--- a/src/app/model/webapi/knora/admin/users/users-response.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright © 2017 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer, Sepideh Alassi.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-import {User} from './user';
-
-@JsonObject
-export class UsersResponse {
-
- @JsonProperty('users', [User])
- public users: User[] = undefined;
-
-}
diff --git a/src/app/model/webapi/knora/index.ts b/src/app/model/webapi/knora/index.ts
index f7eccb86..2f2ebe90 100644
--- a/src/app/model/webapi/knora/index.ts
+++ b/src/app/model/webapi/knora/index.ts
@@ -12,23 +12,9 @@
* License along with SALSAH. If not, see .
* */
-/**
- * Interfaces for Admin
- */
-export * from './admin/index';
-
/**
* Interfaces for V1
*/
export * from './v1/index';
-
-/**
- * Interfaces for V2
- */
-export * from './v2/index';
-
-
-
-
diff --git a/src/app/model/webapi/knora/v1/authenticate/authenticate.ts b/src/app/model/webapi/knora/v1/authenticate/authenticate.ts
index 4ecd11b2..9e41784b 100644
--- a/src/app/model/webapi/knora/v1/authenticate/authenticate.ts
+++ b/src/app/model/webapi/knora/v1/authenticate/authenticate.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from 'json2typescript';
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('Authenticate')
export class Authenticate {
@JsonProperty('status', Number)
diff --git a/src/app/model/webapi/knora/v1/authenticate/session.ts b/src/app/model/webapi/knora/v1/authenticate/session.ts
index 2f545648..3df8bfe4 100644
--- a/src/app/model/webapi/knora/v1/authenticate/session.ts
+++ b/src/app/model/webapi/knora/v1/authenticate/session.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from 'json2typescript';
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('Session')
export class Session {
@JsonProperty('status', Number)
diff --git a/src/app/model/webapi/knora/v1/properties/properties.ts b/src/app/model/webapi/knora/v1/properties/properties.ts
index e2e58162..d674ae48 100644
--- a/src/app/model/webapi/knora/v1/properties/properties.ts
+++ b/src/app/model/webapi/knora/v1/properties/properties.ts
@@ -12,10 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {PropertyItem} from "./property-item";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { PropertyItem } from './property-item';
-@JsonObject
+@JsonObject('Properties')
export class Properties {
@JsonProperty('properties', [PropertyItem])
diff --git a/src/app/model/webapi/knora/v1/properties/property-item.ts b/src/app/model/webapi/knora/v1/properties/property-item.ts
index 07f1c83a..dd7cb2d9 100644
--- a/src/app/model/webapi/knora/v1/properties/property-item.ts
+++ b/src/app/model/webapi/knora/v1/properties/property-item.ts
@@ -14,7 +14,7 @@
import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('PropertyItem')
export class PropertyItem {
@JsonProperty('name', String)
@@ -53,28 +53,28 @@ export class PropertyItem {
@JsonProperty('is_annotation', String)
public is_annotation: string = undefined;
-
+
@JsonProperty('locations', [Location], true)
public locations: Location[] = undefined;
-
+
@JsonProperty('regular_property', Number)
public regular_property: number = undefined;
-
+
@JsonProperty('value_firstprops', [String], true)
public value_firstprops: string[] = undefined;
-
+
@JsonProperty('value_iconsrcs', [String], true)
public value_iconsrcs: string[] = undefined;
-
+
@JsonProperty('value_ids', [String], true)
public value_ids: string[] = undefined;
-
+
@JsonProperty('value_restype', [String], true)
public value_restype: string[] = undefined;
-
+
@JsonProperty('value_rights', [Number], true)
public value_rights: Number[] = undefined;
-
+
@JsonProperty('values', [Object], true)
public values: any[] = undefined;
*/
diff --git a/src/app/model/webapi/knora/v1/resource-types/resource-type-info.ts b/src/app/model/webapi/knora/v1/resource-types/resource-type-info.ts
index ad8e3082..4d5ff156 100644
--- a/src/app/model/webapi/knora/v1/resource-types/resource-type-info.ts
+++ b/src/app/model/webapi/knora/v1/resource-types/resource-type-info.ts
@@ -12,11 +12,11 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {PropertyItem} from "../properties/property-item";
-import {Permissions} from "../../../../test-data/basic-ontology";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { PropertyItem } from '../properties/property-item';
+import { Permissions } from '../../../../test-data/basic-ontology';
-@JsonObject
+@JsonObject('ResourceTypeInfo')
export class ResourceTypeInfo {
@JsonProperty('name', String)
diff --git a/src/app/model/webapi/knora/v1/resource-types/resource-type-item.ts b/src/app/model/webapi/knora/v1/resource-types/resource-type-item.ts
index 55669c0d..68f8d9e6 100644
--- a/src/app/model/webapi/knora/v1/resource-types/resource-type-item.ts
+++ b/src/app/model/webapi/knora/v1/resource-types/resource-type-item.ts
@@ -12,10 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {ResourceTypeProperty} from "./resource-type-property";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { ResourceTypeProperty } from './resource-type-property';
-@JsonObject
+@JsonObject('ResourceTypeItem')
export class ResourceTypeItem {
@JsonProperty('id', String)
diff --git a/src/app/model/webapi/knora/v1/resource-types/resource-type-property.ts b/src/app/model/webapi/knora/v1/resource-types/resource-type-property.ts
index 4387c291..2459f075 100644
--- a/src/app/model/webapi/knora/v1/resource-types/resource-type-property.ts
+++ b/src/app/model/webapi/knora/v1/resource-types/resource-type-property.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('ResourceTypeProperty')
export class ResourceTypeProperty {
@JsonProperty('id', String)
diff --git a/src/app/model/webapi/knora/v1/resource-types/resource-type.ts b/src/app/model/webapi/knora/v1/resource-types/resource-type.ts
index 856eda6a..9575110a 100644
--- a/src/app/model/webapi/knora/v1/resource-types/resource-type.ts
+++ b/src/app/model/webapi/knora/v1/resource-types/resource-type.ts
@@ -12,11 +12,11 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {ResourceTypeInfo} from "./resource-type-info";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { ResourceTypeInfo } from './resource-type-info';
-@JsonObject
+@JsonObject('ResourceType')
export class ResourceType {
@JsonProperty('restype_info', ResourceTypeInfo)
public restype_info: ResourceTypeInfo = undefined;
diff --git a/src/app/model/webapi/knora/v1/resource-types/resource-types.ts b/src/app/model/webapi/knora/v1/resource-types/resource-types.ts
index cbe93981..2ac1a1fd 100644
--- a/src/app/model/webapi/knora/v1/resource-types/resource-types.ts
+++ b/src/app/model/webapi/knora/v1/resource-types/resource-types.ts
@@ -13,11 +13,11 @@
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {ResourceTypeItem} from "./resource-type-item";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { ResourceTypeItem } from './resource-type-item';
-@JsonObject
+@JsonObject('ResourceTypes')
export class ResourceTypes {
@JsonProperty('resourcetypes', [ResourceTypeItem])
diff --git a/src/app/model/webapi/knora/v1/resources/incoming-resource.ts b/src/app/model/webapi/knora/v1/resources/incoming-resource.ts
index 7eb0d148..bb64553e 100644
--- a/src/app/model/webapi/knora/v1/resources/incoming-resource.ts
+++ b/src/app/model/webapi/knora/v1/resources/incoming-resource.ts
@@ -12,11 +12,11 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {ResourceInfo} from "./resource-info";
-import {ResourceId} from "./resource-id";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { ResourceInfo } from './resource-info';
+import { ResourceId } from './resource-id';
-@JsonObject
+@JsonObject('IncomingResource')
export class IncomingResource {
@JsonProperty('ext_res_id', ResourceId)
diff --git a/src/app/model/webapi/knora/v1/resources/location.ts b/src/app/model/webapi/knora/v1/resources/location.ts
index 4649b3ce..353a03ec 100644
--- a/src/app/model/webapi/knora/v1/resources/location.ts
+++ b/src/app/model/webapi/knora/v1/resources/location.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('Location')
export class Location {
@JsonProperty('duration', Number)
@@ -42,4 +42,3 @@ export class Location {
public protocol: string = undefined;
}
-
\ No newline at end of file
diff --git a/src/app/model/webapi/knora/v1/resources/region.ts b/src/app/model/webapi/knora/v1/resources/region.ts
index 6617a2da..c45501e0 100644
--- a/src/app/model/webapi/knora/v1/resources/region.ts
+++ b/src/app/model/webapi/knora/v1/resources/region.ts
@@ -12,11 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('Region')
export class Region {
}
-
\ No newline at end of file
diff --git a/src/app/model/webapi/knora/v1/resources/resource-data.ts b/src/app/model/webapi/knora/v1/resources/resource-data.ts
index 3882e6f0..d82e5fbf 100644
--- a/src/app/model/webapi/knora/v1/resources/resource-data.ts
+++ b/src/app/model/webapi/knora/v1/resources/resource-data.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('ResourceData')
export class ResourceData {
@JsonProperty('restype_label', String)
@@ -32,4 +32,3 @@ export class ResourceData {
@JsonProperty('res_id', String)
public res_id: string = undefined;
}
-
\ No newline at end of file
diff --git a/src/app/model/webapi/knora/v1/resources/resource-id.ts b/src/app/model/webapi/knora/v1/resources/resource-id.ts
index a573b54c..6097571c 100644
--- a/src/app/model/webapi/knora/v1/resources/resource-id.ts
+++ b/src/app/model/webapi/knora/v1/resources/resource-id.ts
@@ -12,10 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from 'json2typescript';
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('ResourceId')
export class ResourceId {
@JsonProperty('id', String)
public id: string = undefined;
diff --git a/src/app/model/webapi/knora/v1/resources/resource-info.ts b/src/app/model/webapi/knora/v1/resources/resource-info.ts
index 746bfba6..dc102108 100644
--- a/src/app/model/webapi/knora/v1/resources/resource-info.ts
+++ b/src/app/model/webapi/knora/v1/resources/resource-info.ts
@@ -12,11 +12,11 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {Region} from "./region";
-import {Location} from "./location";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { Region } from './region';
+import { Location } from './location';
-@JsonObject
+@JsonObject('ResourceInfo')
export class ResourceInfo {
@JsonProperty('locations', [Location])
@@ -68,4 +68,3 @@ export class ResourceInfo {
public restype_id: string = undefined;
}
-
\ No newline at end of file
diff --git a/src/app/model/webapi/knora/v1/resources/resource-property.ts b/src/app/model/webapi/knora/v1/resources/resource-property.ts
index fbfd5538..db39eab3 100644
--- a/src/app/model/webapi/knora/v1/resources/resource-property.ts
+++ b/src/app/model/webapi/knora/v1/resources/resource-property.ts
@@ -12,10 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {Location} from './location'
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { Location } from './location'
-@JsonObject
+@JsonObject('ResourceProperty')
export class ResourceProperty {
@JsonProperty('regular_property', Number)
diff --git a/src/app/model/webapi/knora/v1/resources/resource.ts b/src/app/model/webapi/knora/v1/resources/resource.ts
index 58411ab4..4b00ab9d 100644
--- a/src/app/model/webapi/knora/v1/resources/resource.ts
+++ b/src/app/model/webapi/knora/v1/resources/resource.ts
@@ -12,14 +12,14 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {ResourceInfo} from "./resource-info";
-import {ResourceData} from "./resource-data";
-import {IncomingResource} from "./incoming-resource";
-import {PropertyItem} from "../properties/property-item";
-import {ResourceProperty} from "./resource-property";
-
-@JsonObject
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { ResourceInfo } from './resource-info';
+import { ResourceData } from './resource-data';
+import { IncomingResource } from './incoming-resource';
+import { PropertyItem } from '../properties/property-item';
+import { ResourceProperty } from './resource-property';
+
+@JsonObject('Resource')
export class Resource {
@JsonProperty('resinfo', ResourceInfo)
diff --git a/src/app/model/webapi/knora/v1/search/paging.ts b/src/app/model/webapi/knora/v1/search/paging.ts
index 05a6dcd1..fb80c041 100644
--- a/src/app/model/webapi/knora/v1/search/paging.ts
+++ b/src/app/model/webapi/knora/v1/search/paging.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('Paging')
export class Paging {
@JsonProperty('current', Boolean)
diff --git a/src/app/model/webapi/knora/v1/search/search.ts b/src/app/model/webapi/knora/v1/search/search.ts
index 6ef66847..f2f1d7b8 100644
--- a/src/app/model/webapi/knora/v1/search/search.ts
+++ b/src/app/model/webapi/knora/v1/search/search.ts
@@ -12,13 +12,13 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
-import {ThumbMax} from "./thumbMax";
-import {Paging} from "./paging";
-import {Subject} from "./subject";
+import { JsonObject, JsonProperty } from 'json2typescript';
+import { ThumbMax } from './thumbMax';
+import { Paging } from './paging';
+import { Subject } from './subject';
-@JsonObject
+@JsonObject('Search')
export class Search {
@JsonProperty('subjects', [Subject])
diff --git a/src/app/model/webapi/knora/v1/search/subject.ts b/src/app/model/webapi/knora/v1/search/subject.ts
index d7de8cd8..b45ff67c 100644
--- a/src/app/model/webapi/knora/v1/search/subject.ts
+++ b/src/app/model/webapi/knora/v1/search/subject.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('Subject')
export class Subject {
@JsonProperty('iconlabel', String)
@@ -50,4 +50,4 @@ export class Subject {
@JsonProperty('valuelabel', [String])
public valuelabel: string[] = undefined;
-}
\ No newline at end of file
+}
diff --git a/src/app/model/webapi/knora/v1/search/thumbMax.ts b/src/app/model/webapi/knora/v1/search/thumbMax.ts
index 7367fe0c..72bc6ba0 100644
--- a/src/app/model/webapi/knora/v1/search/thumbMax.ts
+++ b/src/app/model/webapi/knora/v1/search/thumbMax.ts
@@ -12,9 +12,9 @@
* License along with SALSAH. If not, see .
* */
-import {JsonObject, JsonProperty} from "json2typescript";
+import { JsonObject, JsonProperty } from 'json2typescript';
-@JsonObject
+@JsonObject('ThumbMax')
export class ThumbMax {
@JsonProperty('nx', Number)
@@ -23,4 +23,3 @@ export class ThumbMax {
@JsonProperty('ny', Number)
public ny: number = undefined;
}
-
\ No newline at end of file
diff --git a/src/app/model/webapi/knora/v2/convert-jsonld.spec.ts b/src/app/model/webapi/knora/v2/convert-jsonld.spec.ts
deleted file mode 100644
index b65c33db..00000000
--- a/src/app/model/webapi/knora/v2/convert-jsonld.spec.ts
+++ /dev/null
@@ -1,679 +0,0 @@
-import {async} from '@angular/core/testing';
-import {ConvertJSONLD} from './convert-jsonld';
-import {ReadResourcesSequence} from './read-resources-sequence';
-import {ReadResource} from './read-resource';
-import {
- ReadBooleanValue, ReadColorValue, ReadDateValue, ReadDecimalValue, ReadIntegerValue, ReadIntervalValue,
- ReadLinkValue, ReadListValue, ReadTextValueAsHtml,
- ReadTextValueAsString, ReadTextValueAsXml, ReadUriValue
-} from './read-property-item';
-import {ReadProperties} from './read-properties';
-
-describe('ConvertJSONLD', () => {
-
- it('parse a JSON-LD document representing letter 176-O', async(() => {
-
- const jsonld = require('jsonld');
-
- // http://api.02.unibas.dasch.swiss/v2/resources/http%3A%2F%2Frdfh.ch%2F0801%2Fbeol%2F-0tI3HXgSSOeDtkf-SA00w
- const EulerLetter: any = require('../../../test-data/resources/EulerLetter_176-O.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(EulerLetter, {});
-
- promise.then((compacted) => {
-
- const receivedResource: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
-
- expect(receivedResource.numberOfResources).toEqual(1);
-
- const expectedProps: ReadProperties = {
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#creationDate': [
- new ReadDateValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/hg4D_yctTweaZ9vtCkDqnw',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#creationDate',
- 'GREGORIAN',
- 1756,
- 1756,
- 'CE',
- 'CE',
- 1,
- 1,
- 3,
- 3
- )],
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasAuthorValue': [
- new ReadLinkValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/dt3rgRFjTh-bG_kJPdV2Eg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasAuthorValue',
- 'http://rdfh.ch/0802/Vcd2vupmRuOserhk03c7Vw',
- new ReadResource(
- 'http://rdfh.ch/0802/Vcd2vupmRuOserhk03c7Vw',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Leonhard Euler',
- [],
- [],
- [],
- [],
- {}
- )
- )
- ],
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasRecipientValue': [
- new ReadLinkValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/2YYzj2uGTzeaKze3vScqRA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasRecipientValue',
- 'http://rdfh.ch/0802/shubb5TjTnu84MqkM6uHlA',
- new ReadResource(
- 'http://rdfh.ch/0802/shubb5TjTnu84MqkM6uHlA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Christian Goldbach',
- [],
- [],
- [],
- [],
- {}
- )
- )
- ],
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject': [
- new ReadListValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/eoyTM9yqT3maAV704FNZoQ',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject',
- 'http://rdfh.ch/lists/0801/other_quadratic_forms',
- 'Other quadratic forms'
- ),
- new ReadListValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/wKbQ86WkRtSOyQomLN3-GA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject',
- 'http://rdfh.ch/lists/0801/berlin_academy',
- 'Berlin Academy'
- ),
- new ReadListValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/NvANUAjVQXusdezLDIHlNg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject',
- 'http://rdfh.ch/lists/0801/other_professional_tasks',
- 'Other professional tasks'
- ),
- new ReadListValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/q67xf4J3RKe4Y_wNYyVanQ',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject',
- 'http://rdfh.ch/lists/0801/errands',
- 'Errands'
- ),
- new ReadListValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/PePWR2aVSueUZAvryhM8RQ',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject',
- 'http://rdfh.ch/lists/0801/book_trade_orders',
- 'Book trade, orders'
- ),
- new ReadListValue(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/NoeWmFy1TVyA0CGDTPVCsA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject',
- 'http://rdfh.ch/lists/0801/johann_albrecht_euler',
- 'Johann Albrecht Euler'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#letterHasLanguage': [
- new ReadTextValueAsString(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/I6jR1ifGQ8uy1BIT3mhgvw',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#letterHasLanguage',
- 'German'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasText': [
- new ReadTextValueAsHtml(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg/values/vnfi65mrQBue7OmI5wonvA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#hasText',
- '\n
\n \n
Hochwohlgebohrner Herr
\n \n
Hochgeehrtester Herr Etats Rath\n
\n \n
Bey dem Antritt dieses neuen Jahrs lege ich zuvorderst meinen herzlichsten Wunsch\n für das beständige Wohlseyn Eur. Hochwohlgeb. ab, und empfehle mich dabey gehorsamst\n sammt den meinigen zu Dero fortdaurenden Wohlgewogenheit\\(\\,.\\,\\) Zugleich statte ich auch Eur. Hochwohlgeb. meine verpflichtetste Danksagung ab für\n den gütigen Antheil welchen Dieselben an unserem Zustand zu nehmen belieben und habe\n das Vergnügen Eur. Hochwohlgeb. zu berichten, daß S[ein]\\(\\,{}^{\\text{e}}\\,\\) Königl[iche] Majestät bey dem Anfang dieses Jahrs Dero Pathen unsern ältesten Sohn mit einer jährlichen\n Besoldung von \\(\\,200\\,\\) Rthl. begnadiget.1
\n \n
Ich habe nun schon eine geraume Zeit so viel andere Geschäfte gehabt daß ich an numeri sche Theoremata , dergleichen ich Eur. Hochwohlgeb. das letste mal vorzulegen die Ehre gehabt, nicht\n habe denken können. Die Partes Matheseos applicatae nehmen mir die meiste Zeit weg, wo es immer mehr zu untersuchen gibt, je mehr man\n damit umgeht.2
\n \n
Weil nun mein Kopf mit so viel anderen Sachen angefüllet ist, so mag das wohl die\n Ursache seyn, daß ich mich in das von Eur. Hochwohlgeb. communicir te und nach der Hand verbesserte Theorema nicht finden kan. Vielleicht haben Eur. Hochwohlgeb. vergessen noch eine wesentliche\n Condition hinzuzusetzen.3
\n \n
Das Theorema war: Si sit \\(\\,aa+bb=P^{2}+eQ^{2}\\,\\) erit etiam
\n \n
\n \\(\\,a^{2}+\\left(\\left(2e+1\\right)b-eP-eQ\\right)^{2}=M^{2}+eN^{2}\\text{;}\\,\\) \n \n
\n \n
weil ich den Grund desselben nicht einsehen konnte, so habe ich die Richtigkeit desselben\n durch Exempel erforschen wollen.\n
\n \n
I. Da \\(\\,1^{2}+4^{2}=17=3^{2}+2\\cdot 2^{2}\\,\\) , so ist \\(\\,a=1\\,\\) , \\(\\,b=4\\,\\) , \\(\\,P=3\\,\\) , \\(\\,Q=2\\,\\) und \\(\\,e=2\\,\\) , allso müste seyn\n
\n \n
\n \\(\\,1^{2}+\\left(5\\cdot 4-2\\cdot 3-2\\cdot 2\\right)^{2}=1^{2}+10^{2}=101=M^{2}+2N^{2}\\,\\) \n \n
\n \n
welches unmöglich ist.
\n \n
II. Da \\(\\,9^{2}+4^{2}=97=7^{2}+3\\cdot 4^{2}\\,\\) , so ist \\(\\,a=9\\,\\) ; \\(\\,b=4\\,\\) ; \\(\\,P=7\\,\\) ; \\(\\,Q=4\\,\\) und \\(\\,e=3\\,\\) , allso müsste seyn\n
\n \n
\n \\(\\,9^{2}+\\left(7\\cdot 4-3\\cdot 7-3\\cdot 4\\right)^{2}=9^{2}+5^{2}=106=M^{2}+3N^{2}\\,\\) \n \n
\n \n
welches ebenfalls unmöglich ist.
\n \n
Da ich nun nicht einmal ein Exempel finden kan, welches einträfe, so schliesse ich daraus, daß eine gewisse Bedingung\n in den Zahlen \\(\\,a\\,\\) , \\(\\,b\\,\\) , \\(\\,P\\,\\) und \\(\\,Q\\,\\) müsse weggelassen seyn, welche ich aber nicht ausfündig machen kan.4
\n \n
Ich habe dem H. Spener zu wissen gethan, daß Eur. Hochwohlgeb. die Rechnung für die überschickten Bücher\n verlangen; bekomme ich dieselbe vor Schliessung dieses Briefs, wie ich ihm habe sagen\n lassen, so werde ich sie beylegen.5
\n \n
Sonsten da er nicht alle verlangte Bücher gehabt, so werde ich inskünftige dergleichen\n Commission en dem M.\\(\\,{}^{\\text{r}}\\,\\) Neaulme , welcher weit activer ist und alles schaffen kan, auftragen. Wegen des Werks: La Clef du Cabinet des Princes füge hier die Antwort des M.\\(\\,{}^{\\text{r}}\\,\\) de Bourdeaux bey.6
\n \n
Sollte dasselbe vor der Ankunft einer Resolution von Eur. Hochwohlgeb. schon verkauft worden seyn, so hat sich M.\\(\\,{}^{\\text{r}}\\,\\) Neaulme anheischig gemacht, dasselbe auch zu liefern.\n
\n \n
Ich habe die Ehre mit der schuldigsten Hochachtung zu verharren
\n \n
Eur. Hochwohlgebohrnen
\n \n
gehorsamster Diener
\n \n
\n L. Euler \n \n
\n \n
Berlin den 3\\(\\,{}^{\\text{ten}}\\,\\) Januarii
\n \n
1756.
\n \n
\n Berlin, January 3rd, 1756 \n \n
\n \n
\n Original, 1 fol. – RGADA, f. 181, n. 1413, č. V, fol. 123rv \n \n
\n \n
\n Published: Correspondance (1843), t. I, p. 636–637; Euler-Goldbach (1965), p. 385–386 \n \n
\n \n
\n
\n
',
- {
- 'http://rdfh.ch/0801/f-2Ta0NRSBikdqXivSLuMw': new ReadResource(
- 'http://rdfh.ch/0801/f-2Ta0NRSBikdqXivSLuMw',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'L176 note-5',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0801/_vmiVEfoSw-BA2_Ppz2nPQ': new ReadResource(
- 'http://rdfh.ch/0801/_vmiVEfoSw-BA2_Ppz2nPQ',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'L176 note-3',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0801/0m02gFutQ7yEt559a2uOlg': new ReadResource(
- 'http://rdfh.ch/0801/0m02gFutQ7yEt559a2uOlg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'L176 note-2',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0801/sd6JbWUlTvig8vWIqZy6-Q': new ReadResource(
- 'http://rdfh.ch/0801/sd6JbWUlTvig8vWIqZy6-Q',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'L176 note-4',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0801/2BZx-h5vTcCXaqxaSXjoXA': new ReadResource(
- 'http://rdfh.ch/0801/2BZx-h5vTcCXaqxaSXjoXA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'L176 note-6',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0801/KPOPzTVLSdyxiScitUAyTQ': new ReadResource(
- 'http://rdfh.ch/0801/KPOPzTVLSdyxiScitUAyTQ',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#endnote',
- 'L176 note-1',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/BqZGx2KmRS2mIMK_DUxapg': new ReadResource(
- 'http://rdfh.ch/0802/BqZGx2KmRS2mIMK_DUxapg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Friedrich II.',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/UWsNivv1R46modSygvjOLA': new ReadResource(
- 'http://rdfh.ch/0802/UWsNivv1R46modSygvjOLA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Jean Neaulme',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/CKzU513NSWyVhwe0gpbMWg': new ReadResource(
- 'http://rdfh.ch/0802/CKzU513NSWyVhwe0gpbMWg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Johann Carl (the Elder) Spener',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/shgx0f71R66N_noFNc3gkg': new ReadResource(
- 'http://rdfh.ch/0802/shgx0f71R66N_noFNc3gkg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Johann Albrecht Euler',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/iJK4gffNTW-18RsNf8JLbA': new ReadResource(
- 'http://rdfh.ch/0802/iJK4gffNTW-18RsNf8JLbA',
- 'http://0.0.0.0:3333/ontology/0802/biblio/v2#Book',
- 'Jordancl 1704',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/Hju9FefOQ5KgnXUHnYqUVA': new ReadResource(
- 'http://rdfh.ch/0802/Hju9FefOQ5KgnXUHnYqUVA',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Claude Jordan',
- [],
- [],
- [],
- [],
- {}
- ),
- 'http://rdfh.ch/0802/6dLVf6BjRPCmndIwhFZLEw': new ReadResource(
- 'http://rdfh.ch/0802/6dLVf6BjRPCmndIwhFZLEw',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#person',
- 'Etienne de Bourdeaux',
- [],
- [],
- [],
- [],
- {}
- )
- },
- )
- ]
- };
-
- const EulerLetterResourceExpected = new ReadResource(
- 'http://rdfh.ch/0801/j4BrggcKS0CltUf1Ssl9Jg',
- 'http://0.0.0.0:3333/ontology/0801/beol/v2#letter',
- 'L176 Original',
- [],
- [],
- [],
- [],
- expectedProps
- );
-
- expect(receivedResource.resources[0].id).toEqual(EulerLetterResourceExpected.id);
-
- expect(receivedResource.resources[0].type).toEqual(EulerLetterResourceExpected.type);
-
- expect(receivedResource.resources[0].label).toEqual(EulerLetterResourceExpected.label);
-
- expect(receivedResource.resources[0].properties['http://0.0.0.0:3333/ontology/0801/beol/v2#creationDate']).toEqual(EulerLetterResourceExpected.properties['http://0.0.0.0:3333/ontology/0801/beol/v2#creationDate']);
-
- expect(receivedResource.resources[0].properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasAuthorValue']).toEqual(EulerLetterResourceExpected.properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasAuthorValue']);
-
- expect(receivedResource.resources[0].properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasRecipientValue']).toEqual(EulerLetterResourceExpected.properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasRecipientValue']);
-
- expect(receivedResource.resources[0].properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject']).toEqual(EulerLetterResourceExpected.properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasSubject']);
-
- expect(receivedResource.resources[0].properties['http://0.0.0.0:3333/ontology/0801/beol/v2#letterHasLanguage']).toEqual(EulerLetterResourceExpected.properties['http://0.0.0.0:3333/ontology/0801/beol/v2#letterHasLanguage']);
-
- expect(receivedResource.resources[0].properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasText']).toEqual(EulerLetterResourceExpected.properties['http://0.0.0.0:3333/ontology/0801/beol/v2#hasText']);
-
- });
- }));
-
-
- it('parse a JSON-LD document representing a thing', async(() => {
-
- const jsonld = require('jsonld');
-
- // http://localhost:3333/v2/resources/http%3A%2F%2Frdfh.ch%2F0001%2FH6gBWUuJSuuO-CilHV8kQw
- const thing: any = require('../../../test-data/resources/Testthing.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(thing, {});
-
- promise.then((compacted) => {
-
- const receivedResource: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
-
- expect(receivedResource.numberOfResources).toEqual(1);
-
- const expectedProps: ReadProperties = {
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean': [
- new ReadBooleanValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/IN4R19yYR0ygi3K2VEHpUQ',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasBoolean',
- true
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor': [
- new ReadColorValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/TAziKNP8QxuyhC4Qf9-b6w',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor',
- '#ff3333'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate': [
- new ReadDateValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/-rG4F5FTTu2iB5mTBPVn5Q',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate',
- 'GREGORIAN',
- 2018,
- 2018,
- 'CE',
- 'CE',
- 5,
- 5,
- 13,
- 13
- )],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal': [
- new ReadDecimalValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/bXMwnrHvQH2DMjOFrGmNzg',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasDecimal',
- 1.5
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger': [
- new ReadIntegerValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/dJ1ES8QTQNepFKF5-EAqdg',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInteger',
- 1
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval': [
- new ReadIntervalValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/RbDKPKHWTC-0lkRKae-E6A',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval',
- 0,
- 216000
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem': [
- new ReadListValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/XAhEeE3kSVqM4JPGdLt4Ew',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem',
- 'http://rdfh.ch/lists/0001/treeList01',
- 'Tree list node 01'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem': [
- new ReadListValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/j8VQjbD0RsyxpyuvfFJCDA',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem',
- 'http://rdfh.ch/lists/0001/otherTreeList01',
- 'Other Tree list node 01'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue': [
- new ReadLinkValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/uvRVxzL1RD-t9VIQ1TpfUw',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherThingValue',
- 'http://rdfh.ch/0001/0C-0L1kORryKzJAJxxRyRQ',
- new ReadResource(
- 'http://rdfh.ch/0001/0C-0L1kORryKzJAJxxRyRQ',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#Thing',
- 'Sierra',
- [],
- [],
- [],
- [],
- {}
- )
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext': [
- new ReadTextValueAsXml(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/rvB4eQ5MTF-Qxq0YgkwaDg',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext',
- '\ntest with markup
',
- 'http://rdfh.ch/standoff/mappings/StandardMapping'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasText': [
- new ReadTextValueAsString(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/SZyeLLmOTcCCuS3B0VksHQ',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasText',
- 'test'
- )
- ],
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri': [
- new ReadUriValue(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/uBAmWuRhR-eo1u1eP7qqNg',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri',
- 'http://www.google.ch'
- )
- ]
-
- };
-
- const ThingResourceExpected = new ReadResource(
- 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw',
- 'http://0.0.0.0:3333/ontology/0001/anything/v2#Thing',
- 'testding',
- [],
- [],
- [],
- [],
- expectedProps
- );
-
- expect(receivedResource.resources[0]).toEqual(ThingResourceExpected);
-
- });
- }));
-
- it('parse a JSON-LD document representing a list of resources', async(() => {
-
- const jsonld = require('jsonld');
-
- // http://localhost:3333/v2/search/Narr?limitToProject=http%3A%2F%2Frdfh.ch%2Fprojects%2F0803
- const resultsForEuler: any = require('../../../test-data/resources/SearchResultNarr.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(resultsForEuler, {});
-
- promise.then((compacted) => {
-
- const receivedResource: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
-
- expect(receivedResource.numberOfResources).toEqual(25);
-
- expect(receivedResource.resources.length).toEqual(25);
-
- });
- }));
-
- it('parse a JSON-LD document representing a book with incoming pages containing the source as a value object', async(() => {
-
- const jsonld = require('jsonld');
-
- // see Knora: webapi/src/test/resources/test-data/searchR2RV2/bookWithIncomingPagesOnlyLink.jsonld
- const resultsForBookWithIncomingLink: any = require('../../../test-data/resources/BookWithIncomingPages.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(resultsForBookWithIncomingLink, {});
-
- promise.then((compacted) => {
-
- const receivedResource: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
-
- expect(receivedResource.numberOfResources).toEqual(1);
-
- const expectedProps: ReadProperties = {
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#title': [
- new ReadTextValueAsString(
- 'http://rdfh.ch/8be1b7cf7103/values/463b6498b70d',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#title',
- '[Das] Narrenschiff (lat.)'
- ),
- new ReadTextValueAsString(
- 'http://rdfh.ch/8be1b7cf7103/values/0965b7d1b70d',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#title',
- 'Stultifera navis (...)'
- )
- ],
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink': [
- new ReadLinkValue(
- 'http://rdfh.ch/50e7460a7203/values/8bdc04c8-b765-44c8-adb3-5ab536dcd051',
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink',
- 'http://rdfh.ch/50e7460a7203',
- new ReadResource(
- 'http://rdfh.ch/50e7460a7203',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#page',
- 'vorderer Spiegel',
- [],
- [],
- [],
- [],
- {
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#partOfValue': [
- new ReadLinkValue(
- 'http://rdfh.ch/50e7460a7203/values/8bdc04c8-b765-44c8-adb3-5ab536dcd051',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#partOfValue',
- 'http://rdfh.ch/8be1b7cf7103'
- )
- ]
- }
- )
- )
- ]
- };
-
- const BookResourceWithIncomingExpected = new ReadResource(
- 'http://rdfh.ch/8be1b7cf7103',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#book',
- '[Das] Narrenschiff (lat.)',
- [],
- [],
- [],
- [],
- expectedProps
- );
-
- expect(receivedResource.resources[0]).toEqual(BookResourceWithIncomingExpected);
-
- });
- }));
-
- it('parse a JSON-LD document representing a book with incoming pages referring to the source via its Iri', async(() => {
-
- const jsonld = require('jsonld');
-
- // see Knora: webapi/src/test/resources/test-data/searchR2RV2/bookWithIncomingPagesOnlyLink.jsonld
- // not that the source is represented as an Iri only
- const resultsForBookWithIncomingLink: any = require('../../../test-data/resources/BookWithIncomingPages2.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(resultsForBookWithIncomingLink, {});
-
- promise.then((compacted) => {
-
- const receivedResource: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
-
- expect(receivedResource.numberOfResources).toEqual(1);
-
- const expectedProps: ReadProperties = {
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#title': [
- new ReadTextValueAsString(
- 'http://rdfh.ch/8be1b7cf7103/values/463b6498b70d',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#title',
- '[Das] Narrenschiff (lat.)'
- ),
- new ReadTextValueAsString(
- 'http://rdfh.ch/8be1b7cf7103/values/0965b7d1b70d',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#title',
- 'Stultifera navis (...)'
- )
- ],
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink': [
- new ReadLinkValue(
- 'http://rdfh.ch/50e7460a7203/values/8bdc04c8-b765-44c8-adb3-5ab536dcd051',
- 'http://api.knora.org/ontology/knora-api/v2#hasIncomingLink',
- 'http://rdfh.ch/50e7460a7203'
- )
- ]
- };
-
- const BookResourceWithIncomingExpected = new ReadResource(
- 'http://rdfh.ch/8be1b7cf7103',
- 'http://0.0.0.0:3333/ontology/0803/incunabula/v2#book',
- '[Das] Narrenschiff (lat.)',
- [],
- [],
- [],
- [],
- expectedProps
- );
-
- expect(receivedResource.resources[0]).toEqual(BookResourceWithIncomingExpected);
-
- });
- }));
-
- it('parse a JSON-LD document representing a collection of resources and get the Iris of the resource classes contained in it', async(() => {
-
- const jsonld = require('jsonld');
-
- // localhost:3333/v2/search/Holzschnitt
- const resultsForHolzschnitt: any = require('../../../test-data/resources/SearchForHolzschnitt.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(resultsForHolzschnitt, {});
-
- promise.then((compacted) => {
-
- const resClasses = ConvertJSONLD.getResourceClassesFromJsonLD(compacted);
-
- const expectedResClasses = ['http://0.0.0.0:3333/ontology/0803/incunabula/v2#page', 'http://api.knora.org/ontology/knora-api/v2#Region', 'http://api.knora.org/ontology/knora-api/v2#LinkObj'];
-
- expect(resClasses).toEqual(expectedResClasses);
-
- });
- }));
-
- it('parse a JSON-LD document representing one resource and get its resource classes ', async(() => {
-
- const jsonld = require('jsonld');
-
- // http://localhost:3333/v2/resources/http%3A%2F%2Frdfh.ch%2F0001%2FH6gBWUuJSuuO-CilHV8kQw
- const testThing: any = require('../../../test-data/resources/Testthing.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(testThing, {});
-
- promise.then((compacted) => {
-
- const resClasses = ConvertJSONLD.getResourceClassesFromJsonLD(compacted);
-
- const expectedResClasses = ['http://0.0.0.0:3333/ontology/0001/anything/v2#Thing'];
-
- expect(resClasses).toEqual(expectedResClasses);
-
- });
- }));
-
- it('parse a JSON-LD document representing an empty response', async(() => {
-
- const jsonld = require('jsonld');
-
- const empty = require('../../../test-data/resources/emptyResponse.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(empty, {});
-
- promise.then((compacted) => {
-
- const receivedResource: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
-
- expect(receivedResource.numberOfResources).toEqual(0);
-
- expect(receivedResource.resources.length).toEqual(0);
-
-
- });
- }));
-
- it('parse a JSON-LD document and try to get resource class Iris from an empty response', async(() => {
-
- const jsonld = require('jsonld');
-
- const empty = require('../../../test-data/resources/emptyResponse.json');
-
- const promises = jsonld.promises;
- // compact JSON-LD using an empty context: expands all Iris
- const promise = promises.compact(empty, {});
-
- promise.then((compacted) => {
-
- const resClasses: string[] = ConvertJSONLD.getResourceClassesFromJsonLD(compacted);
-
- expect(resClasses.length).toEqual(0);
-
-
- });
- }));
-
-
-});
diff --git a/src/app/model/webapi/knora/v2/convert-jsonld.ts b/src/app/model/webapi/knora/v2/convert-jsonld.ts
deleted file mode 100644
index a003d039..00000000
--- a/src/app/model/webapi/knora/v2/convert-jsonld.ts
+++ /dev/null
@@ -1,514 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {ReadResourcesSequence} from "./read-resources-sequence";
-import {ReadResource} from "./read-resource";
-import {ReadProperties} from "./read-properties";
-import {
- ReadBooleanValue,
- ReadColorValue,
- ReadDateValue,
- ReadDecimalValue,
- ReadGeomValue,
- ReadIntegerValue, ReadIntervalValue,
- ReadLinkValue, ReadListValue,
- ReadPropertyItem,
- ReadStillImageFileValue, ReadTextFileValue,
- ReadTextValueAsHtml,
- ReadTextValueAsString,
- ReadTextValueAsXml, ReadUriValue,
- ReferredResourcesByStandoffLink
-} from './read-property-item';
-import {AppConfig} from "../../../../app.config";
-import {Utils} from "../../../../utils";
-
-declare let require: any; // http://stackoverflow.com/questions/34730010/angular2-5-minute-install-bug-require-is-not-defined
-let jsonld = require('jsonld');
-
-export module ConvertJSONLD {
-
- /**
- * Gets property names and filters out all non property names.
- * Gets all members that have to be treated as value objects.
- */
- const getPropertyNames = (propName) => {
- return propName !== '@id' && propName !== '@type' && propName !== AppConfig.RdfsLabel && propName !== AppConfig.attachedToProject && propName !== AppConfig.attachedToUser && propName !== AppConfig.creationDate && propName !== AppConfig.lastModificationDate && propName !== AppConfig.hasPermissions;
- };
-
- /**
- * Construct a [[ReadResource]] from JSON-LD.
- *
- * @param resourceJSONLD an object describing the resource and its properties.
- * @returns a [[ReadResource]]
- */
- function constructReadResource(resourceJSONLD: Object): ReadResource {
-
- let properties: ReadProperties = constructReadProperties(resourceJSONLD);
-
- return new ReadResource(
- resourceJSONLD['@id'],
- resourceJSONLD['@type'],
- resourceJSONLD[AppConfig.RdfsLabel],
- [],
- [],
- [],
- [],
- properties
- );
- }
-
- /**
- * Constructs a [[ReadPropertyItem]] from JSON-LD.
- *
- * @param propValue the value serialized as JSON-LD.
- * @param propIri the Iri of the property.
- * @param standoffLinkValues standoffLinkValues of the resource.
- * @returns a [[ReadPropertyItem]] or `undefined` in case the value could not be processed correctly.
- */
- function createValueSpecificProp(propValue: Object, propIri: string, standoffLinkValues: ReadLinkValue[]): ReadPropertyItem | undefined {
-
- // convert a JSON-LD property value to a `ReadPropertyItem`
-
- let valueSpecificProp: ReadPropertyItem;
-
- // check for the property's value type
- switch (propValue['@type']) {
- case AppConfig.TextValue:
- // a text value might be given as plain string, html or xml.
- let textValue: ReadPropertyItem;
-
- if (propValue[AppConfig.valueAsString] !== undefined) {
- textValue = new ReadTextValueAsString(propValue['@id'], propIri, propValue[AppConfig.valueAsString]);
- } else if (propValue[AppConfig.textValueAsHtml] !== undefined) {
-
- let referredResources: ReferredResourcesByStandoffLink = {};
-
- // check for standoff links and include referred resources, if any
- // when the user interacts with a standoff link, further information about the referred resource can be shown
- for (let standoffLink of standoffLinkValues) {
- let referredRes: ReadResource = standoffLink.referredResource;
- referredResources[referredRes.id] = referredRes;
- }
-
- textValue = new ReadTextValueAsHtml(propValue['@id'], propIri, propValue[AppConfig.textValueAsHtml], referredResources);
- } else if (propValue[AppConfig.textValueAsXml] !== undefined && propValue[AppConfig.textValueHasMapping] !== undefined) {
- textValue = new ReadTextValueAsXml(propValue['@id'], propIri, propValue[AppConfig.textValueAsXml], propValue[AppConfig.textValueHasMapping]);
- } else {
- // expected text value members not defined
- console.log("ERROR: Invalid text value: " + JSON.stringify(propValue))
- }
-
- valueSpecificProp = textValue;
- break;
-
- case AppConfig.DateValue:
- let dateValue = new ReadDateValue(propValue['@id'],
- propIri,
- propValue[AppConfig.dateValueHasCalendar],
- propValue[AppConfig.dateValueHasStartYear],
- propValue[AppConfig.dateValueHasEndYear],
- propValue[AppConfig.dateValueHasStartEra],
- propValue[AppConfig.dateValueHasEndEra],
- propValue[AppConfig.dateValueHasStartMonth],
- propValue[AppConfig.dateValueHasEndMonth],
- propValue[AppConfig.dateValueHasStartDay],
- propValue[AppConfig.dateValueHasEndDay]);
-
- valueSpecificProp = dateValue;
- break;
-
- case AppConfig.LinkValue:
-
- let linkValue: ReadLinkValue;
-
- // check if the referred resource is given as an object or just as an IRI
- if (propValue[AppConfig.linkValueHasTarget] !== undefined) {
- // linkValueHasTarget contains the object
-
- let referredResource: ReadResource = constructReadResource(propValue[AppConfig.linkValueHasTarget]);
-
- linkValue = new ReadLinkValue(propValue['@id'], propIri, referredResource.id, referredResource);
- } else if (propValue[AppConfig.linkValueHasTargetIri] !== undefined) {
- // linkValueHasTargetIri contains the resource's Iri
-
- let referredResourceIri = propValue[AppConfig.linkValueHasTargetIri]['@id'];
-
- linkValue = new ReadLinkValue(propValue['@id'], propIri, referredResourceIri);
- } else if (propValue[AppConfig.linkValueHasSource] !== undefined) {
- // linkValueHasSource contains the object
-
- let incomingResource: ReadResource = constructReadResource(propValue[AppConfig.linkValueHasSource]);
-
- linkValue = new ReadLinkValue(propValue['@id'], propIri, incomingResource.id, incomingResource);
- } else if (propValue[AppConfig.linkValueHasSourceIri] !== undefined) {
- // linkValueHasSourceIri contains the resource's Iri
-
- let incomingResourceIri = propValue[AppConfig.linkValueHasSourceIri]['@id'];
-
- linkValue = new ReadLinkValue(propValue['@id'], propIri, incomingResourceIri);
- }
-
- valueSpecificProp = linkValue;
- break;
-
- case AppConfig.IntValue:
-
- let intValue = new ReadIntegerValue(propValue['@id'], propIri, propValue[AppConfig.integerValueAsInteger]);
- valueSpecificProp = intValue;
-
- break;
-
- case AppConfig.DecimalValue:
-
- // a decimal value is represented as a string in order to preserve its precision
- const decVal: number = parseFloat(propValue[AppConfig.decimalValueAsDecimal]['@value']);
-
- let decimalValue = new ReadDecimalValue(propValue['@id'], propIri, decVal);
- valueSpecificProp = decimalValue;
-
- break;
-
- case AppConfig.StillImageFileValue:
-
- let stillImageFileValue: ReadStillImageFileValue = new ReadStillImageFileValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.fileValueHasFilename],
- propValue[AppConfig.stillImageFileValueHasIIIFBaseUrl],
- propValue[AppConfig.fileValueAsUrl],
- propValue[AppConfig.stillImageFileValueHasDimX],
- propValue[AppConfig.stillImageFileValueHasDimY],
- propValue[AppConfig.fileValueIsPreview] // optional (may be undefined)
- );
-
- valueSpecificProp = stillImageFileValue;
-
- break;
-
- case AppConfig.TextFileValue:
-
- let textFileValue = new ReadTextFileValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.fileValueHasFilename],
- propValue[AppConfig.fileValueAsUrl]
- );
-
- valueSpecificProp = textFileValue;
-
- break;
-
- case AppConfig.ColorValue:
-
- let readColorValue: ReadColorValue = new ReadColorValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.colorValueAsColor]
- );
-
- valueSpecificProp = readColorValue;
-
- break;
-
- case AppConfig.GeomValue:
-
- let readGeomValue: ReadGeomValue = new ReadGeomValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.geometryValueAsGeometry]
- );
-
- valueSpecificProp = readGeomValue;
-
- break;
-
- case AppConfig.UriValue:
-
- let uriValue: ReadUriValue = new ReadUriValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.uriValueAsUri]['@value']
- );
-
- valueSpecificProp = uriValue;
-
- break;
-
- case AppConfig.BooleanValue:
-
- let boolValue: ReadBooleanValue = new ReadBooleanValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.booleanValueAsBoolean]
- );
-
- valueSpecificProp = boolValue;
-
- break;
-
-
- case AppConfig.IntervalValue:
-
- // represented as strings to preserve precision
- const intStart = parseFloat(propValue[AppConfig.intervalValueHasStart]['@value']);
- const intEnd = parseFloat(propValue[AppConfig.intervalValueHasEnd]['@value']);
-
- let intervalValue: ReadIntervalValue = new ReadIntervalValue(
- propValue['@id'],
- propIri,
- intStart,
- intEnd
- );
-
- valueSpecificProp = intervalValue;
-
- break;
-
- case AppConfig.ListValue:
-
- let listValue: ReadListValue = new ReadListValue(
- propValue['@id'],
- propIri,
- propValue[AppConfig.listValueAsListNode]['@id'],
- propValue[AppConfig.listValueAsListNodeLabel]
- );
-
- valueSpecificProp = listValue;
-
- break;
-
- default:
- // unsupported value type
- console.log("ERROR: value type not implemented yet: " + propValue['@type']);
- break;
- }
-
- return valueSpecificProp;
-
- }
-
- /**
- * Construct a [[ReadProperties]] from JSON-LD.
- *
- * @param resourceJSONLD an object describing the resource and its properties.
- * @returns a [[ReadProperties]].
- */
- function constructReadProperties(resourceJSONLD: Object): ReadProperties {
-
- // JSONLD representing standoff link values
- let standoffLinkValuesJSONLD: Object = resourceJSONLD[AppConfig.hasStandoffLinkToValue];
-
- // to be populated with standoff link values
- let standoffLinkValues: ReadLinkValue[] = [];
-
- // convert each standoff link value JSONLD object to a ReadLinkValue
- // in order populate the collection with all the standoff link values
- if (standoffLinkValuesJSONLD !== undefined && Array.isArray(standoffLinkValuesJSONLD)) {
- for (let standoffLinkJSONLD of standoffLinkValuesJSONLD) {
- let standoffVal: ReadLinkValue = createValueSpecificProp(standoffLinkJSONLD, AppConfig.hasStandoffLinkToValue, []) as ReadLinkValue;
-
- standoffLinkValues.push(standoffVal)
- }
- } else if (standoffLinkValuesJSONLD !== undefined) {
- let standoffVal = createValueSpecificProp(standoffLinkValuesJSONLD, AppConfig.hasStandoffLinkToValue, []) as ReadLinkValue;
-
- standoffLinkValues.push(standoffVal);
- }
-
- let propNames = Object.keys(resourceJSONLD);
- // filter out everything that is not a Knora property name
- propNames = propNames.filter(getPropertyNames);
-
- let properties: ReadProperties = {};
-
- // iterate over all the given property names
- for (let propName of propNames) {
-
- let propValues: Array = [];
-
- // either an array of values or just one value is given
- if (Array.isArray(resourceJSONLD[propName])) {
- // array of values
-
- // for each property name, an array of property values is given, iterate over it
- for (let propValue of resourceJSONLD[propName]) {
-
- // convert a JSON-LD property value to a `ReadPropertyItem`
- let valueSpecificProp: ReadPropertyItem = createValueSpecificProp(propValue, propName, standoffLinkValues);
-
- // if it is undefined, the value could not be constructed correctly
- // add the property value to the array of property values
- if (valueSpecificProp !== undefined) propValues.push(valueSpecificProp);
-
- }
- } else {
- // only one value
-
- let valueSpecificProp: ReadPropertyItem = createValueSpecificProp(resourceJSONLD[propName], propName, standoffLinkValues);
-
- // if it is undefined, the value could not be constructed correctly
- // add the property value to the array of property values
- if (valueSpecificProp !== undefined) propValues.push(valueSpecificProp);
- }
-
- // add the property to the properties object
- properties[propName] = propValues;
-
- }
-
- return properties;
- }
-
- /**
- * Turns an API response in JSON-LD representing a sequence of resources into a [[ReadResourcesSequence]].
- *
- * @param resourcesResponseJSONLD a sequence of resources, represented as a JSON-LD object.
- * @returns {ReadResourcesSequence} a [[ReadResourcesSequence]].
- */
- export function createReadResourcesSequenceFromJsonLD(resourcesResponseJSONLD: Object): ReadResourcesSequence {
-
- const resources: Array = [];
- let numberOfResources: number;
- const resourcesGraph = resourcesResponseJSONLD['@graph'];
-
- // either an array of resources or just one resource is given
- if (resourcesGraph !== undefined) {
- // an array of resources
- numberOfResources = resourcesGraph.length;
-
- for (const resourceJSONLD of resourcesGraph) {
-
- const resource: ReadResource = constructReadResource(resourceJSONLD);
-
- // add the resource to the resources array
- resources.push(resource);
- }
- } else {
- if (Object.keys(resourcesResponseJSONLD).length === 0) {
- numberOfResources = 0;
- } else {
-
- // only one resource
- numberOfResources = 1;
-
- const resource: ReadResource = constructReadResource(resourcesResponseJSONLD);
-
- // add the resource to the resources array
- resources.push(resource);
- }
- }
-
- return new ReadResourcesSequence(resources, numberOfResources);
-
- }
-
- /**
- * Collects all the classes of referred resources from a given resource (from its linking properties).
- *
- * @param {Object} resourceJSONLD JSON-LD describing one resource.
- * @return an Array of resource class Iris (including duplicates).
- */
- function getReferredResourceClasses(resourceJSONLD: Object): string[] {
-
- let propNames = Object.keys(resourceJSONLD);
- // filter out everything that is not a Knora property name
- propNames = propNames.filter(getPropertyNames);
-
- let referredResourceClasses = [];
-
- for (let prop of propNames) {
-
- // several values given for this property
- if (Array.isArray(resourceJSONLD[prop])) {
-
- for (let referredRes of resourceJSONLD[prop]) {
-
- // if the property is a LinkValue and it contains an embedded resource, get its type
- if (referredRes['@type'] == AppConfig.LinkValue && referredRes[AppConfig.linkValueHasTarget] !== undefined) {
-
- // target resource is represented
- referredResourceClasses.push(referredRes[AppConfig.linkValueHasTarget]['@type']);
- } else if (referredRes['@type'] == AppConfig.LinkValue && referredRes[AppConfig.linkValueHasSource] !== undefined) {
- // source resource is represented
- referredResourceClasses.push(referredRes[AppConfig.linkValueHasSource]['@type']);
- }
-
- }
- } else {
- // only one value given for this property
-
- // if the property is a LinkValue and it contains an embedded resource, get its type
- if (resourceJSONLD[prop]['@type'] == AppConfig.LinkValue && resourceJSONLD[prop][AppConfig.linkValueHasTarget] !== undefined) {
-
- // target resource is represented
- referredResourceClasses.push(resourceJSONLD[prop][AppConfig.linkValueHasTarget]['@type']);
- } else if (resourceJSONLD[prop]['@type'] == AppConfig.LinkValue && resourceJSONLD[prop][AppConfig.linkValueHasSource] !== undefined) {
- // source resource is represented
- referredResourceClasses.push(resourceJSONLD[prop][AppConfig.linkValueHasSource]['@type']);
- }
- }
-
- }
-
- return referredResourceClasses;
-
- }
-
- /**
- * Gets the resource classes (types) from a JSON-LD representing a sequence of resources.
- *
- * @param resourcesResponseJSONLD a sequence of resources, represented as a JSON-LD object.
- * @returns {Array} the resource class Iris (without duplicates).
- */
- export function getResourceClassesFromJsonLD(resourcesResponseJSONLD: Object): string[] {
-
- const resourcesGraph = resourcesResponseJSONLD['@graph'];
- let resourceClasses: Array = [];
-
- // either an array of resources or just one resource is given
- if (resourcesGraph !== undefined) {
- // an array of resources
-
- for (const resourceJSONLD of resourcesGraph) {
- // get class of the current resource
- resourceClasses.push(resourceJSONLD['@type']);
-
- // get the classes of referred resources
- const referredResourceClasses = getReferredResourceClasses(resourceJSONLD);
-
- resourceClasses = resourceClasses.concat(referredResourceClasses);
-
- }
-
- } else {
- // only one resource
-
- if (Object.keys(resourcesResponseJSONLD).length === 0) {
- return [];
- } else {
- resourceClasses.push(resourcesResponseJSONLD['@type']);
-
- // get the classes of referred resources
- const referredResourceClasses = getReferredResourceClasses(resourcesResponseJSONLD);
-
- resourceClasses = resourceClasses.concat(referredResourceClasses);
- }
- }
-
- // filter out duplicates
- return resourceClasses.filter(Utils.filterOutDuplicates);
-
- }
-
-}
diff --git a/src/app/model/webapi/knora/v2/index.ts b/src/app/model/webapi/knora/v2/index.ts
deleted file mode 100644
index 7e9ee7ae..00000000
--- a/src/app/model/webapi/knora/v2/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-/**
- * Interface for shared
- */
-export * from './shared/strings';
diff --git a/src/app/model/webapi/knora/v2/read-properties.ts b/src/app/model/webapi/knora/v2/read-properties.ts
deleted file mode 100644
index a063599c..00000000
--- a/src/app/model/webapi/knora/v2/read-properties.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {ReadPropertyItem} from "./read-property-item";
-
-export interface ReadProperties {
-
- [index: string]: Array;
-
-}
diff --git a/src/app/model/webapi/knora/v2/read-property-item.ts b/src/app/model/webapi/knora/v2/read-property-item.ts
deleted file mode 100644
index 5cf70b9f..00000000
--- a/src/app/model/webapi/knora/v2/read-property-item.ts
+++ /dev/null
@@ -1,504 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {AppConfig} from "../../../../app.config";
-import {ReadResource} from "./read-resource";
-import {escape} from "querystring";
-import {OntologyInformation} from "../../../services/ontologycache.service";
-
-/**
- * An abstract interface representing any value object.
- */
-export interface ReadPropertyItem {
-
- /**
- * The value object's Iri.
- */
- readonly id: string;
-
- /**
- * The value object's type.
- */
- readonly type:string;
-
- /**
- * The property pointing to the value object.
- */
- readonly propIri:string;
-
- /**
- * Gets the value object's value.
- *
- * @returns {string}
- */
- getContent:() => string;
-
- /**
- * Gets the class name of the class that implements this interface.
- *
- * @returns {string}
- */
- getClassName:() => string;
-}
-
-/**
- * Represents a text value object without markup (mere character string).
- */
-export class ReadTextValueAsString implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly str:string) {
-
- }
-
- readonly type = AppConfig.TextValue;
-
- getContent(): string {
- return this.str;
- };
-
- getClassName(): string {
- return AppConfig.ReadTextValueAsString;
- }
-}
-
-/**
- * Represents resources referred to by standoff links.
- */
-export class ReferredResourcesByStandoffLink {
- [index: string]: ReadResource;
-}
-
-/**
- * Represents a text value object with markup that has been turned into HTML.
- */
-export class ReadTextValueAsHtml implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly html:string, readonly referredResources: ReferredResourcesByStandoffLink) {
-
- }
-
- readonly type = AppConfig.TextValue;
-
- getContent(): string {
- return this.html;
- };
-
- /**
- * Gets information about a resource referred to by a standoff link from a text value.
- *
- * @param {string} resourceIri the Iri of the referred resource.
- * @param {OntologyInformation} ontologyInfo ontology information.
- * @returns {string} information about the referred resource's class and its label.
- */
- getReferredResourceInfo(resourceIri: string, ontologyInfo: OntologyInformation) {
- if (this.referredResources !== undefined && this.referredResources[resourceIri] !== undefined) {
-
- let resClassLabel = ontologyInfo.getLabelForResourceClass(this.referredResources[resourceIri].type);
-
- return this.referredResources[resourceIri].label + ` (${resClassLabel})`;
- } else {
- return "no information found about referred resource (target of standoff link)"
- }
- }
-
- getClassName():string {
- return AppConfig.ReadTextValueAsHtml;
- }
-
-}
-
-/**
- * Represents a text value object with markup as XML.
- */
-export class ReadTextValueAsXml implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly xml:string, readonly mappingIri:string) {
-
- }
-
- readonly type = AppConfig.TextValue;
-
- getContent(): string {
-
- // return XML als plain text
- return this.xml;
- };
-
- getClassName(): string {
- return AppConfig.ReadTextValueAsXml;
- }
-
-}
-
-/**
- * Represents a date value object.
- */
-export class ReadDateValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly calendar:string, readonly startYear:number, readonly endYear:number, readonly startEra:string, readonly endEra:string, readonly startMonth?:number, readonly endMonth?:number, readonly startDay?:number, readonly endDay?:number) {
-
- }
-
- readonly type = AppConfig.DateValue;
-
- private separator = "-";
-
- getContent(): string {
- // consider precision
-
- let startDate:string;
-
- if (this.startMonth === undefined) {
- // year precision
- startDate = this.startYear.toString();
- } else if (this.startDay === undefined) {
- // month precision
- startDate = this.startYear + this.separator + this.startMonth
- } else {
- // day precision
- startDate = this.startYear + this.separator + this.startMonth + this.separator + this.startDay;
- }
- startDate += " " + this.startEra;
-
- let endDate:string;
-
- if (this.endMonth === undefined) {
- // year precision
- endDate = this.endYear.toString();
- } else if (this.endDay === undefined) {
- // month precision
- endDate = this.endYear + this.separator + this.endMonth
- } else {
- // day precision
- endDate = this.endYear + this.separator + this.endMonth + this.separator + this.endDay;
- }
- endDate += " " + this.endEra;
- if (startDate == endDate) {
- return this.calendar + ":" + startDate
- } else {
- return this.calendar + ":" + startDate + this.separator + endDate;
- }
- };
-
- getClassName():string {
- return AppConfig.ReadDateValue;
- }
-}
-
-/**
- * Represents a link value object (reification).
- */
-export class ReadLinkValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly referredResourceIri: string, readonly referredResource?: ReadResource) {
-
- }
-
- readonly type = AppConfig.LinkValue;
-
- getContent():string {
- if (this.referredResource !== undefined) {
- return this.referredResource.label;
- } else {
- // TODO: try to find information about the resource identified by the given Iri
- return this.referredResourceIri;
- }
- };
-
- getReferredResourceInfo(ontologyInfo: OntologyInformation) {
- if (this.referredResource !== undefined) {
-
- let resClassLabel = ontologyInfo.getLabelForResourceClass(this.referredResource.type);
-
- return this.referredResource.label + ` (${resClassLabel})`;
- } else {
- return this.referredResourceIri;
- }
- }
-
- getClassName():string {
- return AppConfig.ReadLinkValue;
- }
-}
-
-/**
- * Represents an integer value object.
- */
-export class ReadIntegerValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly integer:number) {
-
- }
-
- readonly type = AppConfig.IntValue;
-
- getContent():string {
- return this.integer.toString();
- };
-
- getClassName():string {
- return AppConfig.ReadIntegerValue;
- }
-
-}
-
-/**
- * Represents a decimal value object.
- */
-export class ReadDecimalValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly decimal:number) {
-
- }
-
- readonly type = AppConfig.DecimalValue;
-
- getContent():string {
- return this.decimal.toString();
- };
-
- getClassName():string {
- return AppConfig.ReadDecimalValue;
- }
-}
-
-/**
- * Represents a still image value object.
- */
-export class ReadStillImageFileValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly imageFilename:string, readonly imageServerIIIFBaseURL:string, readonly imagePath: string, readonly dimX:number, readonly dimY:number, isPreview?: boolean) {
-
- this.isPreview = isPreview === undefined ? false : isPreview;
-
- }
-
- readonly type = AppConfig.StillImageFileValue;
-
- readonly isPreview: boolean;
-
- private makeIIIFUrl = function(reduceFactor:number):string {
-
- if (this.isPreview) {
- return this.imagePath;
- } else {
- let percentage = Math.floor(100 / reduceFactor);
-
- percentage = (percentage > 0 && percentage <= 100) ? percentage : 50;
-
- return this.imageServerIIIFBaseURL + "/" + this.imageFilename + "/full/pct:" + percentage.toString() + "/0/default.jpg";
- }
-
- };
-
- getContent(): string {
- return this.makeIIIFUrl(4);
- };
-
- getClassName():string {
- return AppConfig.ReadStillImageFileValue;
- }
-}
-
-/**
- * Represents a text representation value object
- */
-export class ReadTextFileValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly textFilename:string, readonly textFileURL:string) {
-
- }
-
- readonly type = AppConfig.TextFileValue;
-
- private makeUrl = function(): string {
- return `${this.textFileURL}`;
- };
-
- getContent(): string {
- return this.makeUrl();
- };
-
- getClassName():string {
- return AppConfig.TextFileValue;
- }
-
-}
-
-/**
- * Represents a color value object.
- */
-export class ReadColorValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri, readonly colorHex:string) {
-
- }
-
- readonly type = AppConfig.ColorValue;
-
- getContent(): string {
- return this.colorHex;
- };
-
- getClassName():string {
- return AppConfig.ReadColorValue;
- }
-}
-
-/**
- * Represents a point in a 2D-coordinate system (for geometry values).
- */
-export class Point2D {
- constructor(public x: number, public y: number) {}
-}
-
-/**
- * Represents a geometry value parsed from JSON.
- */
-export class RegionGeometry {
- constructor(public status: string,
- public lineColor: string,
- public lineWidth: number,
- public points: Point2D[],
- public type: string,
- public radius?: Point2D
- ) {}
-}
-
-/**
- * Represents a geometry value object.
- */
-export class ReadGeomValue implements ReadPropertyItem {
-
- constructor(readonly id:string, readonly propIri: string, readonly geometryString:string) {
-
- let geometryJSON = JSON.parse(geometryString);
-
- let points: Point2D[] = [];
- for (let point of geometryJSON.points) {
- points.push(new Point2D(point.x, point.y));
- }
-
- let radius = undefined;
- if (geometryJSON.radius) {
- radius = new Point2D(geometryJSON.radius.x, geometryJSON.radius.y);
- }
-
- this.geometry = new RegionGeometry(
- geometryJSON.status,
- geometryJSON.lineColor,
- geometryJSON.lineWidth,
- points,
- geometryJSON.type,
- radius
- );
-
- }
-
- readonly geometry: RegionGeometry;
-
- readonly type = AppConfig.GeomValue;
-
- getContent(): string {
- return this.geometryString;
- };
-
- getClassName():string {
- return AppConfig.ReadGeomValue;
- }
-}
-
-/**
- * Represents a URI value object.
- */
-export class ReadUriValue implements ReadPropertyItem {
-
- constructor(readonly id: string, readonly propIri: string, readonly uri: string) {
-
- }
-
- readonly type = AppConfig.UriValue;
-
- getContent(): string {
- return `${this.uri} `;
- };
-
- getClassName():string {
- return AppConfig.ReadUriValue;
- }
-
-}
-
-/**
- * Represents a Boolean value object.
- */
-export class ReadBooleanValue implements ReadPropertyItem {
-
- constructor(readonly id: string, readonly propIri: string, readonly bool: boolean) {
-
- }
-
- readonly type = AppConfig.BooleanValue;
-
- getContent(): string {
- return String(this.bool);
- }
-
- getClassName():string {
- return AppConfig.ReadBooleanValue;
- }
-
-}
-
-/**
- * Represents an interval value object.
- */
-export class ReadIntervalValue implements ReadPropertyItem {
-
- constructor(readonly id: string, readonly propIri: string, readonly intervalStart: number, readonly intervalEnd: number) {
-
- }
-
- readonly type = AppConfig.IntervalValue;
-
- getContent(): string {
- return String(this.intervalStart) + "-" + String(this.intervalEnd);
- }
-
- getClassName():string {
- return AppConfig.ReadIntervalValue;
- }
-
-}
-
-/**
- * Represents an interval value object.
- */
-export class ReadListValue implements ReadPropertyItem {
-
- constructor(readonly id: string, readonly propIri: string, readonly listNodeIri: string, readonly listNodeLabel: string,) {
-
- }
-
- readonly type = AppConfig.ListValue;
-
- getContent(): string {
- return this.listNodeLabel;
- }
-
- getClassName():string {
- return AppConfig.ReadListValue;
- }
-
-}
diff --git a/src/app/model/webapi/knora/v2/read-resource.ts b/src/app/model/webapi/knora/v2/read-resource.ts
deleted file mode 100644
index a0ebcd5b..00000000
--- a/src/app/model/webapi/knora/v2/read-resource.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {ReadProperties} from "./read-properties";
-import {StillImageRepresentation} from "../../../../view/properties/still-image-osdviewer/still-image-osdviewer.component";
-import {ReadPropertyItem} from "./read-property-item";
-
-export class ReadResource {
-
- constructor(
- public readonly id: string,
- public readonly type: string,
- public readonly label: string,
- public incomingRegions: Array,
- public incomingStillImageRepresentations: Array,
- public incomingLinks: Array,
- public stillImageRepresentationsToDisplay: StillImageRepresentation[],
- public readonly properties?: ReadProperties) {
- }
-
-}
diff --git a/src/app/model/webapi/knora/v2/read-resources-sequence.ts b/src/app/model/webapi/knora/v2/read-resources-sequence.ts
deleted file mode 100644
index c3e03e16..00000000
--- a/src/app/model/webapi/knora/v2/read-resources-sequence.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {ReadResource} from "./read-resource";
-
-export class ReadResourcesSequence {
-
- constructor(resources: Array, numberOfResources: number) {
- this.resources = resources;
-
- this.numberOfResources = numberOfResources;
-
- }
-
- resources: Array;
-
- numberOfResources: number;
-
-}
diff --git a/src/app/model/webapi/knora/v2/shared/strings.ts b/src/app/model/webapi/knora/v2/shared/strings.ts
deleted file mode 100644
index 987129e1..00000000
--- a/src/app/model/webapi/knora/v2/shared/strings.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- */
-
-
-import {JsonObject, JsonProperty} from 'json2typescript';
-
-@JsonObject
-export class StringLiteralV2 {
-
- @JsonProperty('value', String, false)
- public value: string = undefined;
-
- @JsonProperty('language', String, true)
- public language: string = '';
-}
diff --git a/src/app/utils.spec.ts b/src/app/utils.spec.ts
deleted file mode 100644
index d15d9645..00000000
--- a/src/app/utils.spec.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import {Utils} from './utils';
-
-describe('Utils', () => {
-
- it("filter out duplicates entries in a collection", () => {
-
- const collection: number[] = [1,1,2,2,3];
-
- const noDups: number[] = collection.filter(Utils.filterOutDuplicates);
-
- expect(noDups).toEqual([1,2,3])
-
- });
-
- it("get the ontology from an entity Iri", () => {
-
- const resourceClassIri = 'http://0.0.0.0:3333/ontology/0801/beol/v2#person';
-
- const ontolopgyIri = Utils.getOntologyIriFromEntityIri(resourceClassIri);
-
- expect(ontolopgyIri).toEqual('http://0.0.0.0:3333/ontology/0801/beol/v2')
-
- });
-
- it("get the ontology from a knora-api entity Iri", () => {
-
- const resourceClassIri = 'http://api.knora.org/ontology/knora-api/v2#DDDRepresentation';
-
- const ontolopgyIri = Utils.getOntologyIriFromEntityIri(resourceClassIri);
-
- expect(ontolopgyIri).toEqual('http://api.knora.org/ontology/knora-api/v2')
-
- });
-
- it("convert a complex entity Iri to the simple schema", () => {
-
- const resourceClassIriComplex = 'http://api.knora.org/ontology/knora-api/v2#DDDRepresentation';
-
- const ontolopgyIri = Utils.convertComplexKnoraApiEntityIritoSimple(resourceClassIriComplex);
-
- expect(ontolopgyIri).toEqual('http://api.knora.org/ontology/knora-api/simple/v2#DDDRepresentation');
-
- });
-
-
-
-
-});
diff --git a/src/app/utils.ts b/src/app/utils.ts
deleted file mode 100644
index b73e747e..00000000
--- a/src/app/utils.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright © 2016 Lukas Rosenthaler, André Kilchenmann, Andreas Aeschlimann,
- * Sofia Georgakopoulou, Ivan Subotic, Benjamin Geer, Tobias Schweizer.
- * This file is part of SALSAH.
- * SALSAH is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * SALSAH is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * You should have received a copy of the GNU Affero General Public
- * License along with SALSAH. If not, see .
- * */
-
-import {AppConfig} from "./app.config";
-
-/**
- * Collection of useful utility functions.
- */
-export class Utils {
-
- /**
- * Lambda function eliminating duplicates in a collection to be passed to [[filter]].
- *
- * @param elem element of an Array that is currently being looked at.
- * @param index current elements index.
- * @param self reference to the whole Array.
- * @returns {boolean} true if the same element does not already exist in the Array.
- */
- public static filterOutDuplicates = (elem, index: number, self) => {
-
- // https://stackoverflow.com/questions/16747798/delete-duplicate-elements-from-an-array
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter?v=example
-
- // returns true if the element's index equals the index of the leftmost element
- // -> this means that there is no identical element before this index, hence it is not a duplicate
- // for all other elements, false is returned
- return index == self.indexOf(elem);
- };
-
- /**
- * Given a Knora entity IRI, gets the ontology Iri.
- *
- * @param {string} entityIri an entity Iri.
- * @return {string} the ontology IRI
- */
- public static getOntologyIriFromEntityIri(entityIri: string) {
-
- // split class Iri on "#"
- let segments: string[] = entityIri.split(AppConfig.PathSeparator);
-
- if (segments.length != 2) console.log(`Error: ${entityIri} is not a valid entity IRI.`);
-
- return segments[0];
-
- }
-
- /**
- * Converts a complex knora-api entity Iri to a knora-api simple entity Iri.
- *
- * @param {string} complexEntityIri
- * @returns {string}
- */
- public static convertComplexKnoraApiEntityIritoSimple(complexEntityIri: string) {
-
- // split entity Iri on "#"
- let segments: string[] = complexEntityIri.split('v2' + AppConfig.PathSeparator);
-
- if (segments.length != 2) console.log(`Error: ${complexEntityIri} is not a valid entity IRI.`);
-
- // add 'simple' to base path
- return segments[0] + 'simple/v2' + AppConfig.PathSeparator + segments[1];
-
- }
-
- /**
- * A regex to validate URLs.
- */
- public static readonly urlRegex = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}(:[0-9]{1,5})?(\/.*)?$/i;
-
-
-}
diff --git a/src/app/view/dashboard/dashboard.component.spec.ts b/src/app/view/dashboard/dashboard.component.spec.ts
index 30d5055a..9fc5e4ca 100644
--- a/src/app/view/dashboard/dashboard.component.spec.ts
+++ b/src/app/view/dashboard/dashboard.component.spec.ts
@@ -1,11 +1,10 @@
-import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../app.module';
-import {AppMaterialModule} from '../../app-material-module';
-import {AppRoutingModule} from '../../app-routing.module';
-import {DashboardComponent} from './dashboard.component';
-import {ProjectsService} from '../../model/services/projects.service';
-import {BaseRequestOptions, Http, HttpModule, ResponseOptions} from '@angular/http';
-import {MockBackend} from '@angular/http/testing';
+import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../app.module';
+import { AppMaterialModule } from '../../app-material-module';
+import { AppRoutingModule } from '../../app-routing.module';
+import { DashboardComponent } from './dashboard.component';
+import { BaseRequestOptions, Http, HttpModule, ResponseOptions } from '@angular/http';
+import { MockBackend } from '@angular/http/testing';
describe('DashboardComponent', () => {
let component: DashboardComponent;
@@ -20,7 +19,6 @@ describe('DashboardComponent', () => {
HttpModule
],
providers: [
- ProjectsService,
MockBackend,
BaseRequestOptions,
{
@@ -39,17 +37,8 @@ describe('DashboardComponent', () => {
fixture.detectChanges();
});
- xit('should be created', async(inject(
- [ProjectsService, MockBackend], (service, mockBackend) => {
-
- const mockProjectsJson = {'projects': [{'shortname': 'biblio', 'description': 'Bibliography', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/biblio', 'id': 'http://data.knora.org/projects/DczxPs-sR6aZN91qV92ZmQ', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bibliography', 'ontologies': ['http://www.knora.org/ontology/biblio']}, {'shortname': 'beol', 'description': 'Bernoulli-Euler Online', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/beol', 'id': 'http://data.knora.org/projects/yTerZGyxjZVqFMNNKXCDPF', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bernoulli-Euler Online', 'ontologyNamedGraph': 'http://www.knora.org/ontology/beol'}, {'shortname': 'incunabula', 'description': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n', 'institution': null, 'logo': 'incunabula_logo.png', 'dataNamedGraph': 'http://www.knora.org/data/incunabula', 'id': 'http://data.knora.org/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': 'Basler Frühdrucke, Inkunabel, Narrenschiff, Wiegendrucke, Sebastian Brant, Bilderfolgen, early print, incunabula, ship of fools, Kunsthistorischs Seminar Universität Basel, Late Middle Ages, Letterpress Printing, Basel, Contectualisation of images', 'longname': 'Bilderfolgen Basler Frühdrucke', 'ontologyNamedGraph': 'http://www.knora.org/ontology/incunabula'}, {'shortname': 'anything', 'description': 'Anything Project', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/anything', 'id': 'http://data.knora.org/projects/anything', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Anything Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/anything'}, {'shortname': 'SystemProject', 'description': 'Knora System Project', 'institution': null, 'logo': null, 'dataNamedGraph': '-', 'id': 'http://www.knora.org/ontology/knora-base#SystemProject', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Knora System Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/knora-base'}, {'shortname': 'dokubib', 'description': 'Dokubib', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/dokubib', 'id': 'http://data.knora.org/projects/b83b99ca01', 'status': false, 'selfjoin': false, 'keywords': null, 'longname': 'Dokubib', 'ontologyNamedGraph': 'http://www.knora.org/ontology/dokubib'}, {'shortname': 'images', 'description': 'A demo project of a collection of images', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/images', 'id': 'http://data.knora.org/projects/images', 'status': true, 'selfjoin': false, 'keywords': 'images, collection', 'longname': 'Image Collection Demo', 'ontologies': ['http://www.knora.org/ontology/images']}], 'status': 0};
-
- mockBackend.connections.subscribe(c => {
- // TODO: understand why this is not failing
- expect(c.request.url).toBe('v1/projects/shouldfail');
- c.mockRespond(new Response(new ResponseOptions({ body: JSON.stringify(mockProjectsJson) })));
- });
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
- expect(component).toBeTruthy();
- })));
});
diff --git a/src/app/view/dashboard/dashboard.component.ts b/src/app/view/dashboard/dashboard.component.ts
index 1a77170d..9e74a213 100644
--- a/src/app/view/dashboard/dashboard.component.ts
+++ b/src/app/view/dashboard/dashboard.component.ts
@@ -14,9 +14,9 @@
import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
-import {AuthenticationService} from '../../model/services/authentication.service';
import {Title} from '@angular/platform-browser';
import {environment} from '../../../environments/environment';
+import { AuthenticationService } from '@knora/authentication';
@Component({
selector: 'salsah-dashboard',
diff --git a/src/app/view/dashboard/project/project-advanced/project-advanced.component.spec.ts b/src/app/view/dashboard/project/project-advanced/project-advanced.component.spec.ts
index 52408896..bbd1a984 100644
--- a/src/app/view/dashboard/project/project-advanced/project-advanced.component.spec.ts
+++ b/src/app/view/dashboard/project/project-advanced/project-advanced.component.spec.ts
@@ -1,9 +1,9 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ProjectAdvancedComponent} from './project-advanced.component';
-import {ProjectsService} from '../../../../model/services/projects.service';
-import {BasicOntologyService} from '../../../../model/services/basic-ontology.service';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ProjectAdvancedComponent } from './project-advanced.component';
+import { ProjectsService } from '@knora/core';
+import { BasicOntologyService } from '../../../../model/services/basic-ontology.service';
describe('ProjectAdvancedComponent', () => {
let component: ProjectAdvancedComponent;
@@ -30,7 +30,7 @@ describe('ProjectAdvancedComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.spec.ts b/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.spec.ts
index d07865e0..11f6d84a 100644
--- a/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.spec.ts
+++ b/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.spec.ts
@@ -1,10 +1,13 @@
-import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing';
+import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
+import { BaseRequestOptions, Http, HttpModule } from '@angular/http';
+import { MockBackend } from '@angular/http/testing';
+
+import { ProjectsService } from '@knora/core';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { AppMaterialModule } from '../../../../app-material-module';
+import { ProjectListsAdminComponent } from './project-lists-admin.component';
-import {BaseRequestOptions, Http, HttpModule, ResponseOptions} from '@angular/http';
-import {ApiService} from '../../../../model/services/api.service';
-import {ProjectsService} from '../../../../model/services/projects.service';
-import {MockBackend} from '@angular/http/testing';
-import {ProjectListsAdminComponent} from './project-lists-admin.component';
describe('ProjectListsAdminComponent', () => {
let component: ProjectListsAdminComponent;
@@ -12,12 +15,13 @@ describe('ProjectListsAdminComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ProjectListsAdminComponent],
imports: [
- HttpModule
+ AppModule,
+ AppRoutingModule,
+ HttpModule,
+ AppMaterialModule
],
providers: [
- ApiService,
ProjectsService,
MockBackend,
BaseRequestOptions,
@@ -37,18 +41,8 @@ describe('ProjectListsAdminComponent', () => {
fixture.detectChanges();
});
- xit('should be created', async(inject(
- [ProjectsService, MockBackend], (service, mockBackend) => {
-
- const mockProjectsJson = {'projects': [{'shortname': 'biblio', 'description': 'Bibliography', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/biblio', 'id': 'http://data.knora.org/projects/DczxPs-sR6aZN91qV92ZmQ', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bibliography', 'ontologies': ['http://www.knora.org/ontology/biblio']}, {'shortname': 'beol', 'description': 'Bernoulli-Euler Online', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/beol', 'id': 'http://data.knora.org/projects/yTerZGyxjZVqFMNNKXCDPF', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bernoulli-Euler Online', 'ontologyNamedGraph': 'http://www.knora.org/ontology/beol'}, {'shortname': 'incunabula', 'description': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n', 'institution': null, 'logo': 'incunabula_logo.png', 'dataNamedGraph': 'http://www.knora.org/data/incunabula', 'id': 'http://data.knora.org/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': 'Basler Frühdrucke, Inkunabel, Narrenschiff, Wiegendrucke, Sebastian Brant, Bilderfolgen, early print, incunabula, ship of fools, Kunsthistorischs Seminar Universität Basel, Late Middle Ages, Letterpress Printing, Basel, Contectualisation of images', 'longname': 'Bilderfolgen Basler Frühdrucke', 'ontologyNamedGraph': 'http://www.knora.org/ontology/incunabula'}, {'shortname': 'anything', 'description': 'Anything Project', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/anything', 'id': 'http://data.knora.org/projects/anything', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Anything Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/anything'}, {'shortname': 'SystemProject', 'description': 'Knora System Project', 'institution': null, 'logo': null, 'dataNamedGraph': '-', 'id': 'http://www.knora.org/ontology/knora-base#SystemProject', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Knora System Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/knora-base'}, {'shortname': 'dokubib', 'description': 'Dokubib', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/dokubib', 'id': 'http://data.knora.org/projects/b83b99ca01', 'status': false, 'selfjoin': false, 'keywords': null, 'longname': 'Dokubib', 'ontologyNamedGraph': 'http://www.knora.org/ontology/dokubib'}, {'shortname': 'images', 'description': 'A demo project of a collection of images', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/images', 'id': 'http://data.knora.org/projects/images', 'status': true, 'selfjoin': false, 'keywords': 'images, collection', 'longname': 'Image Collection Demo', 'ontologies': ['http://www.knora.org/ontology/images']}], 'status': 0};
-
- mockBackend.connections.subscribe(c => {
- // TODO: understand why this is not failing
- expect(c.request.url).toBe('v1/projects/shouldfail');
- c.mockRespond(new Response(new ResponseOptions({ body: JSON.stringify(mockProjectsJson) })));
- });
-
- expect(component).toBeTruthy();
- })));
+ xit('should create', () => {
+ expect(component).toBeTruthy();
+ });
});
diff --git a/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.ts b/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.ts
index 3d3bc029..94c19c0e 100644
--- a/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.ts
+++ b/src/app/view/dashboard/project/project-lists-admin/project-lists-admin.component.ts
@@ -13,13 +13,11 @@
* License along with SALSAH. If not, see .
*/
-import {Component, Input, OnInit} from '@angular/core';
-import {Project, ListInfo} from '../../../../model/webapi/knora';
-import {Router} from '@angular/router';
-import {ListsService} from '../../../../model/services/lists.service';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {AddData, ListData} from '../../../modules/framework/framework-for-listings/framework-for-listings.component';
-import {List} from '../../../../model/webapi/knora/admin';
+import { Component, Input, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { ApiServiceError, List, ListInfo, ListsService, Project } from '@knora/core';
+import { AddData, ListData } from '../../../modules/framework/framework-for-listings/framework-for-listings.component';
+// import { ListsService } from '../../../../model/services/lists.service';
@Component({
selector: 'salsah-project-lists-admin',
@@ -59,8 +57,8 @@ export class ProjectListsAdminComponent implements OnInit {
selectedRow: number;
- projectLists: ListInfo[] = [];
- systemLists: ListInfo[] = [];
+ projectLists: List[] = [];
+ systemLists: List[] = [];
selectedList: ListInfo;
@@ -77,36 +75,13 @@ export class ProjectListsAdminComponent implements OnInit {
listIri: string;
constructor(private _router: Router,
- private _listsService: ListsService) {
+ private _listsService: ListsService) {
}
ngOnInit() {
this.list.restrictedBy = JSON.parse(sessionStorage.getItem('currentProject')).id;
- // get all project lists
- this._listsService.getLists(this.list.restrictedBy)
- .subscribe(
- (lists: List[]) => {
- this.projectLists = lists.map(value => value.listinfo);
- },
- (error: ApiServiceError) => {
- this.errorMessage = error;
- }
- );
-
- // get all system lists
- this._listsService.getLists('http://www.knora.org/ontology/knora-base#SystemProject')
- .subscribe(
- (lists: List[]) => {
- this.systemLists = lists.map(value => value.listinfo);
- this.isLoading = false;
- },
- (error: ApiServiceError) => {
- this.errorMessage = error;
- this.isLoading = false;
- }
- );
}
onSelect(listInfo: ListInfo) {
diff --git a/src/app/view/dashboard/project/project-ontologies/project-ontologies.component.spec.ts b/src/app/view/dashboard/project/project-ontologies/project-ontologies.component.spec.ts
index b95a1282..1d962670 100644
--- a/src/app/view/dashboard/project/project-ontologies/project-ontologies.component.spec.ts
+++ b/src/app/view/dashboard/project/project-ontologies/project-ontologies.component.spec.ts
@@ -1,21 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectOntologiesComponent } from './project-ontologies.component';
+import { FrameworkForListingsComponent } from '../../../modules/framework/framework-for-listings/framework-for-listings.component';
+import { AppModule } from '../../../../app.module';
describe('ProjectOntologiesComponent', () => {
let component: ProjectOntologiesComponent;
let fixture: ComponentFixture;
+ const id: string = 'http://rdfh.ch/projects/0803';
+
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ ProjectOntologiesComponent ]
+ imports: [
+ AppModule
+ ],
})
- .compileComponents();
+ .compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProjectOntologiesComponent);
component = fixture.componentInstance;
+ component.ngOnInit();
fixture.detectChanges();
});
diff --git a/src/app/view/dashboard/project/project-profile/project-profile.component.spec.ts b/src/app/view/dashboard/project/project-profile/project-profile.component.spec.ts
index 4b3a908d..38deb1a1 100644
--- a/src/app/view/dashboard/project/project-profile/project-profile.component.spec.ts
+++ b/src/app/view/dashboard/project/project-profile/project-profile.component.spec.ts
@@ -1,8 +1,8 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ProjectProfileComponent} from './project-profile.component';
-import {ProjectsService} from '../../../../model/services/projects.service';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ProjectProfileComponent } from './project-profile.component';
+import { ProjectsService } from '@knora/core';
describe('ProjectProfileComponent', () => {
let component: ProjectProfileComponent;
@@ -27,7 +27,7 @@ describe('ProjectProfileComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/project/project-profile/project-profile.component.ts b/src/app/view/dashboard/project/project-profile/project-profile.component.ts
index 53138037..5c722cdf 100644
--- a/src/app/view/dashboard/project/project-profile/project-profile.component.ts
+++ b/src/app/view/dashboard/project/project-profile/project-profile.component.ts
@@ -12,13 +12,11 @@
* License along with SALSAH. If not, see .
* */
-import {Component, OnInit} from '@angular/core';
-import {ActivatedRoute, Params} from '@angular/router';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {ProjectsService} from '../../../../model/services/projects.service';
-import {Project} from '../../../../model/webapi/knora';
-import {MatDialog, MatDialogConfig} from '@angular/material';
-import {FormDialogComponent} from '../../../modules/dialog/form-dialog/form-dialog.component';
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute, Params } from '@angular/router';
+import { ApiServiceError, Project, ProjectsService } from '@knora/core';
+import { MatDialog, MatDialogConfig } from '@angular/material';
+import { FormDialogComponent } from '../../../modules/dialog/form-dialog/form-dialog.component';
@Component({
@@ -41,17 +39,17 @@ export class ProjectProfileComponent implements OnInit {
};
constructor(private _route: ActivatedRoute,
- private _projectsService: ProjectsService,
- public _dialog: MatDialog) {
+ private _projectsService: ProjectsService,
+ public _dialog: MatDialog) {
_dialog.afterAllClosed
.subscribe(() => {
- // update a variable or call a function when the dialog closes
- // get the project information
- _route.params.subscribe((params: Params) => {
- this.updateSession(params['pid']);
- });
- }
+ // update a variable or call a function when the dialog closes
+ // get the project information
+ _route.params.subscribe((params: Params) => {
+ this.updateSession(params['pid']);
+ });
+ }
);
}
@@ -81,10 +79,10 @@ export class ProjectProfileComponent implements OnInit {
sessionStorage.removeItem(this.session);
this._projectsService.getProjectByShortname(id)
.subscribe((result: Project) => {
- this.project = result;
- sessionStorage.setItem(this.session, JSON.stringify(this.project));
- this.isLoading = false;
- },
+ this.project = result;
+ sessionStorage.setItem(this.session, JSON.stringify(this.project));
+ this.isLoading = false;
+ },
(error: ApiServiceError) => {
this.errorMessage = error;
sessionStorage.removeItem(this.session);
diff --git a/src/app/view/dashboard/project/project-resources/project-resources.component.spec.ts b/src/app/view/dashboard/project/project-resources/project-resources.component.spec.ts
index d18fb347..b2bc779b 100644
--- a/src/app/view/dashboard/project/project-resources/project-resources.component.spec.ts
+++ b/src/app/view/dashboard/project/project-resources/project-resources.component.spec.ts
@@ -1,11 +1,10 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ProjectResourcesComponent} from './project-resources.component';
-import {ResourceTypesService} from '../../../../model/services/resource-types.service';
-import {PropertiesService} from '../../../../model/services/properties.service';
-import {Project} from '../../../../model/webapi/knora/';
-import {imagesProject} from '../../../../model/test-data/shared-test-data';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ProjectResourcesComponent } from './project-resources.component';
+import { ResourceTypesService } from '../../../../model/services/resource-types.service';
+import { imagesProject } from '../../../../model/test-data/shared-test-data';
+import { Project } from '@knora/core';
describe('ProjectResourcesComponent', () => {
@@ -21,8 +20,7 @@ describe('ProjectResourcesComponent', () => {
AppRoutingModule
],
providers: [
- ResourceTypesService,
- PropertiesService
+ ResourceTypesService
]
})
.compileComponents();
@@ -55,7 +53,7 @@ describe('ProjectResourcesComponent', () => {
fixture.detectChanges();
});
- xit('should get the project data', () => {
+ it('should get the project data', () => {
expect(sessionStorage.getItem('currentProject')).toBe(JSON.stringify(testProject));
expect(component).toBeTruthy();
});
diff --git a/src/app/view/dashboard/project/project-settings/project-settings.component.spec.ts b/src/app/view/dashboard/project/project-settings/project-settings.component.spec.ts
index ca73fa0d..1e8cd315 100644
--- a/src/app/view/dashboard/project/project-settings/project-settings.component.spec.ts
+++ b/src/app/view/dashboard/project/project-settings/project-settings.component.spec.ts
@@ -1,7 +1,7 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ProjectSettingsComponent} from './project-settings.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ProjectSettingsComponent } from './project-settings.component';
describe('ProjectSettingsComponent', () => {
let component: ProjectSettingsComponent;
@@ -23,7 +23,7 @@ describe('ProjectSettingsComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/project/project-team/project-team.component.spec.ts b/src/app/view/dashboard/project/project-team/project-team.component.spec.ts
index c43d8a0e..fd17ade1 100644
--- a/src/app/view/dashboard/project/project-team/project-team.component.spec.ts
+++ b/src/app/view/dashboard/project/project-team/project-team.component.spec.ts
@@ -1,13 +1,13 @@
-import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ProjectTeamComponent} from './project-team.component';
-import {ProjectsService} from '../../../../model/services/projects.service';
-import {UsersService} from '../../../../model/services/users.service';
-import {Project} from '../../../../model/webapi/knora/';
-import {MockBackend} from '@angular/http/testing';
-import {BaseRequestOptions, Http, ResponseOptions} from '@angular/http';
-import {imagesProject} from '../../../../model/test-data/shared-test-data';
+import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ProjectTeamComponent } from './project-team.component';
+import { Project, ProjectsService } from '@knora/core';
+import { UsersService } from '@knora/core';
+
+import { MockBackend } from '@angular/http/testing';
+import { BaseRequestOptions, Http } from '@angular/http';
+import { imagesProject } from '../../../../model/test-data/shared-test-data';
describe('ProjectTeamComponent', () => {
let component: ProjectTeamComponent;
@@ -62,108 +62,109 @@ describe('ProjectTeamComponent', () => {
component = fixture.componentInstance;
fixture.detectChanges();
});
+ /*
+ xit('should be created', async(inject(
+ [ProjectsService, MockBackend], (service, mockBackend) => {
+
+ const mockProjectsJson = {
+ 'projects': [{
+ 'shortname': 'biblio',
+ 'description': 'Bibliography',
+ 'institution': null,
+ 'logo': null,
+ 'dataNamedGraph': 'http://www.knora.org/data/biblio',
+ 'id': 'http://data.knora.org/projects/DczxPs-sR6aZN91qV92ZmQ',
+ 'status': true,
+ 'selfjoin': false,
+ 'keywords': null,
+ 'longname': 'Bibliography',
+ 'ontologies': ['http://www.knora.org/ontology/biblio']
+ }, {
+ 'shortname': 'beol',
+ 'description': 'Bernoulli-Euler Online',
+ 'institution': null,
+ 'logo': null,
+ 'dataNamedGraph': 'http://www.knora.org/data/beol',
+ 'id': 'http://data.knora.org/projects/yTerZGyxjZVqFMNNKXCDPF',
+ 'status': true,
+ 'selfjoin': false,
+ 'keywords': null,
+ 'longname': 'Bernoulli-Euler Online',
+ 'ontologies': ['http://www.knora.org/ontology/beol']
+ }, {
+ 'shortname': 'incunabula',
+ 'description': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n',
+ 'institution': null,
+ 'logo': 'incunabula_logo.png',
+ 'dataNamedGraph': 'http://www.knora.org/data/incunabula',
+ 'id': 'http://data.knora.org/projects/77275339',
+ 'status': true,
+ 'selfjoin': false,
+ 'keywords': 'Basler Frühdrucke, Inkunabel, Narrenschiff, Wiegendrucke, Sebastian Brant, Bilderfolgen, early print, incunabula, ship of fools, Kunsthistorischs Seminar Universität Basel, Late Middle Ages, Letterpress Printing, Basel, Contectualisation of images',
+ 'longname': 'Bilderfolgen Basler Frühdrucke',
+ 'ontologies': ['http://www.knora.org/ontology/images']
+ }, {
+ 'shortname': 'anything',
+ 'description': 'Anything Project',
+ 'institution': null,
+ 'logo': null,
+ 'dataNamedGraph': 'http://www.knora.org/data/anything',
+ 'id': 'http://data.knora.org/projects/anything',
+ 'status': true,
+ 'selfjoin': false,
+ 'keywords': null,
+ 'longname': 'Anything Project',
+ 'ontologies': ['http://www.knora.org/ontology/anything']
+ }, {
+ 'shortname': 'SystemProject',
+ 'description': 'Knora System Project',
+ 'institution': null,
+ 'logo': null,
+ 'dataNamedGraph': '-',
+ 'id': 'http://www.knora.org/ontology/knora-base#SystemProject',
+ 'status': true,
+ 'selfjoin': false,
+ 'keywords': null,
+ 'longname': 'Knora System Project',
+ 'ontologies': ['http://www.knora.org/ontology/knora-base']
+ }, {
+ 'shortname': 'dokubib',
+ 'description': 'Dokubib',
+ 'institution': null,
+ 'logo': null,
+ 'dataNamedGraph': 'http://www.knora.org/data/dokubib',
+ 'id': 'http://data.knora.org/projects/b83b99ca01',
+ 'status': false,
+ 'selfjoin': false,
+ 'keywords': null,
+ 'longname': 'Dokubib',
+ 'ontologies': ['http://www.knora.org/ontology/dokubib']
+ }, {
+ 'shortname': 'images',
+ 'description': 'A demo project of a collection of images',
+ 'institution': null,
+ 'logo': null,
+ 'dataNamedGraph': 'http://www.knora.org/data/images',
+ 'id': 'http://data.knora.org/projects/images',
+ 'status': true,
+ 'selfjoin': false,
+ 'keywords': 'images, collection',
+ 'longname': 'Image Collection Demo',
+ 'ontologies': ['http://www.knora.org/ontology/images']
+ }], 'status': 0
+ };
+
+ mockBackend.connections.subscribe(c => {
+ // TODO: understand why this is not failing
+ expect(c.request.url).toBe('v1/projects/shouldfail');
+ c.mockRespond(new Response(new ResponseOptions({body: JSON.stringify(mockProjectsJson)})));
+ });
+
+ expect(component).toBeTruthy();
+ })));
+ */
- xit('should be created', async(inject(
- [ProjectsService, MockBackend], (service, mockBackend) => {
-
- const mockProjectsJson = {
- 'projects': [{
- 'shortname': 'biblio',
- 'description': 'Bibliography',
- 'institution': null,
- 'logo': null,
- 'dataNamedGraph': 'http://www.knora.org/data/biblio',
- 'id': 'http://data.knora.org/projects/DczxPs-sR6aZN91qV92ZmQ',
- 'status': true,
- 'selfjoin': false,
- 'keywords': null,
- 'longname': 'Bibliography',
- 'ontologies': ['http://www.knora.org/ontology/biblio']
- }, {
- 'shortname': 'beol',
- 'description': 'Bernoulli-Euler Online',
- 'institution': null,
- 'logo': null,
- 'dataNamedGraph': 'http://www.knora.org/data/beol',
- 'id': 'http://data.knora.org/projects/yTerZGyxjZVqFMNNKXCDPF',
- 'status': true,
- 'selfjoin': false,
- 'keywords': null,
- 'longname': 'Bernoulli-Euler Online',
- 'ontologies': ['http://www.knora.org/ontology/beol']
- }, {
- 'shortname': 'incunabula',
- 'description': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n',
- 'institution': null,
- 'logo': 'incunabula_logo.png',
- 'dataNamedGraph': 'http://www.knora.org/data/incunabula',
- 'id': 'http://data.knora.org/projects/77275339',
- 'status': true,
- 'selfjoin': false,
- 'keywords': 'Basler Frühdrucke, Inkunabel, Narrenschiff, Wiegendrucke, Sebastian Brant, Bilderfolgen, early print, incunabula, ship of fools, Kunsthistorischs Seminar Universität Basel, Late Middle Ages, Letterpress Printing, Basel, Contectualisation of images',
- 'longname': 'Bilderfolgen Basler Frühdrucke',
- 'ontologies': ['http://www.knora.org/ontology/images']
- }, {
- 'shortname': 'anything',
- 'description': 'Anything Project',
- 'institution': null,
- 'logo': null,
- 'dataNamedGraph': 'http://www.knora.org/data/anything',
- 'id': 'http://data.knora.org/projects/anything',
- 'status': true,
- 'selfjoin': false,
- 'keywords': null,
- 'longname': 'Anything Project',
- 'ontologies': ['http://www.knora.org/ontology/anything']
- }, {
- 'shortname': 'SystemProject',
- 'description': 'Knora System Project',
- 'institution': null,
- 'logo': null,
- 'dataNamedGraph': '-',
- 'id': 'http://www.knora.org/ontology/knora-base#SystemProject',
- 'status': true,
- 'selfjoin': false,
- 'keywords': null,
- 'longname': 'Knora System Project',
- 'ontologies': ['http://www.knora.org/ontology/knora-base']
- }, {
- 'shortname': 'dokubib',
- 'description': 'Dokubib',
- 'institution': null,
- 'logo': null,
- 'dataNamedGraph': 'http://www.knora.org/data/dokubib',
- 'id': 'http://data.knora.org/projects/b83b99ca01',
- 'status': false,
- 'selfjoin': false,
- 'keywords': null,
- 'longname': 'Dokubib',
- 'ontologies': ['http://www.knora.org/ontology/dokubib']
- }, {
- 'shortname': 'images',
- 'description': 'A demo project of a collection of images',
- 'institution': null,
- 'logo': null,
- 'dataNamedGraph': 'http://www.knora.org/data/images',
- 'id': 'http://data.knora.org/projects/images',
- 'status': true,
- 'selfjoin': false,
- 'keywords': 'images, collection',
- 'longname': 'Image Collection Demo',
- 'ontologies': ['http://www.knora.org/ontology/images']
- }], 'status': 0
- };
-
- mockBackend.connections.subscribe(c => {
- // TODO: understand why this is not failing
- expect(c.request.url).toBe('v1/projects/shouldfail');
- c.mockRespond(new Response(new ResponseOptions({body: JSON.stringify(mockProjectsJson)})));
- });
-
- expect(component).toBeTruthy();
- })));
-
- xit('should get the project data', () => {
+ it('should get the project data', () => {
expect(sessionStorage.getItem('currentProject')).toBe(JSON.stringify(testProject));
expect(component).toBeTruthy();
});
diff --git a/src/app/view/dashboard/project/project-team/project-team.component.ts b/src/app/view/dashboard/project/project-team/project-team.component.ts
index a03132fe..df3e61f6 100644
--- a/src/app/view/dashboard/project/project-team/project-team.component.ts
+++ b/src/app/view/dashboard/project/project-team/project-team.component.ts
@@ -20,7 +20,7 @@ import {
import {LanguageService} from '../../../../model/services/language.service';
import {TranslateService} from '@ngx-translate/core';
-import {Subscription} from 'rxjs/Subscription';
+import {Subscription} from 'rxjs';
@Component({
diff --git a/src/app/view/dashboard/project/project.component.spec.ts b/src/app/view/dashboard/project/project.component.spec.ts
index 517ba789..f04649ec 100644
--- a/src/app/view/dashboard/project/project.component.spec.ts
+++ b/src/app/view/dashboard/project/project.component.spec.ts
@@ -1,8 +1,8 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {RouterTestingModule} from '@angular/router/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
-import {ProjectComponent} from './project.component';
-import {AppModule} from '../../../app.module';
+import { ProjectComponent } from './project.component';
+import { AppModule } from '../../../app.module';
describe('ProjectComponent', () => {
@@ -28,7 +28,7 @@ describe('ProjectComponent', () => {
fixture.detectChanges();
});
- xit('should be created', () => {
+ it('should be created', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/project/project.component.ts b/src/app/view/dashboard/project/project.component.ts
index 81273642..9ee4d7fb 100644
--- a/src/app/view/dashboard/project/project.component.ts
+++ b/src/app/view/dashboard/project/project.component.ts
@@ -12,12 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {Component, OnInit} from '@angular/core';
-import {ActivatedRoute, Params, Router} from '@angular/router';
-import {ApiServiceError} from '../../../model/services/api-service-error';
-import {ProjectsService} from '../../../model/services/projects.service';
-import {Project} from '../../../model/webapi/knora';
-import {Title} from '@angular/platform-browser';
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute, Params, Router } from '@angular/router';
+import { ApiServiceError, Project, ProjectsService } from '@knora/core';
+import { Title } from '@angular/platform-browser';
@Component({
selector: 'salsah-project',
@@ -55,9 +53,9 @@ export class ProjectComponent implements OnInit {
public currentProject: string = undefined;
constructor(private _title: Title,
- private _router: Router,
- private _route: ActivatedRoute,
- private _projectsService: ProjectsService) {
+ private _router: Router,
+ private _route: ActivatedRoute,
+ private _projectsService: ProjectsService) {
}
ngOnInit() {
diff --git a/src/app/view/dashboard/system/system-ontologies/system-ontologies.component.spec.ts b/src/app/view/dashboard/system/system-ontologies/system-ontologies.component.spec.ts
index 249ac3da..460b82fb 100644
--- a/src/app/view/dashboard/system/system-ontologies/system-ontologies.component.spec.ts
+++ b/src/app/view/dashboard/system/system-ontologies/system-ontologies.component.spec.ts
@@ -1,8 +1,8 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import {SystemOntologiesComponent} from './system-ontologies.component';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
+import { SystemOntologiesComponent } from './system-ontologies.component';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
describe('SystemOntologiesComponent', () => {
let component: SystemOntologiesComponent;
@@ -24,7 +24,7 @@ describe('SystemOntologiesComponent', () => {
fixture.detectChanges();
});
- xit('should be created', () => {
+ it('should be created', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/system/system-projects/system-projects.component.spec.ts b/src/app/view/dashboard/system/system-projects/system-projects.component.spec.ts
index a01b8ca4..07062677 100644
--- a/src/app/view/dashboard/system/system-projects/system-projects.component.spec.ts
+++ b/src/app/view/dashboard/system/system-projects/system-projects.component.spec.ts
@@ -1,8 +1,8 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import {SystemProjectsComponent} from './system-projects.component';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
+import { SystemProjectsComponent } from './system-projects.component';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
describe('SystemProjectsComponent', () => {
let component: SystemProjectsComponent;
@@ -24,7 +24,7 @@ describe('SystemProjectsComponent', () => {
fixture.detectChanges();
});
- xit('should be created', () => {
+ it('should be created', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/system/system-users/system-users.component.spec.ts b/src/app/view/dashboard/system/system-users/system-users.component.spec.ts
index b5192b58..7656a34e 100644
--- a/src/app/view/dashboard/system/system-users/system-users.component.spec.ts
+++ b/src/app/view/dashboard/system/system-users/system-users.component.spec.ts
@@ -1,8 +1,8 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {SystemUsersComponent} from './system-users.component';
-import {UsersService} from '../../../../model/services/users.service';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { SystemUsersComponent } from './system-users.component';
+import { UsersService } from '@knora/core';
describe('SystemUsersComponent', () => {
let component: SystemUsersComponent;
@@ -27,7 +27,7 @@ describe('SystemUsersComponent', () => {
fixture.detectChanges();
});
- xit('should be created', () => {
+ it('should be created', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/dashboard/system/system.component.html b/src/app/view/dashboard/system/system.component.html
index 6a191eec..fe27738c 100644
--- a/src/app/view/dashboard/system/system.component.html
+++ b/src/app/view/dashboard/system/system.component.html
@@ -1,4 +1,4 @@
-
-
-
-
-
diff --git a/src/app/view/modules/form/ontology-form/ontology-form.component.spec.ts b/src/app/view/modules/form/ontology-form/ontology-form.component.spec.ts
index 4d966348..04b6ccce 100644
--- a/src/app/view/modules/form/ontology-form/ontology-form.component.spec.ts
+++ b/src/app/view/modules/form/ontology-form/ontology-form.component.spec.ts
@@ -1,16 +1,33 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
import { OntologyFormComponent } from './ontology-form.component';
+import { BasicOntologyService } from '../../../../model/services/basic-ontology.service';
describe('OntologyFormComponent', () => {
let component: OntologyFormComponent;
let fixture: ComponentFixture;
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ OntologyFormComponent ]
+ imports: [
+ AppModule,
+ AppRoutingModule
+ ],
+ providers: [BasicOntologyService]
})
- .compileComponents();
+ .compileComponents();
}));
beforeEach(() => {
@@ -19,7 +36,7 @@ describe('OntologyFormComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/form/ontology-form/ontology-form.component.ts b/src/app/view/modules/form/ontology-form/ontology-form.component.ts
index a73265a9..08f9a051 100644
--- a/src/app/view/modules/form/ontology-form/ontology-form.component.ts
+++ b/src/app/view/modules/form/ontology-form/ontology-form.component.ts
@@ -13,14 +13,10 @@
* */
import { Component, Input, OnInit } from '@angular/core';
-import { BasicOntology, PropertyObject, ResourceClass } from '../../../../model/test-data/basic-ontology';
-import { FormBuilder, FormControl, FormGroup, Validator, Validators } from '@angular/forms';
-import { ResourceTypeInfo } from '../../../../model/webapi/knora';
-import { PropertyItem } from '../../../../model/webapi/knora/v1/properties/property-item';
-import { AppConfig } from '../../../../app.config';
-import { ApiServiceResult } from '../../../../model/services/api-service-result';
+import { BasicOntology } from '../../../../model/test-data/basic-ontology';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { BasicOntologyService } from '../../../../model/services/basic-ontology.service';
-import { ApiServiceError } from '../../../../model/services/api-service-error';
+import { ApiServiceError } from '@knora/core';
@Component({
selector: 'salsah-ontology-form',
@@ -321,7 +317,7 @@ export class OntologyFormComponent implements OnInit {
getBasicOntologyInfo() {
this._basicOntologyService.getBasicOntology()
.subscribe(
- (result: ApiServiceResult) => {
+ (result: any) => {
this.basicOntology = result.getBody(BasicOntology);
},
(error: ApiServiceError) => {
diff --git a/src/app/view/modules/form/project-form/project-data/project-data.component.html b/src/app/view/modules/form/project-form/project-data/project-data.component.html
index 7bb93b36..12f76081 100644
--- a/src/app/view/modules/form/project-form/project-data/project-data.component.html
+++ b/src/app/view/modules/form/project-form/project-data/project-data.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -8,10 +9,8 @@
diff --git a/src/app/view/modules/form/resource-class-form/resource-class-form.component.spec.ts b/src/app/view/modules/form/resource-class-form/resource-class-form.component.spec.ts
index 9eabda20..8aca3302 100644
--- a/src/app/view/modules/form/resource-class-form/resource-class-form.component.spec.ts
+++ b/src/app/view/modules/form/resource-class-form/resource-class-form.component.spec.ts
@@ -1,12 +1,12 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ResourceClassFormComponent} from './resource-class-form.component';
-import {BasicOntologyService} from '../../../../model/services/basic-ontology.service';
-import {MatDialogRef} from '@angular/material';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ResourceClassFormComponent } from './resource-class-form.component';
+import { BasicOntologyService } from '../../../../model/services/basic-ontology.service';
+import { MatDialogRef } from '@angular/material';
-describe('ResourceClassFormComponent', () => {
+xdescribe('ResourceClassFormComponent', () => {
let component: ResourceClassFormComponent;
let fixture: ComponentFixture
;
@@ -18,7 +18,7 @@ describe('ResourceClassFormComponent', () => {
],
providers: [
BasicOntologyService,
- {provide: MatDialogRef}
+ { provide: MatDialogRef }
]
})
.compileComponents();
diff --git a/src/app/view/modules/form/resource-class-form/resource-class-form.component.ts b/src/app/view/modules/form/resource-class-form/resource-class-form.component.ts
index 16361261..a2291441 100644
--- a/src/app/view/modules/form/resource-class-form/resource-class-form.component.ts
+++ b/src/app/view/modules/form/resource-class-form/resource-class-form.component.ts
@@ -12,12 +12,11 @@
* License along with SALSAH. If not, see .
* */
-import {Component, OnInit} from '@angular/core';
-import {MatDialog} from '@angular/material';
-import {ApiServiceResult} from '../../../../model/services/api-service-result';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {BasicOntologyService} from '../../../../model/services/basic-ontology.service';
-import {BasicOntology, PropertyObject, ResourceClass} from '../../../../model/test-data/basic-ontology';
+import { Component, OnInit } from '@angular/core';
+import { MatDialog } from '@angular/material';
+import { ApiServiceError, ApiServiceResult } from '@knora/core';
+import { BasicOntologyService } from '../../../../model/services/basic-ontology.service';
+import { BasicOntology, PropertyObject, ResourceClass } from '../../../../model/test-data/basic-ontology';
@Component({
@@ -116,7 +115,7 @@ export class ResourceClassFormComponent implements OnInit {
];
constructor(public dialog: MatDialog,
- private _basicOntologyService: BasicOntologyService) {
+ private _basicOntologyService: BasicOntologyService) {
}
ngOnInit() {
@@ -143,8 +142,8 @@ export class ResourceClassFormComponent implements OnInit {
nextFormSection(cntr: number, e, resClassId?: string) {
-// console.log(this.basicOntology);
-// console.log(this.newResource);
+ // console.log(this.basicOntology);
+ // console.log(this.newResource);
if (resClassId && cntr === 0) {
// get the properties for this resClass and create a default resource class
@@ -153,14 +152,14 @@ export class ResourceClassFormComponent implements OnInit {
this.newResource.id = resClassId;
- for (let rcProp in this.basicOntology.resourceClasses[resClassId].properties) {
-// this.newResource.properties[rcProp].permissions = this.basicOntology.defaultPermissions;
+ for (const rcProp in this.basicOntology.resourceClasses[resClassId].properties) {
+ // this.newResource.properties[rcProp].permissions = this.basicOntology.defaultPermissions;
}
// add all default properties to the new resource properties
- for (let prop in this.basicOntology.defaultProperties) {
-// this.newResource.properties[prop] = this.basicOntology.defaultProperties[prop];
-// this.newResource.properties[prop].permissions = this.basicOntology.defaultPermissions;
+ for (const prop in this.basicOntology.defaultProperties) {
+ // this.newResource.properties[prop] = this.basicOntology.defaultProperties[prop];
+ // this.newResource.properties[prop].permissions = this.basicOntology.defaultPermissions;
}
// set the resource default permissions:
@@ -187,16 +186,16 @@ export class ResourceClassFormComponent implements OnInit {
this.counter = cntr - 1;
}
-// setPerm(prop: PropertyObject, group: any, event: any) {
+ // setPerm(prop: PropertyObject, group: any, event: any) {
setPerm(prop: PropertyObject, group: any, permission: any, event: any) {
console.log(this.newResource);
-// console.log(this.newResource.properties[prop.key].permissions[group.id]);
+ // console.log(this.newResource.properties[prop.key].permissions[group.id]);
console.log(prop);
console.log(permission);
console.log(group.id);
console.log(event.value);
-// prop.value.permissions[group.id] = event.value;
+ // prop.value.permissions[group.id] = event.value;
}
@@ -204,28 +203,31 @@ export class ResourceClassFormComponent implements OnInit {
setProp(property: PropertyObject, event) {
if (event.target.checked === true) {
-// this.newResource.properties[property.key] = property.value;
+ // this.newResource.properties[property.key] = property.value;
} else {
let i: number = 0;
- for (let prop in this.newResource.properties) {
- if (prop === property.key) {
-// this.newResource.properties.splice(i, 1); // <-- this solution is not working ;(
- this.newResource.properties[property.key] = undefined;
+ for (const prop in this.newResource.properties) {
+ if (this.newResource.properties.hasOwnProperty(prop)) {
+ if (prop === property.key) {
+ // this.newResource.properties.splice(i, 1); // <-- this solution is not working ;(
+ this.newResource.properties[property.key] = undefined;
+ }
+ i++;
}
- i++;
+
}
}
}
checkAll(ev) {
-// this.newResource.properties.forEach(x => x.state = ev.target.checked)
+ // this.newResource.properties.forEach(x => x.state = ev.target.checked)
this.newResource.properties.forEach(x => x.label = ev.target.checked);
console.log(ev.target);
}
isAllChecked() {
-// return this.newResource.properties.every(_ => _.state);
+ // return this.newResource.properties.every(_ => _.state);
}
toggleAll(properties: any, event) {
@@ -233,8 +235,7 @@ export class ResourceClassFormComponent implements OnInit {
if (event.target.checked === true) {
this.allProps = true;
this.selectPropsText = 'Deselect all properties';
- }
- else {
+ } else {
this.allProps = false;
this.selectPropsText = 'Select all properties';
diff --git a/src/app/view/modules/form/resource-form/resource-form.component.spec.ts b/src/app/view/modules/form/resource-form/resource-form.component.spec.ts
index 5e18632e..4cb00ef6 100644
--- a/src/app/view/modules/form/resource-form/resource-form.component.spec.ts
+++ b/src/app/view/modules/form/resource-form/resource-form.component.spec.ts
@@ -1,7 +1,7 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ResourceFormComponent} from './resource-form.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ResourceFormComponent } from './resource-form.component';
describe('ResourceFormComponent', () => {
let component: ResourceFormComponent;
@@ -23,7 +23,7 @@ describe('ResourceFormComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/form/user-form/user-data/user-data.component.html b/src/app/view/modules/form/user-form/user-data/user-data.component.html
index 94d380e6..d2410145 100644
--- a/src/app/view/modules/form/user-form/user-data/user-data.component.html
+++ b/src/app/view/modules/form/user-form/user-data/user-data.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -14,16 +15,12 @@
-
+
-
+
{{ formErrors.givenName }}
@@ -31,9 +28,7 @@
-
+
{{ formErrors.familyName }}
@@ -41,13 +36,10 @@
-
+
-
+
{{showPassword ? 'visibility_off' : 'visibility'}}
@@ -59,8 +51,7 @@
-
+
{{ lang.name }}
@@ -91,5 +82,4 @@
-
-
+
\ No newline at end of file
diff --git a/src/app/view/modules/form/user-form/user-data/user-data.component.spec.ts b/src/app/view/modules/form/user-form/user-data/user-data.component.spec.ts
index 4c252e1f..658d8e3a 100644
--- a/src/app/view/modules/form/user-form/user-data/user-data.component.spec.ts
+++ b/src/app/view/modules/form/user-form/user-data/user-data.component.spec.ts
@@ -1,13 +1,15 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import {UserDataComponent} from './user-data.component';
-import {AppModule} from '../../../../../app.module';
-import {UsersService} from '../../../../../model/services/users.service';
+import { UserDataComponent } from './user-data.component';
+import { AppModule } from '../../../../../app.module';
+import { UsersService } from '@knora/core';
describe('UserDataComponent', () => {
let component: UserDataComponent;
let fixture: ComponentFixture;
+ // const id: string = 'http://rdfh.ch/projects/0803';
+
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
diff --git a/src/app/view/modules/form/user-form/user-data/user-data.component.ts b/src/app/view/modules/form/user-form/user-data/user-data.component.ts
index 77223238..44b681ef 100644
--- a/src/app/view/modules/form/user-form/user-data/user-data.component.ts
+++ b/src/app/view/modules/form/user-form/user-data/user-data.component.ts
@@ -11,12 +11,9 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core';
-import {AppConfig} from '../../../../../app.config';
-import {User} from '../../../../../model/webapi/knora';
-import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
-import {ApiServiceError} from '../../../../../model/services/api-service-error';
-import {UsersService} from '../../../../../model/services/users.service';
+import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
+import { ApiServiceError, UsersService, User, Utils } from '@knora/core';
@Component({
selector: 'salsah-user-data',
@@ -55,7 +52,7 @@ export class UserDataComponent implements OnInit, OnChanges {
formErrors = {
'givenName': '',
'familyName': '',
-// 'email': '',
+ // 'email': '',
'password': ''
};
@@ -118,7 +115,7 @@ export class UserDataComponent implements OnInit, OnChanges {
];
constructor(private _usersService: UsersService,
- private _formBuilder: FormBuilder) {
+ private _formBuilder: FormBuilder) {
}
ngOnInit() {
@@ -168,38 +165,38 @@ export class UserDataComponent implements OnInit, OnChanges {
'givenName': new FormControl({
value: user.givenName, disabled: false
}, [
- Validators.required
- ]),
+ Validators.required
+ ]),
'familyName': new FormControl({
value: user.familyName, disabled: false
}, [
- Validators.required
- ]),
+ Validators.required
+ ]),
'email': new FormControl({
value: user.email, disabled: true
}),
'password': new FormControl({
value: user.password, disabled: (edit)
}, [
- Validators.required,
- Validators.minLength(8),
- Validators.pattern(AppConfig.RegexPassword)
- ]),
+ Validators.required,
+ Validators.minLength(8),
+ Validators.pattern(Utils.RegexPassword)
+ ]),
'lang': new FormControl({
value: (user.lang ? user.lang : 'en'), disabled: false
})
-// 'status': user.userData.status,
-// 'systemAdmin': this.sysAdminPermission,
-// 'group': null
+ // 'status': user.userData.status,
+ // 'systemAdmin': this.sysAdminPermission,
+ // 'group': null
});
-// this.isLoading = false;
+ // this.isLoading = false;
this.userDataForm.valueChanges
.subscribe(data => this.onValueChanged(data));
-// this.onValueChanged(); // (re)set validation messages now
+ // this.onValueChanged(); // (re)set validation messages now
}
diff --git a/src/app/view/modules/form/user-form/user-form.component.html b/src/app/view/modules/form/user-form/user-form.component.html
index 132ebf92..f73dc82c 100644
--- a/src/app/view/modules/form/user-form/user-form.component.html
+++ b/src/app/view/modules/form/user-form/user-form.component.html
@@ -12,20 +12,14 @@
-
+
-
+
{{ 'salsahLabels.form.action.next' | translate }}
-
+
{{ user?.label }}
@@ -49,10 +43,7 @@
{{ 'salsahLabels.form.user.title.formWizard.step_2' | translate }}
-
+
@@ -67,11 +58,7 @@
{{ 'salsahLabels.form.user.title.formWizard.step_3' | translate }}
-
+
@@ -90,20 +77,21 @@
-
+
+
-
- {{ 'salsahLabels.form.user.title.edit' | translate }}
-
+
+ {{ 'salsahLabels.form.user.title.edit' | translate }}
+
- {{ 'salsahLabels.form.user.title.new' | translate }}
-
+ {{ 'salsahLabels.form.user.title.new' | translate }}
+
-
- {{selectedUser?.givenName}} {{selectedUser?.familyName}}, {{selectedUser?.email}}
-
+
+ {{selectedUser?.givenName}} {{selectedUser?.familyName}}, {{selectedUser?.email}}
+
{{userErrorMessage?.statusText}}
@@ -112,8 +100,8 @@
-
+
+
{{ 'salsahLabels.form.member.title.project' | translate }}
@@ -130,14 +118,15 @@
-
+
+
{{ 'salsahLabels.form.member.title.group' | translate}}
- • {{group.name}}
+ • {{group.name}}
+
+
{{permissionsErrorMessage?.statusText}}
@@ -152,8 +141,7 @@
{{ 'salsahLabels.form.action.back' | translate }}
-
+
{{ 'salsahLabels.form.action.submit' | translate }}
+-->
\ No newline at end of file
diff --git a/src/app/view/modules/form/user-form/user-form.component.spec.ts b/src/app/view/modules/form/user-form/user-form.component.spec.ts
index 07784762..06d8a83a 100644
--- a/src/app/view/modules/form/user-form/user-form.component.spec.ts
+++ b/src/app/view/modules/form/user-form/user-form.component.spec.ts
@@ -1,11 +1,10 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {UsersService} from '../../../../model/services/users.service';
-import {MatDialogRef} from '@angular/material';
-import {UserFormComponent} from './user-form.component';
-import {ProjectTeamComponent} from '../../../dashboard/project/project-team/project-team.component';
-import {Project} from '../../../../model/webapi/knora/';
-import {imagesProject} from '../../../../model/test-data/shared-test-data';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { Project, UsersService } from '@knora/core';
+import { MatDialogRef } from '@angular/material';
+import { UserFormComponent } from './user-form.component';
+import { ProjectTeamComponent } from '../../../dashboard/project/project-team/project-team.component';
+import { imagesProject } from '../../../../model/test-data/shared-test-data';
describe('UserFormComponent', () => {
let component: UserFormComponent;
@@ -26,6 +25,16 @@ describe('UserFormComponent', () => {
'sysAdmin': false
};
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -35,7 +44,7 @@ describe('UserFormComponent', () => {
providers: [
UsersService,
ProjectTeamComponent,
- {provide: MatDialogRef}
+ { provide: MatDialogRef }
]
})
.compileComponents();
@@ -70,7 +79,7 @@ describe('UserFormComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(sessionStorage.getItem('currentMembers')).toBe(JSON.stringify(testMembers));
expect(sessionStorage.getItem('currentProject')).toBe(JSON.stringify(testProject));
expect(localStorage.getItem('currentUser')).toBe(JSON.stringify(currentTestUser));
diff --git a/src/app/view/modules/form/user-form/user-form.component.ts b/src/app/view/modules/form/user-form/user-form.component.ts
index b416645c..44bf0922 100644
--- a/src/app/view/modules/form/user-form/user-form.component.ts
+++ b/src/app/view/modules/form/user-form/user-form.component.ts
@@ -11,20 +11,13 @@
* License along with SALSAH. If not, see .
* */
-import {Component, Input, OnInit, ViewChild} from '@angular/core';
-import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
-import {Observable} from 'rxjs/Observable';
-import {startWith} from 'rxjs/operators/startWith';
-import {map} from 'rxjs/operators/map';
+import { Component, Input, OnInit, ViewChild } from '@angular/core';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
+import { Observable } from 'rxjs';
+import { startWith, map } from 'rxjs/operators';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-
-import {UsersService} from '../../../../model/services/users.service';
-
-import {AutocompleteItem} from '../../../../app.interfaces';
-import {User} from '../../../../model/webapi/knora';
-import {AppConfig} from '../../../../app.config';
-import {Project} from '../../../../model/webapi/knora/admin';
+import { ApiServiceError, KnoraConstants, Project, User, UsersService, Utils } from '@knora/core';
+import { AutocompleteItem } from '../../../../app.interfaces';
@Component({
selector: 'salsah-user-form',
@@ -137,7 +130,7 @@ export class UserFormComponent implements OnInit {
constructor(public _usersService: UsersService,
- private _formBuilder: FormBuilder) {
+ private _formBuilder: FormBuilder) {
}
@@ -230,10 +223,10 @@ export class UserFormComponent implements OnInit {
'username': new FormControl({
value: '', disabled: false
}, [
- Validators.required,
- Validators.pattern(AppConfig.RegexEmail)
-// existingNamesValidator(this.existingUserNames)
- ])
+ Validators.required,
+ Validators.pattern(Utils.RegexEmail)
+ // existingNamesValidator(this.existingUserNames)
+ ])
});
this.userFormGroup.valueChanges
@@ -372,7 +365,7 @@ export class UserFormComponent implements OnInit {
// next step: add user (by iri) to the project (if any is selected)
if (this.selectedProject) {
-// console.log(this.isAlreadyMember);
+ // console.log(this.isAlreadyMember);
if (!this.isAlreadyMember) {
this.addUserToProject(result.id);
} else {
@@ -459,7 +452,7 @@ export class UserFormComponent implements OnInit {
setGroupsPermissions(userIri: string) {
- const projectAdmin: boolean = (!!this.selectedGroups.find( ad => ad.iri === AppConfig.ProjectAdminGroup));
+ const projectAdmin: boolean = (!!this.selectedGroups.find(ad => ad.iri === KnoraConstants.ProjectAdminGroupIRI));
if (projectAdmin) {
this._usersService.addUserToProjectAdmin(userIri, this.selectedProject.iri).subscribe(
diff --git a/src/app/view/modules/form/user-form/user-password/user-password.component.html b/src/app/view/modules/form/user-form/user-password/user-password.component.html
index 0cb7cfb9..6440f5cf 100644
--- a/src/app/view/modules/form/user-form/user-password/user-password.component.html
+++ b/src/app/view/modules/form/user-form/user-password/user-password.component.html
@@ -1,6 +1,7 @@
-
+
+
@@ -9,7 +10,7 @@
{{ 'salsahLabels.form.user.title.password' | translate }}
-
+
-
+
diff --git a/src/app/view/modules/form/user-form/user-password/user-password.component.spec.ts b/src/app/view/modules/form/user-form/user-password/user-password.component.spec.ts
index 9a5d61c7..06fa9a9a 100644
--- a/src/app/view/modules/form/user-form/user-password/user-password.component.spec.ts
+++ b/src/app/view/modules/form/user-form/user-password/user-password.component.spec.ts
@@ -1,13 +1,25 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import {UserPasswordComponent} from './user-password.component';
-import {AppModule} from '../../../../../app.module';
-import {UsersService} from '../../../../../model/services/users.service';
+import { UserPasswordComponent } from './user-password.component';
+import { AppModule } from '../../../../../app.module';
+import { UsersService } from '@knora/core';
describe('UserPasswordComponent', () => {
let component: UserPasswordComponent;
let fixture: ComponentFixture;
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+
+
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
diff --git a/src/app/view/modules/form/user-form/user-password/user-password.component.ts b/src/app/view/modules/form/user-form/user-password/user-password.component.ts
index 0128f5bf..5e76808d 100644
--- a/src/app/view/modules/form/user-form/user-password/user-password.component.ts
+++ b/src/app/view/modules/form/user-form/user-password/user-password.component.ts
@@ -12,10 +12,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
-import { AppConfig } from '../../../../../app.config';
-import { ApiServiceError } from '../../../../../model/services/api-service-error';
-import { User } from '../../../../../model/webapi/knora';
-import { UsersService } from '../../../../../model/services/users.service';
+import { ApiServiceError, KnoraConstants, User, UsersService, Utils } from '@knora/core';
@Component({
selector: 'salsah-user-password',
@@ -76,7 +73,7 @@ export class UserPasswordComponent implements OnInit {
constructor(private _usersService: UsersService,
- private _formBuilder: FormBuilder) {
+ private _formBuilder: FormBuilder) {
}
ngOnInit() {
@@ -85,16 +82,16 @@ export class UserPasswordComponent implements OnInit {
'requesterPassword': new FormControl({
value: '', disabled: false
}, [
- Validators.required
- ]),
+ Validators.required
+ ]),
'newPassword': new FormControl({
value: '', disabled: false
}, [
- Validators.required,
- Validators.minLength(8),
- Validators.pattern(AppConfig.RegexPassword)
+ Validators.required,
+ Validators.minLength(8),
+ Validators.pattern(Utils.RegexPassword)
- ])
+ ])
});
this.requesterPasswordForm = this._formBuilder.group({
'requesterPassword': new FormControl({
@@ -110,7 +107,7 @@ export class UserPasswordComponent implements OnInit {
}, [
Validators.required,
Validators.minLength(8),
- Validators.pattern(AppConfig.RegexPassword)
+ Validators.pattern(Utils.RegexPassword)
])
});
@@ -128,7 +125,7 @@ export class UserPasswordComponent implements OnInit {
this.isLoading = false;
// get the user data only if a user is logged in
- this.loggedInUser = JSON.parse(localStorage.getItem('currentUser'));
+ this.loggedInUser = JSON.parse(localStorage.getItem('session'));
}
@@ -184,7 +181,7 @@ export class UserPasswordComponent implements OnInit {
this._usersService.updateUser(this.userIri, this.userPasswordForm.value).subscribe(
(result: User) => {
- console.log(this.userPasswordForm.value);
+ // console.log(this.userPasswordForm.value);
this.success = true;
this.isLoading = false;
},
@@ -241,7 +238,7 @@ export class UserPasswordComponent implements OnInit {
this.isLoading = false;
}
- )
+ );
this.oldPswd = !this.oldPswd;
diff --git a/src/app/view/modules/form/user-form/user-role/user-role.component.html b/src/app/view/modules/form/user-form/user-role/user-role.component.html
index 9c825eef..0a7f2f9d 100644
--- a/src/app/view/modules/form/user-form/user-role/user-role.component.html
+++ b/src/app/view/modules/form/user-form/user-role/user-role.component.html
@@ -1,12 +1,12 @@
-
+
+
-
+
{{ project.name }}
@@ -17,8 +17,8 @@
-->
-
+
{{ group.name }}
@@ -50,5 +50,4 @@
-
-
+
\ No newline at end of file
diff --git a/src/app/view/modules/form/user-form/user-role/user-role.component.spec.ts b/src/app/view/modules/form/user-form/user-role/user-role.component.spec.ts
index 622a06f6..a716ab92 100644
--- a/src/app/view/modules/form/user-form/user-role/user-role.component.spec.ts
+++ b/src/app/view/modules/form/user-form/user-role/user-role.component.spec.ts
@@ -2,8 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserRoleComponent } from './user-role.component';
import { AppModule } from '../../../../../app.module';
-import { ProjectsService } from '../../../../../model/services/projects.service';
-import { GroupsService } from '../../../../../model/services/groups.service';
+import { GroupsService, ProjectsService } from '@knora/core';
describe('UserRoleComponent', () => {
let component: UserRoleComponent;
@@ -11,7 +10,7 @@ describe('UserRoleComponent', () => {
let originalTimeout;
- beforeEach(function() {
+ beforeEach(function () {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});
diff --git a/src/app/view/modules/form/user-form/user-role/user-role.component.ts b/src/app/view/modules/form/user-form/user-role/user-role.component.ts
index 58dffd6b..29c02fdb 100644
--- a/src/app/view/modules/form/user-form/user-role/user-role.component.ts
+++ b/src/app/view/modules/form/user-form/user-role/user-role.component.ts
@@ -11,14 +11,10 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core';
-import {AutocompleteItem} from '../../../../../app.interfaces';
-import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
-import {AppConfig} from '../../../../../app.config';
-import {ProjectsService} from '../../../../../model/services/projects.service';
-import {Group, Project, User} from '../../../../../model/webapi/knora/admin';
-import {ApiServiceError} from '../../../../../model/services/api-service-error';
-import {GroupsService} from '../../../../../model/services/groups.service';
+import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
+import { AutocompleteItem } from '../../../../../app.interfaces';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
+import { ApiServiceError, Group, GroupsService, KnoraConstants, Project, ProjectsService, User } from '@knora/core';
@Component({
selector: 'salsah-user-role',
@@ -68,16 +64,16 @@ export class UserRoleComponent implements OnInit {
// default permission groups / role of the user in a project
defaultGroups: AutocompleteItem[] = [
{
- iri: AppConfig.ProjectMemberGroup,
+ iri: KnoraConstants.ProjectMemberGroupIRI,
name: 'Member'
},
{
- iri: AppConfig.ProjectAdminGroup,
+ iri: KnoraConstants.ProjectAdminGroupIRI,
name: 'Administrator'
}
/* use the following in system view only!
{
- iri: AppConfig.SystemAdminGroup,
+ iri: KnoraConstants.SystemAdminGroupIRI,
name: '',
label: 'System admin'
}
@@ -89,12 +85,12 @@ export class UserRoleComponent implements OnInit {
groups: Group[];
groupsList: AutocompleteItem[];
- usersDefaultGroup: string = AppConfig.ProjectMemberGroup;
+ usersDefaultGroup: string = KnoraConstants.ProjectMemberGroupIRI;
selectedGroups: string[] = [this.usersDefaultGroup];
constructor(private _projectsService: ProjectsService,
- private _groupsService: GroupsService,
- private _formBuilder: FormBuilder) {
+ private _groupsService: GroupsService,
+ private _formBuilder: FormBuilder) {
}
ngOnInit() {
@@ -259,12 +255,12 @@ export class UserRoleComponent implements OnInit {
// collect project information
let project: AutocompleteItem;
const piri: string = (!this.projectIri ? this.userRoleForm.value['project'] : this.projectIri);
- project = this.projectsList.find( p => p.iri === piri );
+ project = this.projectsList.find(p => p.iri === piri);
// collect groups information
const groups: any = [];
for (const giri of this.userRoleForm.value['group']) {
- const group: AutocompleteItem = this.groupsList.find( g => g.iri === giri);
+ const group: AutocompleteItem = this.groupsList.find(g => g.iri === giri);
groups.push(group);
}
diff --git a/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.html b/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.html
index cd4a4976..efb24140 100644
--- a/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.html
+++ b/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.html
@@ -19,7 +19,7 @@
-
+ (refreshComponent)="updateSession()">
+ [restrictedBy]="list.restrictedBy">
diff --git a/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.spec.ts b/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.spec.ts
index e24ac080..eeee7c47 100644
--- a/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.spec.ts
+++ b/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.spec.ts
@@ -1,11 +1,11 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
-import {FrameworkForListingsComponent} from './framework-for-listings.component';
-import {RouterTestingModule} from '@angular/router/testing';
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {MatDialogRef} from '@angular/material';
+import { FrameworkForListingsComponent } from './framework-for-listings.component';
+import { RouterTestingModule } from '@angular/router/testing';
+import { NO_ERRORS_SCHEMA } from '@angular/core';
+import { MatDialogRef } from '@angular/material';
describe('FrameworkForListingsComponent', () => {
let component: FrameworkForListingsComponent;
@@ -19,8 +19,8 @@ describe('FrameworkForListingsComponent', () => {
RouterTestingModule
],
providers: [
- {provide: NO_ERRORS_SCHEMA},
- {provide: MatDialogRef}
+ { provide: NO_ERRORS_SCHEMA },
+ { provide: MatDialogRef }
]
})
.compileComponents();
diff --git a/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.ts b/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.ts
index 5ab3b146..6df5ba1a 100644
--- a/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.ts
+++ b/src/app/view/modules/framework/framework-for-listings/framework-for-listings.component.ts
@@ -206,7 +206,8 @@ export class FrameworkForListingsComponent implements OnInit, OnChanges, AfterVi
title: this.add.title,
description: this.add.description,
form: this.add.type,
- restriction: this.list.restrictedBy
+ restriction: this.list.restrictedBy,
+ fullSize: (form === 'ontology')
};
config.panelClass = 'resizable';
@@ -244,10 +245,6 @@ export class FrameworkForListingsComponent implements OnInit, OnChanges, AfterVi
}
getData(id?: string) {
- // get the logged-in user information and check if the user has (system) admin rights
- if (localStorage.getItem('currentUser') !== null) {
- this.loggedInAdmin = JSON.parse(localStorage.getItem('currentUser')).sysAdmin;
- }
if (this.list === undefined || this.list === null) {
// list is not optional! show an error message
diff --git a/src/app/view/modules/framework/main-framework/footer/footer.component.spec.ts b/src/app/view/modules/framework/main-framework/footer/footer.component.spec.ts
index 6738221f..45ae2bcb 100644
--- a/src/app/view/modules/framework/main-framework/footer/footer.component.spec.ts
+++ b/src/app/view/modules/framework/main-framework/footer/footer.component.spec.ts
@@ -1,7 +1,7 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../../app.module';
-import {AppRoutingModule} from '../../../../../app-routing.module';
-import {FooterComponent} from './footer.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../../app.module';
+import { AppRoutingModule } from '../../../../../app-routing.module';
+import { FooterComponent } from './footer.component';
describe('FooterComponent', () => {
let component: FooterComponent;
@@ -23,7 +23,7 @@ describe('FooterComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/framework/main-framework/header/header-projects/header-projects.component.spec.ts b/src/app/view/modules/framework/main-framework/header/header-projects/header-projects.component.spec.ts
index 5dabb179..89f8896b 100644
--- a/src/app/view/modules/framework/main-framework/header/header-projects/header-projects.component.spec.ts
+++ b/src/app/view/modules/framework/main-framework/header/header-projects/header-projects.component.spec.ts
@@ -1,12 +1,23 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../../../app.module';
-import {AppRoutingModule} from '../../../../../../app-routing.module';
-import {HeaderProjectsComponent} from './header-projects.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../../../app.module';
+import { AppRoutingModule } from '../../../../../../app-routing.module';
+import { HeaderProjectsComponent } from './header-projects.component';
describe('HeaderProjectsComponent', () => {
let component: HeaderProjectsComponent;
let fixture: ComponentFixture;
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
@@ -23,7 +34,8 @@ describe('HeaderProjectsComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
+
diff --git a/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.html b/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.html
index 4a46b678..f00c3ab1 100644
--- a/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.html
+++ b/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.html
@@ -31,59 +31,59 @@
+
+
+
+
+
+
+ create_new_folder
+
+ Project
+
+
+
+
+
+ library_add
+
+ Collection
+
+
+
+
+
+ note_add
+
+ Resource
+
+
+
+
+
-
-
-
+
Log In
diff --git a/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.spec.ts b/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.spec.ts
index 8a4ef751..162095af 100644
--- a/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.spec.ts
+++ b/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.spec.ts
@@ -1,8 +1,8 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../../../app.module';
-import {AppRoutingModule} from '../../../../../../app-routing.module';
-import {HeaderToolbarComponent} from './header-toolbar.component';
-import {AuthenticationService} from '../../../../../../model/services/authentication.service';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../../../app.module';
+import { AppRoutingModule } from '../../../../../../app-routing.module';
+import { HeaderToolbarComponent } from './header-toolbar.component';
+import { UsersService } from '@knora/core';
describe('HeaderToolbarComponent', () => {
let component: HeaderToolbarComponent;
@@ -14,6 +14,18 @@ describe('HeaderToolbarComponent', () => {
'sysAdmin': false
};
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+
+
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
@@ -21,7 +33,7 @@ describe('HeaderToolbarComponent', () => {
AppRoutingModule
],
providers: [
- AuthenticationService
+ UsersService
],
})
.compileComponents();
@@ -55,7 +67,7 @@ describe('HeaderToolbarComponent', () => {
fixture.detectChanges();
});
- xit('should get the user data', () => {
+ it('should get the user data', () => {
expect(localStorage.getItem('currentUser')).toBe(JSON.stringify(currentTestUser));
expect(component).toBeTruthy();
});
diff --git a/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.ts b/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.ts
index 3af83922..889c63fe 100644
--- a/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.ts
+++ b/src/app/view/modules/framework/main-framework/header/header-toolbar/header-toolbar.component.ts
@@ -12,14 +12,15 @@
* License along with SALSAH. If not, see .
* */
-import {Component, OnInit, HostListener, ElementRef} from '@angular/core';
-import {ActivatedRoute, Router} from '@angular/router';
-import {animate, state, style, transition, trigger} from '@angular/animations';
-import {MatDialog, MatDialogConfig} from '@angular/material';
-import {MessageDialogComponent} from 'app/view/modules/dialog/message-dialog/message-dialog.component';
-import {FormDialogComponent} from '../../../../dialog/form-dialog/form-dialog.component';
-import {MessageData} from '../../../../message/message.component';
-import {AuthenticationService} from '../../../../../../model/services/authentication.service';
+import { animate, state, style, transition, trigger } from '@angular/animations';
+import { Component, ElementRef, HostListener, OnInit } from '@angular/core';
+import { MatDialog, MatDialogConfig } from '@angular/material';
+import { ActivatedRoute, NavigationStart, Router } from '@angular/router';
+import { AuthenticationService } from '@knora/authentication';
+import { Session } from '@knora/core';
+import { MessageDialogComponent } from 'app/view/modules/dialog/message-dialog/message-dialog.component';
+import { FormDialogComponent } from '../../../../dialog/form-dialog/form-dialog.component';
+import { MessageData } from '../../../../message/message.component';
@Component({
@@ -103,35 +104,51 @@ export class HeaderToolbarComponent implements OnInit {
private _dialog: MatDialog,
private _route: ActivatedRoute,
private _router: Router,
- private _authenticationService: AuthenticationService) {
- }
-
- ngOnInit() {
- // check if a user is logged-in
- this._authenticationService.authenticate().subscribe(result => this.activeSession = result);
+ private _auth: AuthenticationService) {
+
+ this._router.events.forEach((event) => {
+ if (event instanceof NavigationStart) {
+
+ if (this._auth.session()) {
+ // a user is logged-in, and the session is valid
+ // get the user information
+ const session: Session = JSON.parse(localStorage.getItem('session'));
+ this.sysAdmin = session.user.sysAdmin;
+ // TODO: fix this ugly construction
+ let i: number = 0;
+ for (const entry of this.userMenu) {
+ // remove entry, if exists already
+ if (entry.route === 'system') {
+ this.userMenu.splice(i, 1);
+ }
+ i++;
+ }
+
+ if (this.sysAdmin) {
+ this.userMenu.push({
+ title: 'System',
+ icon: 'build',
+ route: 'system'
+ });
+ }
+
+ this.userName = session.user.name;
+ }
- if (JSON.parse(localStorage.getItem('currentUser'))) {
-
- this.userName = JSON.parse(localStorage.getItem('currentUser')).email;
+ }
+ });
- this.sysAdmin = JSON.parse(localStorage.getItem('currentUser')).sysAdmin;
+ }
- if (this.sysAdmin === true) {
- this.userMenu.push({
- title: 'System',
- icon: 'build',
- route: 'system'
- });
- }
- }
+ ngOnInit() {
}
@HostListener('document:click', ['$event'])
public onClick(event) {
if (!this._eleRef.nativeElement.contains(event.target)) {
-// this.focusOnUserMenu = (this.focusOnUserMenu === 'active' ? 'inactive' : 'active');
-// this.focusOnAddMenu = (this.focusOnAddMenu === 'active' ? 'inactive' : 'active');
+ // this.focusOnUserMenu = (this.focusOnUserMenu === 'active' ? 'inactive' : 'active');
+ // this.focusOnAddMenu = (this.focusOnAddMenu === 'active' ? 'inactive' : 'active');
if (this.focusOnUserMenu === 'active') {
this.focusOnUserMenu = 'inactive';
}
@@ -186,15 +203,18 @@ export class HeaderToolbarComponent implements OnInit {
}
}
-
goToLoginPage() {
- let goToUrl = '/login';
+ const goToUrl = '/login';
+ /*
+ // TODO: we have to fix the following idea: after login, go back to the previous url; right now (2018-09-05) it doesn't work with the setup of @knora/authentication)
+ //
+ if (this._router.url !== '/') {
+ goToUrl += '/?h=' + encodeURIComponent(this._router.url);
+ }
+ */
- if (this._router.url !== '/') {
- goToUrl += '/?h=' + encodeURIComponent(this._router.url);
- }
window.location.replace(goToUrl);
-// this._router.navigate([goToUrl]);
+ // this._router.navigate([goToUrl]);
}
}
diff --git a/src/app/view/modules/framework/main-framework/header/header.component.html b/src/app/view/modules/framework/main-framework/header/header.component.html
index 21dd2d9b..79a4f706 100644
--- a/src/app/view/modules/framework/main-framework/header/header.component.html
+++ b/src/app/view/modules/framework/main-framework/header/header.component.html
@@ -2,8 +2,7 @@
@@ -16,8 +15,8 @@
-
+ simple and extended search menu from @knora/search -->
+
diff --git a/src/app/view/modules/framework/main-framework/header/header.component.spec.ts b/src/app/view/modules/framework/main-framework/header/header.component.spec.ts
index 28fa6e76..ab7e0a75 100644
--- a/src/app/view/modules/framework/main-framework/header/header.component.spec.ts
+++ b/src/app/view/modules/framework/main-framework/header/header.component.spec.ts
@@ -1,13 +1,22 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../../app.module';
-import {AppRoutingModule} from '../../../../../app-routing.module';
-import {HeaderComponent} from './header.component';
-import {AuthenticationService} from '../../../../../model/services/authentication.service';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../../app.module';
+import { AppRoutingModule } from '../../../../../app-routing.module';
+import { HeaderComponent } from './header.component';
+import { UsersService } from '@knora/core';
describe('HeaderComponent', () => {
let component: HeaderComponent;
let fixture: ComponentFixture;
+ let originalTimeout;
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
@@ -15,7 +24,7 @@ describe('HeaderComponent', () => {
AppRoutingModule
],
providers: [
- AuthenticationService
+ UsersService
]
})
.compileComponents();
@@ -27,7 +36,7 @@ describe('HeaderComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.html b/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.html
index 3a967f96..126a14b3 100644
--- a/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.html
+++ b/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.html
@@ -1,7 +1,10 @@
-
+
+
+
{{selectedLang}}
-
+
diff --git a/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.spec.ts b/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.spec.ts
index b0b1c534..cebf4949 100644
--- a/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.spec.ts
+++ b/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.spec.ts
@@ -1,25 +1,39 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InternationalizationComponent } from './internationalization.component';
+import { AppModule } from '../../../../../app.module';
+import { AppRoutingModule } from '../../../../../app-routing.module';
describe('InternationalizationComponent', () => {
- let component: InternationalizationComponent;
- let fixture: ComponentFixture;
+ let component: InternationalizationComponent;
+ let fixture: ComponentFixture;
+ let originalTimeout;
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ InternationalizationComponent ]
- })
- .compileComponents();
- }));
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
- beforeEach(() => {
- fixture = TestBed.createComponent(InternationalizationComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ AppModule,
+ AppRoutingModule
+ ],
+ })
+ .compileComponents();
+ }));
- xit('should create', () => {
- expect(component).toBeTruthy();
- });
+ beforeEach(() => {
+ fixture = TestBed.createComponent(InternationalizationComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
});
diff --git a/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.ts b/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.ts
index 625a8882..0ea91399 100644
--- a/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.ts
+++ b/src/app/view/modules/framework/main-framework/internationalization/internationalization.component.ts
@@ -1,7 +1,6 @@
-///
import {Component, OnInit, OnDestroy} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
-import {Subscription} from 'rxjs/Subscription';
+import {Subscription} from 'rxjs';
import {LanguageService} from '../../../../../model/services/language.service';
@Component({
diff --git a/src/app/view/modules/listing/collections-list/collections-list.component.spec.ts b/src/app/view/modules/listing/collections-list/collections-list.component.spec.ts
index 1ea93c18..6aa34801 100644
--- a/src/app/view/modules/listing/collections-list/collections-list.component.spec.ts
+++ b/src/app/view/modules/listing/collections-list/collections-list.component.spec.ts
@@ -1,6 +1,6 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {CollectionsListComponent} from './collections-list.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { CollectionsListComponent } from './collections-list.component';
describe('CollectionListComponent', () => {
let component: CollectionsListComponent;
diff --git a/src/app/view/modules/listing/lists-list/lists-list.component.html b/src/app/view/modules/listing/lists-list/lists-list.component.html
index 20904a22..0182896c 100644
--- a/src/app/view/modules/listing/lists-list/lists-list.component.html
+++ b/src/app/view/modules/listing/lists-list/lists-list.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -8,10 +9,9 @@
0; else noData">
-
-
+
+
@@ -36,12 +36,10 @@
-
+
{{item.labels[0].value}}
-
+
edit
@@ -53,13 +51,15 @@
list
- {{listLists.nodesLabel}}
+
+ {{listLists.nodesLabel}}
Drag and drop the nodes to reorder
-
+
+
{{listLists.buttons.expand}}
@@ -80,20 +80,19 @@
-
-
-
Number of sub-nodes: {{node.children.length}}
-
-
-
+
+
+
+
+ Number of sub-nodes: {{node.children.length}}
+
+
+
+
edit
-
+
+
@@ -115,5 +114,4 @@
-
-
+
\ No newline at end of file
diff --git a/src/app/view/modules/listing/lists-list/lists-list.component.spec.ts b/src/app/view/modules/listing/lists-list/lists-list.component.spec.ts
index a0b75a2f..17372a31 100644
--- a/src/app/view/modules/listing/lists-list/lists-list.component.spec.ts
+++ b/src/app/view/modules/listing/lists-list/lists-list.component.spec.ts
@@ -1,25 +1,35 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
import { ListsListComponent } from './lists-list.component';
describe('ListsListComponent', () => {
- let component: ListsListComponent;
- let fixture: ComponentFixture;
+ let component: ListsListComponent;
+ let fixture: ComponentFixture;
+ let originalTimeout;
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ ListsListComponent ]
- })
- .compileComponents();
- }));
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
- beforeEach(() => {
- fixture = TestBed.createComponent(ListsListComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [AppModule]
+ })
+ .compileComponents();
+ }));
- xit('should create', () => {
- expect(component).toBeTruthy();
- });
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ListsListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
});
diff --git a/src/app/view/modules/listing/lists-list/lists-list.component.ts b/src/app/view/modules/listing/lists-list/lists-list.component.ts
index 8fe0abaa..65d80644 100644
--- a/src/app/view/modules/listing/lists-list/lists-list.component.ts
+++ b/src/app/view/modules/listing/lists-list/lists-list.component.ts
@@ -12,17 +12,14 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {ListsService} from '../../../../model/services/lists.service';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {MessageData} from '../../message/message.component';
-import {List, ListInfo, ListNode, User} from '../../../../model/webapi/knora';
-import {FormDialogComponent} from '../../dialog/form-dialog/form-dialog.component';
-import {MatDialog, MatDialogConfig} from '@angular/material';
-import {TreeNode} from 'angular-tree-component/dist/models/tree-node.model';
-import {AuthenticationService} from '../../../../model/services/authentication.service';
-import {AppConfig} from '../../../../app.config';
-import {UsersService} from '../../../../model/services/users.service';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { ApiServiceError, List, ListInfo, ListNode, ListsService, KnoraConstants, User, UsersService, ListResponse } from '@knora/core';
+import { MessageData } from '../../message/message.component';
+import { } from '../../../../model/webapi/knora';
+import { FormDialogComponent } from '../../dialog/form-dialog/form-dialog.component';
+import { MatDialog, MatDialogConfig } from '@angular/material';
+import { TreeNode } from 'angular-tree-component/dist/models/tree-node.model';
+import { map } from 'rxjs/operators';
@Component({
selector: 'salsah-lists-list',
@@ -55,16 +52,16 @@ export class ListsListComponent implements OnInit {
// default permission groups / role of the user in a project
// defaultGroups: AutocompleteItem[] = [
// {
- // iri: AppConfig.ProjectMemberGroup,
+ // iri: KnoraConstants.ProjectMemberGroupIRI,
// name: 'Member'
// },
// {
- // iri: AppConfig.ProjectAdminGroup,
+ // iri: KnoraConstants.ProjectAdminGroupIRI,
// name: 'Administrator'
// }
/* use the following in system view only!
{
- iri: AppConfig.SystemAdminGroup,
+ iri: KnoraConstants.SystemAdminGroupIRI,
name: '',
label: 'System admin'
}
@@ -80,7 +77,7 @@ export class ListsListComponent implements OnInit {
statusText: 'It seems there\'s no list yet. Add a new one with the button above ↑'
};
- lists: ListInfo[] = [];
+ lists: List[] = [];
numberOfItems: number;
currentNodes: ListNode[];
@@ -109,9 +106,9 @@ export class ListsListComponent implements OnInit {
};
constructor(private _listsService: ListsService,
- private _authenticationService: AuthenticationService,
- private _usersService: UsersService,
- public _dialog: MatDialog) {
+ private _authenticationService: UsersService,
+ private _usersService: UsersService,
+ public _dialog: MatDialog) {
}
ngOnInit() {
@@ -119,9 +116,10 @@ export class ListsListComponent implements OnInit {
// get all project lists
this._listsService.getLists(this.restrictedBy)
.subscribe(
- (lists: List[]) => {
- this.lists = lists.map(value => value.listinfo);
- this.numberOfItems = lists.length;
+ (result: List[]) => {
+ // console.log('lists with IRI from lists list: ', result);
+ this.lists = result;
+ this.numberOfItems = this.lists.length;
this.isLoading = false;
},
(error: ApiServiceError) => {
@@ -134,8 +132,9 @@ export class ListsListComponent implements OnInit {
// get all system lists
this._listsService.getLists()
.subscribe(
- (lists: List[]) => {
- this.lists = lists.map(value => value.listinfo);
+ (result: List[]) => {
+ // console.log('lists from lists list: ', result);
+ this.lists = result;
this.isLoading = false;
},
(error: ApiServiceError) => {
@@ -145,7 +144,7 @@ export class ListsListComponent implements OnInit {
);
}
- console.log('projectIri:', this.restrictedBy);
+ // console.log('projectIri:', this.restrictedBy);
this.isExpanded = false;
@@ -162,15 +161,14 @@ export class ListsListComponent implements OnInit {
allowDrag: this.nodeDrag,
allowDrop: this.nodeDrop,
};
- }
- else {
+ } else {
this._usersService.getUserByEmail(this.loggedInUser.email).subscribe(
(result: User) => {
// return full user details and check if they have administrative permissions for this project
this.currentUser = result;
this.projectAdmin = this.currentUser.permissions.administrativePermissionsPerProject[this.restrictedBy];
- console.log('full user details: ', this.currentUser);
- console.log('project Admin details: ', this.projectAdmin);
+ // console.log('full user details: ', this.currentUser);
+ // console.log('project Admin details: ', this.projectAdmin);
if (this.projectAdmin.length > 0) {
// console.log('projectAdmin ');
@@ -193,8 +191,8 @@ export class ListsListComponent implements OnInit {
}
);
}
- }
- else{ //if there is no logged in user don't allow drag and drop
+ } else {
+ // if there is no logged in user don't allow drag and drop
this.nodeDrag = false;
this.nodeDrop = false;
}
@@ -217,7 +215,7 @@ export class ListsListComponent implements OnInit {
}
-// LIST METHODS
+ // LIST METHODS
expandAll(tree) {
tree.treeModel.expandAll();
diff --git a/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.spec.ts b/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.spec.ts
index caf7481e..11e6d159 100644
--- a/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.spec.ts
+++ b/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OntologiesListItemComponent } from './ontologies-list-item.component';
+import { AppModule } from '../../../../../app.module';
+import { ResourceTypesService } from '../../../../../model/services/resource-types.service';
describe('OntologiesListItemComponent', () => {
let component: OntologiesListItemComponent;
@@ -8,9 +10,12 @@ describe('OntologiesListItemComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ OntologiesListItemComponent ]
+ imports: [
+ AppModule
+ ],
+ providers: [ResourceTypesService]
})
- .compileComponents();
+ .compileComponents();
}));
beforeEach(() => {
@@ -19,7 +24,7 @@ describe('OntologiesListItemComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.ts b/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.ts
index ed5c2233..722b833a 100644
--- a/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.ts
+++ b/src/app/view/modules/listing/ontologies-list/ontologies-list-item/ontologies-list-item.component.ts
@@ -12,13 +12,12 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {ResourceTypeItem} from '../../../../../model/webapi/knora/v1/resource-types/resource-type-item';
-import {ApiServiceResult} from '../../../../../model/services/api-service-result';
-import {ResourceTypes} from '../../../../../model/webapi/knora/v1/resource-types/resource-types';
-import {ApiServiceError} from '../../../../../model/services/api-service-error';
-import {MessageData} from '../../../message/message.component';
-import {ResourceTypesService} from '../../../../../model/services/resource-types.service';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { ResourceTypeItem } from '../../../../../model/webapi/knora/v1/resource-types/resource-type-item';
+import { ApiServiceError, ApiServiceResult } from '@knora/core';
+import { ResourceTypes } from '../../../../../model/webapi/knora/v1/resource-types/resource-types';
+import { MessageData } from '../../../message/message.component';
+import { ResourceTypesService } from '../../../../../model/services/resource-types.service';
@Component({
selector: 'salsah-ontologies-list-item',
@@ -28,7 +27,7 @@ import {ResourceTypesService} from '../../../../../model/services/resource-types
export class OntologiesListItemComponent implements OnInit {
@Input() listData: ResourceTypeItem[] = [];
-// @Input() sortProp: string;
+ // @Input() sortProp: string;
@Input() index: number;
@Input() project?: string;
diff --git a/src/app/view/modules/listing/ontologies-list/ontologies-list.component.html b/src/app/view/modules/listing/ontologies-list/ontologies-list.component.html
index 111645af..3a045c2e 100644
--- a/src/app/view/modules/listing/ontologies-list/ontologies-list.component.html
+++ b/src/app/view/modules/listing/ontologies-list/ontologies-list.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -7,15 +8,18 @@
0; else noData">
-
-
-
+
+
+
@@ -39,4 +43,4 @@
{{item}}
-
+
\ No newline at end of file
diff --git a/src/app/view/modules/listing/ontologies-list/ontologies-list.component.spec.ts b/src/app/view/modules/listing/ontologies-list/ontologies-list.component.spec.ts
index 4cd3200a..5bab12f9 100644
--- a/src/app/view/modules/listing/ontologies-list/ontologies-list.component.spec.ts
+++ b/src/app/view/modules/listing/ontologies-list/ontologies-list.component.spec.ts
@@ -1,6 +1,7 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import {OntologiesListComponent} from './ontologies-list.component';
+import { OntologiesListComponent } from './ontologies-list.component';
+import { AppModule } from '../../../../app.module';
describe('OntologiesListComponent', () => {
let component: OntologiesListComponent;
@@ -8,7 +9,7 @@ describe('OntologiesListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [OntologiesListComponent]
+ imports: [AppModule]
})
.compileComponents();
}));
@@ -19,7 +20,7 @@ describe('OntologiesListComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/listing/ontologies-list/ontologies-list.component.ts b/src/app/view/modules/listing/ontologies-list/ontologies-list.component.ts
index ad085bcd..11b55e7b 100644
--- a/src/app/view/modules/listing/ontologies-list/ontologies-list.component.ts
+++ b/src/app/view/modules/listing/ontologies-list/ontologies-list.component.ts
@@ -51,7 +51,7 @@ export class OntologiesListComponent implements OnInit {
ngOnInit() {
- if (this.restrictedBy !== undefined) {
+ if (this.restrictedBy) {
// list of ontologies in a project dashboard
this.ontologiesList = JSON.parse(sessionStorage.getItem('currentProject')).ontologies;
this.numberOfItems = this.ontologiesList.length;
diff --git a/src/app/view/modules/listing/projects-list/projects-list.component.html b/src/app/view/modules/listing/projects-list/projects-list.component.html
index 9047a8a0..d04163f0 100644
--- a/src/app/view/modules/listing/projects-list/projects-list.component.html
+++ b/src/app/view/modules/listing/projects-list/projects-list.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -18,10 +19,10 @@
Active projects
Short name
Long name
- 1"
- [sortProps]="sortProps"
- [(sortKey)]="sortKey">
-
+
+ 1" [sortProps]="sortProps" [(sortKey)]="sortKey">
+
@@ -33,8 +34,6 @@ Active projects
{{item.longname}}
-
-
delete
@@ -42,7 +41,6 @@ Active projects
edit
-
forward
@@ -51,7 +49,8 @@ Active projects
-
+
+
Inactive (deleted) projects
@@ -61,10 +60,10 @@ Inactive (deleted) projects
Short name
Long name
- 1"
- [sortProps]="sortProps"
- [(sortKey)]="sortKeyIA">
-
+
+ 1" [sortProps]="sortProps" [(sortKey)]="sortKeyIA">
+
@@ -76,7 +75,6 @@ Inactive (deleted) projects
{{item.longname}}
-
refresh
@@ -84,7 +82,6 @@ Inactive (deleted) projects
edit
-
forward
@@ -97,24 +94,20 @@ Inactive (deleted) projects
-
+ class="salsah-grid-tile salsah-link" (click)="open(item.shortname)">
-
+
{{item.longname}}
# Projects: {{countAll}}
{{item.value.longname}} ({{item.value.shortname}})
-
forward
-
+
delete
diff --git a/src/app/view/modules/listing/projects-list/projects-list.component.spec.ts b/src/app/view/modules/listing/projects-list/projects-list.component.spec.ts
index ff0e4903..a65afd5a 100644
--- a/src/app/view/modules/listing/projects-list/projects-list.component.spec.ts
+++ b/src/app/view/modules/listing/projects-list/projects-list.component.spec.ts
@@ -1,10 +1,10 @@
-import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ProjectsListComponent} from './projects-list.component';
-import {ProjectsService} from '../../../../model/services/projects.service';
-import {MockBackend} from '@angular/http/testing';
-import {BaseRequestOptions, Http, HttpModule, ResponseOptions} from '@angular/http';
+import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ProjectsListComponent } from './projects-list.component';
+import { ProjectsService } from '@knora/core';
+import { MockBackend } from '@angular/http/testing';
+import { BaseRequestOptions, Http } from '@angular/http';
describe('ProjectsListComponent', () => {
let component: ProjectsListComponent;
@@ -35,18 +35,19 @@ describe('ProjectsListComponent', () => {
component = fixture.componentInstance;
fixture.detectChanges();
});
-
- xit('should be created', async(inject(
- [ProjectsService, MockBackend], (service, mockBackend) => {
-
- const mockProjectsJson = {'projects': [{'shortname': 'biblio', 'description': 'Bibliography', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/biblio', 'id': 'http://data.knora.org/projects/DczxPs-sR6aZN91qV92ZmQ', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bibliography', 'ontologies': ['http://www.knora.org/ontology/biblio']}, {'shortname': 'beol', 'description': 'Bernoulli-Euler Online', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/beol', 'id': 'http://data.knora.org/projects/yTerZGyxjZVqFMNNKXCDPF', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bernoulli-Euler Online', 'ontologyNamedGraph': 'http://www.knora.org/ontology/beol'}, {'shortname': 'incunabula', 'description': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n', 'institution': null, 'logo': 'incunabula_logo.png', 'dataNamedGraph': 'http://www.knora.org/data/incunabula', 'id': 'http://data.knora.org/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': 'Basler Frühdrucke, Inkunabel, Narrenschiff, Wiegendrucke, Sebastian Brant, Bilderfolgen, early print, incunabula, ship of fools, Kunsthistorischs Seminar Universität Basel, Late Middle Ages, Letterpress Printing, Basel, Contectualisation of images', 'longname': 'Bilderfolgen Basler Frühdrucke', 'ontologyNamedGraph': 'http://www.knora.org/ontology/incunabula'}, {'shortname': 'anything', 'description': 'Anything Project', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/anything', 'id': 'http://data.knora.org/projects/anything', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Anything Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/anything'}, {'shortname': 'SystemProject', 'description': 'Knora System Project', 'institution': null, 'logo': null, 'dataNamedGraph': '-', 'id': 'http://www.knora.org/ontology/knora-base#SystemProject', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Knora System Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/knora-base'}, {'shortname': 'dokubib', 'description': 'Dokubib', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/dokubib', 'id': 'http://data.knora.org/projects/b83b99ca01', 'status': false, 'selfjoin': false, 'keywords': null, 'longname': 'Dokubib', 'ontologyNamedGraph': 'http://www.knora.org/ontology/dokubib'}, {'shortname': 'images', 'description': 'A demo project of a collection of images', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/images', 'id': 'http://data.knora.org/projects/images', 'status': true, 'selfjoin': false, 'keywords': 'images, collection', 'longname': 'Image Collection Demo', 'ontologies': ['http://www.knora.org/ontology/images']}], 'status': 0};
-
- mockBackend.connections.subscribe(c => {
- // TODO: understand why this is not failing
- expect(c.request.url).toBe('v1/projects/shouldfail');
- c.mockRespond(new Response(new ResponseOptions({ body: JSON.stringify(mockProjectsJson) })));
- });
-
- expect(component).toBeTruthy();
- })));
+ /*
+ xit('should be created', async(inject(
+ [ProjectsService, MockBackend], (service, mockBackend) => {
+
+ const mockProjectsJson = {'projects': [{'shortname': 'biblio', 'description': 'Bibliography', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/biblio', 'id': 'http://data.knora.org/projects/DczxPs-sR6aZN91qV92ZmQ', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bibliography', 'ontologies': ['http://www.knora.org/ontology/biblio']}, {'shortname': 'beol', 'description': 'Bernoulli-Euler Online', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/beol', 'id': 'http://data.knora.org/projects/yTerZGyxjZVqFMNNKXCDPF', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Bernoulli-Euler Online', 'ontologyNamedGraph': 'http://www.knora.org/ontology/beol'}, {'shortname': 'incunabula', 'description': 'Das interdisziplinäre Forschungsprojekt "Die Bilderfolgen der Basler Frühdrucke: Spätmittelalterliche Didaxe als Bild-Text-Lektüre " verbindet eine umfassende kunstwissenschaftliche Analyse der Bezüge zwischen den Bildern und Texten in den illustrierten Basler Inkunabeln mit der Digitalisierung der Bestände der Universitätsbibliothek und der Entwicklung einer elektronischen Edition in der Form einer neuartigen Web-0.2-Applikation.\n
\nDas Projekt wird durchgeführt vom Kunsthistorischen Seminar der Universität Basel (Prof. B. Schellewald) und dem Digital Humanities Lab der Universität Basel (PD Dr. L. Rosenthaler).\n
\n\nDas Kernstück der digitalen Edition besteht aus rund zwanzig reich bebilderten Frühdrucken aus vier verschiedenen Basler Offizinen. Viele davon sind bereits vor 1500 in mehreren Ausgaben erschienen, einige fast gleichzeitig auf Deutsch und Lateinisch. Es handelt sich um eine ausserordentlich vielfältige Produktion; neben dem Heilsspiegel finden sich ein Roman, die Melusine, die Reisebeschreibungen des Jean de Mandeville, einige Gebets- und Erbauungsbüchlein, theologische Schriften, Fastenpredigten, die Leben der Heiligen Fridolin und Meinrad, das berühmte Narrenschiff sowie die Exempelsammlung des Ritters vom Thurn.\n
\nDie Internetpublikation macht das digitalisierte Korpus dieser Frühdrucke durch die Möglichkeiten nichtlinearer Verknüpfung und Kommentierung der Bilder und Texte, für die wissenschaftliche Edition sowie für die Erforschung der Bilder und Texte nutzbar machen. Auch können bereits bestehende und entstehende Online-Editionen damit verknüpft werden , wodurch die Nutzung von Datenbanken anderer Institutionen im Hinblick auf unser Corpus optimiert wird.\n', 'institution': null, 'logo': 'incunabula_logo.png', 'dataNamedGraph': 'http://www.knora.org/data/incunabula', 'id': 'http://data.knora.org/projects/77275339', 'status': true, 'selfjoin': false, 'keywords': 'Basler Frühdrucke, Inkunabel, Narrenschiff, Wiegendrucke, Sebastian Brant, Bilderfolgen, early print, incunabula, ship of fools, Kunsthistorischs Seminar Universität Basel, Late Middle Ages, Letterpress Printing, Basel, Contectualisation of images', 'longname': 'Bilderfolgen Basler Frühdrucke', 'ontologyNamedGraph': 'http://www.knora.org/ontology/incunabula'}, {'shortname': 'anything', 'description': 'Anything Project', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/anything', 'id': 'http://data.knora.org/projects/anything', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Anything Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/anything'}, {'shortname': 'SystemProject', 'description': 'Knora System Project', 'institution': null, 'logo': null, 'dataNamedGraph': '-', 'id': 'http://www.knora.org/ontology/knora-base#SystemProject', 'status': true, 'selfjoin': false, 'keywords': null, 'longname': 'Knora System Project', 'ontologyNamedGraph': 'http://www.knora.org/ontology/knora-base'}, {'shortname': 'dokubib', 'description': 'Dokubib', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/dokubib', 'id': 'http://data.knora.org/projects/b83b99ca01', 'status': false, 'selfjoin': false, 'keywords': null, 'longname': 'Dokubib', 'ontologyNamedGraph': 'http://www.knora.org/ontology/dokubib'}, {'shortname': 'images', 'description': 'A demo project of a collection of images', 'institution': null, 'logo': null, 'dataNamedGraph': 'http://www.knora.org/data/images', 'id': 'http://data.knora.org/projects/images', 'status': true, 'selfjoin': false, 'keywords': 'images, collection', 'longname': 'Image Collection Demo', 'ontologies': ['http://www.knora.org/ontology/images']}], 'status': 0};
+
+ mockBackend.connections.subscribe(c => {
+ // TODO: understand why this is not failing
+ expect(c.request.url).toBe('v1/projects/shouldfail');
+ c.mockRespond(new Response(new ResponseOptions({ body: JSON.stringify(mockProjectsJson) })));
+ });
+
+ expect(component).toBeTruthy();
+ })));
+ */
});
diff --git a/src/app/view/modules/listing/projects-list/projects-list.component.ts b/src/app/view/modules/listing/projects-list/projects-list.component.ts
index 8d2f9772..4cb21335 100644
--- a/src/app/view/modules/listing/projects-list/projects-list.component.ts
+++ b/src/app/view/modules/listing/projects-list/projects-list.component.ts
@@ -12,18 +12,14 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {Router} from '@angular/router';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {ProjectsService} from '../../../../model/services/projects.service';
-import {Project} from '../../../../model/webapi/knora/';
-import {UsersService} from '../../../../model/services/users.service';
-import {MessageData} from '../../message/message.component';
-import {FormDialogComponent} from '../../dialog/form-dialog/form-dialog.component';
-import {ConfirmDialogComponent} from '../../dialog/confirm-dialog/confirm-dialog.component';
-import {MessageDialogComponent} from '../../dialog/message-dialog/message-dialog.component';
-import {MatDialog, MatDialogConfig} from '@angular/material';
-import {User} from '../../../../model/webapi/knora/admin';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { Router } from '@angular/router';
+import { ApiServiceError, Project, ProjectsService, User, UsersService } from '@knora/core';
+import { MessageData } from '../../message/message.component';
+import { FormDialogComponent } from '../../dialog/form-dialog/form-dialog.component';
+import { ConfirmDialogComponent } from '../../dialog/confirm-dialog/confirm-dialog.component';
+import { MessageDialogComponent } from '../../dialog/message-dialog/message-dialog.component';
+import { MatDialog, MatDialogConfig } from '@angular/material';
/**
* This component has two optional attributes:
@@ -49,7 +45,6 @@ export class ProjectsListComponent implements OnInit {
// restrictedBy can be a user; to show a list of the user's projects
@Input() restrictedBy: string;
@Input() listType?: string;
- @Input() admin?: boolean;
// send the number of entries to the parent component (framework-for-listings) to us it there in the title
@Output() counter: EventEmitter = new EventEmitter();
@@ -100,9 +95,9 @@ export class ProjectsListComponent implements OnInit {
sortKeyIA: string = this.sortKey;
constructor(private _router: Router,
- private _projectsService: ProjectsService,
- private _userService: UsersService,
- public _dialog: MatDialog) {
+ private _projectsService: ProjectsService,
+ private _userService: UsersService,
+ public _dialog: MatDialog) {
}
ngOnInit() {
diff --git a/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.spec.ts b/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.spec.ts
index f8e8cd6e..40c7904c 100644
--- a/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.spec.ts
+++ b/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.spec.ts
@@ -1,12 +1,21 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ResourceGridListComponent} from './resource-grid-list.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ResourceGridListComponent } from './resource-grid-list.component';
describe('ResourceGridListComponent', () => {
let component: ResourceGridListComponent;
let fixture: ComponentFixture;
+ let originalTimeout;
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
@@ -23,7 +32,7 @@ describe('ResourceGridListComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.ts b/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.ts
index 26245d1b..59292fdf 100644
--- a/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.ts
+++ b/src/app/view/modules/listing/resource-grid-list/resource-grid-list.component.ts
@@ -1,10 +1,10 @@
-import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
-import {Search} from "../../../../model/webapi/knora";
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { Search } from '../../../../model/webapi/knora';
@Component({
- selector: 'salsah-resource-grid-list',
- templateUrl: './resource-grid-list.component.html',
- styleUrls: ['./resource-grid-list.component.scss']
+ selector: 'salsah-resource-grid-list',
+ templateUrl: './resource-grid-list.component.html',
+ styleUrls: ['./resource-grid-list.component.scss']
})
export class ResourceGridListComponent implements OnInit {
@@ -22,7 +22,7 @@ export class ResourceGridListComponent implements OnInit {
open(id: string, index: number) {
this.selectedRow = index;
- this.openResource.emit({id, index});
+ this.openResource.emit({ id, index });
}
}
diff --git a/src/app/view/modules/listing/resource-types-list/resource-types-list.component.html b/src/app/view/modules/listing/resource-types-list/resource-types-list.component.html
index 0a5e6a2d..d686ba3b 100644
--- a/src/app/view/modules/listing/resource-types-list/resource-types-list.component.html
+++ b/src/app/view/modules/listing/resource-types-list/resource-types-list.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -25,9 +26,7 @@
{{item?.label | slice:0:36}}
-
+
edit
@@ -85,4 +84,4 @@
{{item?.label}}
-
+
\ No newline at end of file
diff --git a/src/app/view/modules/listing/resource-types-list/resource-types-list.component.spec.ts b/src/app/view/modules/listing/resource-types-list/resource-types-list.component.spec.ts
index 9727bda9..fe74748f 100644
--- a/src/app/view/modules/listing/resource-types-list/resource-types-list.component.spec.ts
+++ b/src/app/view/modules/listing/resource-types-list/resource-types-list.component.spec.ts
@@ -1,9 +1,10 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {ResourceTypesListComponent} from './resource-types-list.component';
-import {ResourceTypesService} from '../../../../model/services/resource-types.service';
-import {Project} from '../../../../model/webapi/knora/';
-import {imagesProject} from '../../../../model/test-data/shared-test-data';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { ResourceTypesListComponent } from './resource-types-list.component';
+import { ResourceTypesService } from '../../../../model/services/resource-types.service';
+
+import { imagesProject } from '../../../../model/test-data/shared-test-data';
+import { Project } from '@knora/core';
describe('ResourceTypesListComponent', () => {
let component: ResourceTypesListComponent;
@@ -11,6 +12,19 @@ describe('ResourceTypesListComponent', () => {
const testProject: Project = imagesProject;
+
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+
+
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
@@ -48,8 +62,8 @@ describe('ResourceTypesListComponent', () => {
fixture.detectChanges();
});
- xit('should get the project data', () => {
+ it('should get the project data', async(() => {
expect
(localStorage.getItem('currentProject')).toBe(JSON.stringify(testProject));
expect(component).toBeTruthy();
- });
+ }));
});
diff --git a/src/app/view/modules/listing/resource-types-list/resource-types-list.component.ts b/src/app/view/modules/listing/resource-types-list/resource-types-list.component.ts
index b48cc695..917b20c1 100644
--- a/src/app/view/modules/listing/resource-types-list/resource-types-list.component.ts
+++ b/src/app/view/modules/listing/resource-types-list/resource-types-list.component.ts
@@ -12,21 +12,27 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {ResourceTypesService} from '../../../../model/services/resource-types.service';
-import {ApiServiceResult} from '../../../../model/services/api-service-result';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {ResourceTypes, ResourceTypeItem} from '../../../../model/webapi/knora/';
-import {MessageData} from '../../message/message.component';
-import {FormDialogComponent} from '../../dialog/form-dialog/form-dialog.component';
-import {MatDialog, MatDialogConfig} from '@angular/material';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { ResourceTypesService } from '../../../../model/services/resource-types.service';
+import {
+ ApiServiceError,
+ ApiServiceResult,
+ OntologyCacheService,
+ OntologyInformation,
+ Properties,
+ ResourceClass
+} from '@knora/core';
+import { ResourceTypes, ResourceTypeItem } from '../../../../model/webapi/knora/';
+import { MessageData } from '../../message/message.component';
+import { FormDialogComponent } from '../../dialog/form-dialog/form-dialog.component';
+import { MatDialog, MatDialogConfig } from '@angular/material';
@Component({
selector: 'salsah-resource-types-list',
templateUrl: './resource-types-list.component.html',
styleUrls: ['./resource-types-list.component.scss']
})
-export class ResourceTypesListComponent implements OnInit {
+export class ResourceTypesListComponent implements OnInit {
@Input() restrictedBy: string; // restricted by ontology
@Input() index: number;
@@ -49,37 +55,48 @@ export class ResourceTypesListComponent implements OnInit {
statusText: 'It seems there\'s no resource type yet. Add a new one with the button above ↑'
};
- // the main object in this component and a result counter
- list: ResourceTypeItem[] = [];
+ // result counter
numberOfItems: number;
-
// for the list of objects we have to know which object is active / selected
selectedRow: number;
+
// iri of the selected resource type
iri: string;
- constructor(private _resourceTypesService: ResourceTypesService,
- public _dialog: MatDialog) {
- }
+ // resource classes for the selected ontology
+ resourceClasses: Array = [];
+
+ // properties for the selected ontology or selected resource class
+ properties: Properties;
+
+ constructor(
+ private _resourceTypesService: ResourceTypesService,
+ private _cacheService: OntologyCacheService,
+ public _dialog: MatDialog
+ ) { }
ngOnInit() {
this.selectedRow = this.index;
- this._resourceTypesService.getResourceTypesByVoc(this.restrictedBy)
- .subscribe(
- (result: ApiServiceResult) => {
- this.list = result.getBody(ResourceTypes).resourcetypes;
- this.numberOfItems = Object.keys(this.list).length;
- this.isLoading = false;
- },
- (error: ApiServiceError) => {
- console.log('ResourceTypesListComponent', error);
- this.errorMessage = error;
- this.isLoading = false;
- }
- );
+
+ // TODO: we get wrong ontology iris from Knora; s. comment in issue: https://github.com/dhlab-basel/Knora/issues/553#issuecomment-418776341
+ //
+ this._cacheService.getEntityDefinitionsForOntologies([this.restrictedBy]).subscribe(
+ (ontoInfo: OntologyInformation) => {
+ console.log(ontoInfo);
+
+ this.resourceClasses = ontoInfo.getResourceClassesAsArray();
+ this.properties = ontoInfo.getProperties();
+ this.numberOfItems = Object.keys(this.resourceClasses).length;
+ this.isLoading = false;
+ },
+ (error) => {
+ this.errorMessage = error;
+ this.isLoading = false;
+ }
+ );
}
// open / close detail view
@@ -87,11 +104,11 @@ export class ResourceTypesListComponent implements OnInit {
if (this.selectedRow === index) {
// close the detail view
this.selectedRow = undefined;
- this.toggleItem.emit({id, index});
+ this.toggleItem.emit({ id, index });
} else {
// open the detail view
this.selectedRow = index;
- this.toggleItem.emit({id, index});
+ this.toggleItem.emit({ id, index });
}
}
diff --git a/src/app/view/modules/listing/resources-list/resources-list.component.html b/src/app/view/modules/listing/resources-list/resources-list.component.html
index 25675c1a..fd311a53 100644
--- a/src/app/view/modules/listing/resources-list/resources-list.component.html
+++ b/src/app/view/modules/listing/resources-list/resources-list.component.html
@@ -1,26 +1,21 @@
-
+
+
0; else noData" [ngSwitch]="listType">
-
Number of Results: {{numberOfAllResults}}
+
-
-
+
+
-
{{res.label}}
- ({{ontologyInfo?.getLabelForResourceClass(res.type) | slice:0:40}})
+ {{res.label}} ({{ontologyInfo?.getLabelForResourceClass(res.type) | slice:0:40}})
-
+
@@ -59,7 +49,8 @@ {{res.label}} ({{ontologyInfo?.getLabelForResourceClass(res.type)}}
-
+
{{val.value.getContent()}}
diff --git a/src/app/view/modules/listing/resources-list/resources-list.component.scss b/src/app/view/modules/listing/resources-list/resources-list.component.scss
index 41ef0e9b..66f6c10c 100644
--- a/src/app/view/modules/listing/resources-list/resources-list.component.scss
+++ b/src/app/view/modules/listing/resources-list/resources-list.component.scss
@@ -4,7 +4,13 @@
max-width: 840px;
.mat-list-item {
+ padding: 16px 0;
height: auto;
+
+ &.border-bottom {
+ border-bottom: 1px solid #cccccc;
+ }
+
}
}
diff --git a/src/app/view/modules/listing/resources-list/resources-list.component.spec.ts b/src/app/view/modules/listing/resources-list/resources-list.component.spec.ts
index 365fef15..e6f8d32e 100644
--- a/src/app/view/modules/listing/resources-list/resources-list.component.spec.ts
+++ b/src/app/view/modules/listing/resources-list/resources-list.component.spec.ts
@@ -1,12 +1,33 @@
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {AppModule} from '../../../../app.module';
-import {AppRoutingModule} from '../../../../app-routing.module';
-import {ResourcesListComponent} from './resources-list.component';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AppModule } from '../../../../app.module';
+import { AppRoutingModule } from '../../../../app-routing.module';
+import { ResourcesListComponent } from './resources-list.component';
describe('ResourceListComponent', () => {
let component: ResourcesListComponent;
let fixture: ComponentFixture;
+ let originalTimeout;
+
+ beforeEach(function () {
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
+ });
+
+ afterEach(function () {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+ });
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ AppModule,
+ AppRoutingModule
+ ]
+ })
+ .compileComponents();
+ }));
+
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
@@ -23,7 +44,7 @@ describe('ResourceListComponent', () => {
fixture.detectChanges();
});
- xit('should modify', () => {
+ it('should modify', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/listing/resources-list/resources-list.component.ts b/src/app/view/modules/listing/resources-list/resources-list.component.ts
index 146000ec..631df359 100644
--- a/src/app/view/modules/listing/resources-list/resources-list.component.ts
+++ b/src/app/view/modules/listing/resources-list/resources-list.component.ts
@@ -12,18 +12,22 @@
* License along with SALSAH. If not, see .
* */
-import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core';
-import {SearchService} from '../../../../model/services/search.service';
-import {ApiServiceResult} from '../../../../model/services/api-service-result';
-import {ApiServiceError} from '../../../../model/services/api-service-error';
-import {MessageData} from '../../message/message.component';
-import {ConvertJSONLD} from '../../../../model/webapi/knora/v2/convert-jsonld';
-import {OntologyCacheService, OntologyInformation} from '../../../../model/services/ontologycache.service';
-import {ReadResourcesSequence} from '../../../../model/webapi/knora/v2/read-resources-sequence';
-import {AppConfig} from "../../../../app.config";
-import {ReadResource} from "../../../../model/webapi/knora/v2/read-resource";
-import {ExtendedSearchParams, SearchParamsService} from "../../../../model/services/search-params.service";
-import {GravsearchGenerationService} from "../../../../model/services/gravsearch-generation.service";
+import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
+import {
+ ApiServiceError,
+ ApiServiceResult,
+ ConvertJSONLD,
+ ExtendedSearchParams,
+ GravsearchGenerationService,
+ KnoraConstants,
+ OntologyCacheService,
+ OntologyInformation,
+ ReadResource,
+ ReadResourcesSequence,
+ SearchParamsService,
+ SearchService
+} from '@knora/core';
+import { MessageData } from '../../message/message.component';
declare let require: any; // http://stackoverflow.com/questions/34730010/angular2-5-minute-install-bug-require-is-not-defined
const jsonld = require('jsonld');
@@ -51,7 +55,7 @@ export class ResourcesListComponent implements OnInit, OnChanges {
@Output() toggleItem = new EventEmitter();
- AppConfig = AppConfig;
+ KnoraConstants = KnoraConstants;
// grid list settings
columns: number = 3;
@@ -155,7 +159,7 @@ export class ResourcesListComponent implements OnInit, OnChanges {
} else {
// generate new Gravsearch with increased offset
- let gravsearch = extendedSearchParams.generateGravsearch(this._offset);
+ const gravsearch = extendedSearchParams.generateGravsearch(this._offset);
this._searchService.doExtendedSearch(gravsearch)
.subscribe(
@@ -186,12 +190,12 @@ export class ResourcesListComponent implements OnInit, OnChanges {
* @param {ApiServiceResult} countQueryResult the response to a count query.
*/
private showNumberOfAllResults = (countQueryResult: ApiServiceResult) => {
- let resPromises = jsonld.promises;
+ const resPromises = jsonld.promises;
// compact JSON-LD using an empty context: expands all Iris
- let resPromise = resPromises.compact(countQueryResult.body, {});
+ const resPromise = resPromises.compact(countQueryResult.body, {});
resPromise.then((compacted) => {
- this.numberOfAllResults = compacted[AppConfig.schemaNumberOfItems]
+ this.numberOfAllResults = compacted[KnoraConstants.schemaNumberOfItems]
}, function (err) {
console.log('JSONLD could not be expanded:' + err);
@@ -210,20 +214,20 @@ export class ResourcesListComponent implements OnInit, OnChanges {
*/
private processSearchResults = (searchResult: ApiServiceResult) => {
- let resPromises = jsonld.promises;
+ const resPromises = jsonld.promises;
// compact JSON-LD using an empty context: expands all Iris
- let resPromise = resPromises.compact(searchResult.body, {});
+ const resPromise = resPromises.compact(searchResult.body, {});
resPromise.then((compacted) => {
// get resource class Iris from response
- let resourceClassIris: string[] = ConvertJSONLD.getResourceClassesFromJsonLD(compacted);
+ const resourceClassIris: string[] = ConvertJSONLD.getResourceClassesFromJsonLD(compacted);
// request ontology information about resource class Iris (properties are implied)
this._cacheService.getResourceClassDefinitions(resourceClassIris).subscribe(
(resourceClassInfos: OntologyInformation) => {
- let resources: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
+ const resources: ReadResourcesSequence = ConvertJSONLD.createReadResourcesSequenceFromJsonLD(compacted);
// assign ontology information to a variable so it can be used in the component's template
if (this.ontologyInfo === undefined) {
@@ -261,7 +265,7 @@ export class ResourcesListComponent implements OnInit, OnChanges {
this.listType = 'grid';
this.columns = 3;
}
- this.toggleItem.emit({id, index});
+ this.toggleItem.emit({ id, index });
} else {
// open the detail view
this.selectedRow = index;
@@ -270,7 +274,7 @@ export class ResourcesListComponent implements OnInit, OnChanges {
this.listType = 'list';
this.columns = 1;
}
- this.toggleItem.emit({id, index});
+ this.toggleItem.emit({ id, index });
}
}
diff --git a/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.spec.ts b/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.spec.ts
index 2bee804c..243974f2 100644
--- a/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.spec.ts
+++ b/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UsersListItemComponent } from './users-list-item.component';
+import { AppModule } from '../../../../../app.module';
+import { AppRoutingModule } from '../../../../../app-routing.module';
describe('UsersListItemComponent', () => {
let component: UsersListItemComponent;
@@ -8,9 +10,12 @@ describe('UsersListItemComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ UsersListItemComponent ]
+ imports: [
+ AppModule,
+ AppRoutingModule
+ ]
})
- .compileComponents();
+ .compileComponents();
}));
beforeEach(() => {
@@ -19,7 +24,7 @@ describe('UsersListItemComponent', () => {
fixture.detectChanges();
});
- xit('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
});
diff --git a/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.ts b/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.ts
index d4e30b4a..639ed360 100644
--- a/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.ts
+++ b/src/app/view/modules/listing/users-list/users-list-item/users-list-item.component.ts
@@ -12,10 +12,10 @@
* License along with SALSAH. If not, see .
* */
-import {Component, Input, OnInit} from '@angular/core';
-import {User} from '../../../../../model/webapi/knora';
-import {MatDialog, MatDialogConfig} from '@angular/material';
-import {FormDialogComponent} from '../../../dialog/form-dialog/form-dialog.component';
+import { Component, Input, OnInit } from '@angular/core';
+import { User } from '@knora/core';
+import { MatDialog, MatDialogConfig } from '@angular/material';
+import { FormDialogComponent } from '../../../dialog/form-dialog/form-dialog.component';
@Component({
selector: 'salsah-users-list-item',
@@ -33,7 +33,7 @@ export class UsersListItemComponent implements OnInit {
ngOnInit() {
-// console.log(this.listData);
+ // console.log(this.listData);
}
diff --git a/src/app/view/modules/listing/users-list/users-list.component.html b/src/app/view/modules/listing/users-list/users-list.component.html
index dab09b24..898bdf88 100644
--- a/src/app/view/modules/listing/users-list/users-list.component.html
+++ b/src/app/view/modules/listing/users-list/users-list.component.html
@@ -1,5 +1,6 @@
-
+
+
@@ -17,15 +18,15 @@
Active users
Lastname
eMail
- 1"
- [sortProps]="sortProps"
- [(sortKey)]="sortKey">
-
+
+ 1" [sortProps]="sortProps" [(sortKey)]="sortKey">
+
-
+
{{item?.givenName}}
{{item?.familyName}}
@@ -33,25 +34,22 @@ Active users
-
+
delete
-
+
edit
-
+
forward
-
+
+
Inactive (deleted) users
@@ -61,33 +59,28 @@ Inactive (deleted) users
Lastname
eMail
- 1"
- [sortProps]="sortProps"
- [(sortKey)]="sortKeyIA">
-
+
+ 1" [sortProps]="sortProps" [(sortKey)]="sortKeyIA">
+
-
+
{{item?.givenName}}
{{item?.familyName}}
{{item?.email}}
-
+
refresh
-
+
edit
-
+
forward
@@ -101,38 +94,39 @@ Inactive (deleted) users
0">
-
+
- 1"
- [sortProps]="sortProps"
- [(sortKey)]="sortKey">
-
+
+ 1" [sortProps]="sortProps" [(sortKey)]="sortKey">
+
-
+
-
+
+
0">
-
+
- 1"
- [sortProps]="sortProps"
- [(sortKey)]="sortKeyIA">
-
+
+ 1" [sortProps]="sortProps" [(sortKey)]="sortKeyIA">
+
-
+
@@ -140,23 +134,17 @@