diff --git a/nietzsche-beta-app/package.json b/nietzsche-beta-app/package.json index 6bfe49b..68ddfa1 100644 --- a/nietzsche-beta-app/package.json +++ b/nietzsche-beta-app/package.json @@ -1,60 +1,60 @@ { "name": "nietzsche-app-beta", - "version": "0.7.1.2", + "version": "0.7.1.3", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "compodoc": "./node_modules/.bin/compodoc -p tsconfig.app.json", "sparqljs": "./node_modules/sparqljs/sparql.js" }, "private": true, "dependencies": { "@angular/animations": "~8.2.14", "@angular/cdk": "~8.2.3", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", "@angular/core": "~8.2.14", "@angular/forms": "~8.2.14", "@angular/material": "^8.2.3", "@angular/platform-browser": "~8.2.14", "@angular/platform-browser-dynamic": "~8.2.14", "@angular/router": "~8.2.14", "@ctrl/ngx-codemirror": "^5.0.0", "@types/rdf-js": "^2.0.11", "codemirror": "^5.62.0", "lodash": "^4.17.20", "n3": "^1.10.0", "ngx-csv": "^0.3.2", "ngx-mat-standoff-markup": "^0.7.3", "rdfjs": "^0.0.1", "rxjs": "~6.4.0", "sparqljs": "^3.0.1", "tslib": "^1.10.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "^0.803.25", "@angular/cli": "~8.3.24", "@angular/compiler-cli": "~8.2.14", "@angular/language-service": "~8.2.14", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "^5.0.0", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.5.3" } } diff --git a/nietzsche-beta-app/src/app/tln-edition/datatypes/editor_comment.ts b/nietzsche-beta-app/src/app/tln-edition/datatypes/editor_comment.ts index a3e4918..250d3ba 100644 --- a/nietzsche-beta-app/src/app/tln-edition/datatypes/editor_comment.ts +++ b/nietzsche-beta-app/src/app/tln-edition/datatypes/editor_comment.ts @@ -1,235 +1,236 @@ import { BasicResultBindingElement, FusekiResults } from './basic_datatype'; import { EditorComment, Line, LineContinuationReference, Word } from '../models'; import { TlnEditorCommentMarkup } from './positional-markup'; import { TlnLine } from './line'; /** * This is the 'editor comment' stub instantiation of an element of {@link /interfaces/FusekiResults.html|FusekiResults}. **/ export class TlnEditorCommentStub extends BasicResultBindingElement implements EditorComment { static readonly default_key: string = 'word'; static readonly query_key: string = 'word'; /** * the SPARQL-query of this datatype. **/ static readonly query: string = ` PREFIX tln: PREFIX rdf: PREFIX rdfs: - SELECT ?id ?editorClass ?comment ?correction ?text ?textWithMarkup WHERE { + SELECT ?id ?editorClass ?comment ?correction ?text ?textWithMarkup ?isUncertain WHERE { { ?word tln:wordHasEditorComment ?id. } UNION { ?word tln:wordHasWordParts/rdf:rest*/rdf:first/tln:wordHasEditorComment ?id. } - ?id a ?editorClass. + ?id a ?editorClass; + tln:isUncertain ?isUncertain. FILTER (?editorClass != rdfs:Resource) OPTIONAL { ?id tln:hasComment ?comment.} OPTIONAL { ?id tln:hasCorrectionText ?correction; tln:isUncertain true.} - OPTIONAL { ?id (tln:clarificationHasText|tln:atypicalWritingHasText) ?textWithMarkup. + OPTIONAL { ?id tln:commentHasText ?textWithMarkup. ?textWithMarkup tln:textHasContent ?text. } }`; editorClass: string; comment?: string; correction?: string; + isUncertain: boolean; text?: string; textWithMarkup?: string; /** * The constructor creates a datatype from the data. * * @param id if omitted the id will be retrieved from data **/ constructor(data: any, id?: string, service?: any){ super(data, id, service) this.editorClass = this.getData4Key('editorClass'); + this.isUncertain = this.getData4Key('isUncertain'); this.comment = this.getData4Key('comment'); this.correction = this.getData4Key('correction'); this.text = this.getData4Key('text'); this.textWithMarkup = this.getData4Key('textWithMarkup'); } } export class TlnLineEditorComment extends TlnEditorCommentStub { static readonly default_key: string = 'page'; static readonly query_key: string = 'page'; /** * the SPARQL-query of this datatype. **/ static readonly query: string = ` PREFIX tln: PREFIX stoff: PREFIX rdf: PREFIX rdfs: - SELECT DISTINCT ?id ?line ?number ?top ?bottom ?editorClass ?comment ?commentIsUncertain ?reference ?isToRef ?refTitle ?refPageNumber ?refLine WHERE { + SELECT DISTINCT ?id ?line ?number ?top ?bottom ?editorClass ?comment ?reference ?isToRef ?refTitle ?refPageNumber ?refLine ?isUncertain WHERE { ?page tln:hasLines/rdf:rest*/rdf:first ?line. ?line tln:lineHasEditorComment ?id; tln:lineHasNumber ?number; tln:lineHasTopValueOnTranskription ?top; tln:lineHasBottomValueOnTranskription ?bottom. - ?id a ?editorClass. + ?id a ?editorClass; + tln:isUncertain ?isUncertain. FILTER (!isBlank(?editorClass) && ?editorClass != rdfs:Resource) OPTIONAL { ?id tln:hasComment ?comment.} OPTIONAL { ?id tln:lineContinuationHasReference ?reference; tln:isLineAContinuationTo ?isToRef. ?reference tln:hasPageNumber ?refPageNumber; tln:firstLineOfReference ?refLine. OPTIONAL { ?reference tln:hasTitle ?refTitle } } - OPTIONAL { ?id tln:isUncertain ?commentIsUncertain.} }`; - commentIsUncertain?: boolean; lineContinuationReference?: LineContinuationReference; tLine: Line; /** * The constructor creates a datatype from the data. * * @param id if omitted the id will be retrieved from data **/ constructor(data: any, id?: string, service?: any){ super(data, id, service) - this.commentIsUncertain = this.getData4Key('commentIsUncertain'); this.tLine = { id: this.getData4Key('line'), number: this.getData4Key('number'), bottom: this.getData4Key('bottom'), top: this.getData4Key('top') } const reference = this.getData4Key('reference'); if (reference != undefined && reference != null){ this.lineContinuationReference = { isToRef: this.getData4Key('isToRef'), refTitle: this.getData4Key('refTitle'), refPageNumber: this.getData4Key('refPageNumber'), refLine: this.getData4Key('refLine') } } } public static convertData(this: T, data: FusekiResults, id?: string, service?: any): Array> { let elements = []; let content = this.getContent(data); for (var i = 0; i < content.length; i++){ let element = new TlnLineEditorComment(content[i], id, service); if (elements.length > 0 && elements[elements.length-1].id == element.id){ if (elements[elements.length-1].editorClass.endsWith('EditorComment')){ elements[elements.length-1].editorClass = element.editorClass; } } else { elements.push(element) } } //console.log(elements) return elements; } } export class TlnEditorComment extends TlnLineEditorComment { static readonly default_key: string = 'page'; static readonly query_key: string = 'page'; /** * the SPARQL-query of this datatype. **/ static readonly query: string = ` PREFIX tln: PREFIX stoff: PREFIX rdf: PREFIX rdfs: - SELECT DISTINCT ?id ?word ?line ?text ?number ?top ?bottom ?editorClass ?comment ?commentIsUncertain ?correction ?markup ?sStyle ?start ?end WHERE { + SELECT DISTINCT ?id ?word ?line ?text ?number ?top ?bottom ?editorClass ?comment ?commentIsUncertain ?correction ?markup ?sStyle ?start ?end ?isUncertain WHERE { ?page tln:hasWords/rdf:rest*/rdf:first ?word. { ?word tln:wordHasEditorComment ?id. } UNION { ?word tln:wordHasWordParts/rdf:rest*/rdf:first/tln:wordHasEditorComment ?id. } - ?id a ?editorClass. + ?id a ?editorClass; + tln:isUncertain ?isUncertain. FILTER (?editorClass != rdfs:Resource) ?word tln:hasText ?wordText; tln:wordBelongsToLine ?line. ?line tln:lineHasNumber ?number; tln:lineHasTopValueOnTranskription ?top; tln:lineHasBottomValueOnTranskription ?bottom. OPTIONAL { ?id tln:hasComment ?comment.} - OPTIONAL { ?id tln:isUncertain ?commentIsUncertain.} OPTIONAL { ?word tln:hasEditedText ?editedText.} OPTIONAL { ?id tln:hasCorrectionText ?editorCorrection; tln:isUncertain true.} - OPTIONAL { ?id (tln:clarificationHasText|tln:atypicalWritingHasText) ?textWithMarkup. + OPTIONAL { ?id tln:commentHasText ?textWithMarkup. ?textWithMarkup tln:textHasContent ?contentText; tln:textHasMarkup ?markup. ?markup stoff:hasCSS ?sStyle; stoff:standoffMarkupHasStartIndex ?start; stoff:standoffMarkupHasEndIndex ?end. } BIND(IF(BOUND(?contentText), ?contentText, ?wordText) AS ?text) BIND(IF(BOUND(?editorCorrection), ?editorCorrection, ?editedText) AS ?correction) }`; word: Word; markups: TlnEditorCommentMarkup[] = []; /** * The constructor creates a datatype from the data. * * @param id if omitted the id will be retrieved from data **/ constructor(data: any, id?: string, service?: any){ super(data, id, service) this.word = { id: this.getData4Key('word'), text: this.getData4Key('text'), line: (this.tLine != null) ? this.tLine.id : null, line_number: (this.tLine != null) ? this.tLine.number: -1, deleted: false, left: -1, top: -1, width: -1, height: -1 } } public static createLine(content: any): Line { let tLines = TlnLine.convertData({ head: { vars: []}, results: { bindings: [ content ] } }); if (tLines.length == 0){ return null } tLines[0].id = content['line']['value']; return tLines[0]; } public static createWord(content: any, line: Line): Word { let lineId = (line != null) ? line.id : null; let lineNumber = (line != null) ? line.number : -1; return { id: content['word']['value'], text: content['text']['value'], line: lineId, line_number: lineNumber, deleted: false, left: -1, top: -1, width: -1, height: -1 } } public static convertData(this: T, data: FusekiResults, id?: string, service?: any): Array> { let elements = []; let content = this.getContent(data); for (var i = 0; i < content.length; i++){ let element = new TlnEditorComment(content[i], id, service); element.markups = (content[i]['markup'] != undefined) ? TlnEditorCommentMarkup.convertData({ head: { vars: []}, results: { bindings: [ content[i] ] } }) : []; /*if (content[i]['line'] != undefined){ element.tLine = TlnEditorComment.createLine(content[i]); } if (content[i]['word'] != undefined){ element.word = TlnEditorComment.createWord(content[i], element.tLine); }*/ if (elements.length > 0 && elements[elements.length-1].id == element.id){ if(elements[elements.length-1].editorClass == element.editorClass){ elements[elements.length-1].markups = elements[elements.length-1].markups.concat(element.markups); } else if (elements[elements.length-1].editorClass.endsWith('EditorComment')){ elements[elements.length-1].editorClass = element.editorClass; } } else { elements.push(element) } } //console.log(elements) return elements; } } diff --git a/nietzsche-beta-app/src/app/tln-edition/tln-information/footnote.component.html b/nietzsche-beta-app/src/app/tln-edition/tln-information/footnote.component.html index 499115e..1084bc1 100644 --- a/nietzsche-beta-app/src/app/tln-edition/tln-information/footnote.component.html +++ b/nietzsche-beta-app/src/app/tln-edition/tln-information/footnote.component.html @@ -1,29 +1,29 @@
{{editor_comment.tLine.number}}: {{editor_comment.text}} ] Vk ¿ ? > - ? + ? {{editor_comment.correction}} , - {{editor_comment.comment}} + {{editor_comment.comment}}{{editor_comment.isUncertain ? '?' : ''}} Zeile {{ editor_comment.lineContinuationReference.isToRef ? 'wird fortgesetzt nach ' : 'ist eine Fortsetzung von ' }} {{editor_comment.lineContinuationReference.refTitle}} {{editor_comment.lineContinuationReference.refPageNumber}}, - {{editor_comment.lineContinuationReference.refLine}} + {{editor_comment.lineContinuationReference.refLine}}{{editor_comment.isUncertain ? '?' : ''}}
diff --git a/nietzsche-beta-app/src/app/tln-edition/tln-viewer-navigation/tln-viewer-navigation.component.ts b/nietzsche-beta-app/src/app/tln-edition/tln-viewer-navigation/tln-viewer-navigation.component.ts index 2f5bbee..840b415 100644 --- a/nietzsche-beta-app/src/app/tln-edition/tln-viewer-navigation/tln-viewer-navigation.component.ts +++ b/nietzsche-beta-app/src/app/tln-edition/tln-viewer-navigation/tln-viewer-navigation.component.ts @@ -1,187 +1,187 @@ import { Component, OnInit, OnDestroy, HostListener, Input, ElementRef } from '@angular/core'; import { Router, ActivatedRoute, Params } from '@angular/router'; import {MatBottomSheet, MatBottomSheetRef} from '@angular/material/bottom-sheet'; import { EditorComment, TlnQueryServiceInterface, Reference, ManuscriptUnity, NavigationPage } from '../models'; import { TlnManuscriptUnity, TlnNavigationPage} from '../datatypes/navigation'; import { DEFAULT_VIEW_OPTION, TLN_VIEWER_ROUTE, TLN_FULLSCREEN_PARAM, TLN_FIND_PARAM, TLN_NAV_BAR_OPEN_STATE_PARAM, TLN_PAGE_PARAM, TLN_MANUSCRIPT_PARAM, TLN_SELECTED_LINES_PARAM, TLN_SELECTED_WORDS_PARAM, TLN_VIEW_OPTION_PARAM, TLN_ZOOM_PARAM, VIEW_OPTIONS, ONTOLOTY_PREFIX } from '../constants'; import { IsReconstructedKonvolut } from '../datatypes/basic_datatype'; import { TlnLine} from '../datatypes/line'; import { TlnWord} from '../datatypes/word'; import { TlnTextGeneticOrder} from '../datatypes/text_version'; import { TlnEditorComment, TlnLineEditorComment } from '../datatypes/editor_comment'; import { TlnImprint } from '../datatypes/imprint'; import { Mapping } from '../route-reader'; import { RouteUpdater } from '../route-updater'; import { ComplexKeyIriMapping, DataHandler, KeyIriMapping } from '../data_handler'; import { PageViewService, TlnCacheQueryService } from '../services'; import { TlnInformationComponent, ParentInformation } from '../tln-information/tln-information.component'; import { PageInformation } from '../tln-information/page-information'; @Component({ selector: 'tln-viewer-navigation', templateUrl: './tln-viewer-navigation.component.html', providers: [ TlnCacheQueryService ], styleUrls: ['./tln-viewer-navigation.component.css'] }) export class TlnViewerNavigation extends RouteUpdater implements OnDestroy { /** * OPTIONAL pass a queryService with method * {@link /interfaces/TlnQueryServiceInterface.html#getData|getData} * to TlnPageViewComponent. **/ @Input() queryService: TlnQueryServiceInterface; /** * whether or not to show page view in fullscreen mode. **/ fullscreen: boolean = false; findText: string; current_iri: string; current_manuscript_iri: string; manuscript_unity: ManuscriptUnity; current_page: NavigationPage; pageInformation: PageInformation; previous_page: NavigationPage; /** * editor comments **/ editor_comments: TlnEditorComment[] = []; /** * line editor comments **/ line_comments: TlnLineEditorComment[] = []; /** * page imprints **/ imprints: TlnImprint[] = []; next_page: NavigationPage; navBarOpenState: boolean; showArchivalManuscriptUnity: boolean = false; dataHandler: DataHandler = new DataHandler(this); geneticOrders: TlnTextGeneticOrder[] = []; selectedLines: string[] = []; selectedWords: string[] = []; private readonly increment: number = 0.333; private readonly decrement: number = this.increment*-1; //protected currentRoute: string = TLN_VIEWER_ROUTE; protected mapping: Mapping = { findText: { param: TLN_FIND_PARAM, type: "string" }, current_iri: { param: TLN_PAGE_PARAM, type: "string" }, navBarOpenState: { param: TLN_NAV_BAR_OPEN_STATE_PARAM, type: "boolean" }, current_manuscript_iri: { param: TLN_MANUSCRIPT_PARAM, type: "string" }, fullscreen: { param: TLN_FULLSCREEN_PARAM, type: "boolean" }, selectedViewOption: { param: TLN_VIEW_OPTION_PARAM, type: "string" }, selectedWords: { param: TLN_SELECTED_WORDS_PARAM, type: "string" }, selectedLines: { param: TLN_SELECTED_LINES_PARAM, type: "string" } } routerParams: Params; selectedViewOption: string = DEFAULT_VIEW_OPTION updating: boolean = false; viewOptions: string[] = [ VIEW_OPTIONS.TRANSKRIPTION, VIEW_OPTIONS.FAKSIMILE, VIEW_OPTIONS.SYNOPSIS, VIEW_OPTIONS.SYNOPSIS_B ]; subscriptions: any[] = []; constructor(el: ElementRef, private bottomSheet: MatBottomSheet, private pageViewService: PageViewService, private localQueryService: TlnCacheQueryService, protected router: Router, protected activatedRoute: ActivatedRoute ) { super(router, activatedRoute); } ngOnInit() { let tlnQueryService = (this.queryService != null) ? this.queryService : this.localQueryService; this.dataHandler.addHandler('manuscript_unity', { 'handler': TlnManuscriptUnity, 'next_key': 'navigation_page'}); this.dataHandler.addHandler('navigation_page', ['current_page', 'geneticOrders', 'editor_comments', 'line_comments', 'imprints'] ); this.dataHandler.addHandler('current_page', { 'handler': TlnNavigationPage }); this.dataHandler.addHandler('geneticOrders', { 'handler': TlnTextGeneticOrder}); this.dataHandler.addHandler('editor_comments', { 'handler': TlnEditorComment}); this.dataHandler.addHandler('line_comments', { 'handler': TlnLineEditorComment}); this.dataHandler.addHandler('imprints', { 'handler': TlnImprint}); this.dataHandler.setQueryService(tlnQueryService); this.subscriptions.push(this.dataHandler.start_processing.subscribe( (started: boolean) =>{ this.updating = true; })); this.subscriptions.push(this.dataHandler.processing_finished.subscribe( (finished: boolean) =>{ this.updating = false; })); super.ngOnInit(); this.subscriptions.push(this.pageViewService.reference.subscribe( (newReference: Reference) => { this.updatePageToReference(newReference) })); this.subscriptions.push(this.pageViewService.onClickedLine.subscribe( (clickedLine: TlnLine) => { let index = this.selectedLines.indexOf(clickedLine.id) if (index > -1){ this.selectedLines.splice(index, 1); } else { this.selectedLines.push(clickedLine.id); } this.updateParams(); })); this.subscriptions.push(this.pageViewService.onClickedWord.subscribe( (clickedWord: TlnWord) => { this.clickWord(clickedWord) })); } ngOnDestroy() { this.subscriptions.forEach(subscription => subscription.unsubscribe()); } private clearFindText() { this.findText = ''; this.updateParams(); } private clickWord(clickedWord: TlnWord){ let wordIndex = this.selectedWords.indexOf(clickedWord.id) let lineIndex = this.selectedLines.indexOf(clickedWord.line) if (wordIndex > -1){ this.selectedWords.splice(wordIndex, 1); } else if (lineIndex > -1){ this.selectedLines.splice(lineIndex, 1); } else { this.selectedWords.push(clickedWord.id); } this.updateParams(); } private getPageTitle(page?: NavigationPage, numPages?: number): string { if (page == null){ return ''; } let indexPrefix = (numPages != null) ? page.index + '/' + numPages : page.index; return indexPrefix + ': ' + page.title + ' ' + page.number; } protected readParams(params: Params){ super.readParams(params); if (this.dataHandler.ready && (this.current_page == null || this.current_page.id != this.current_iri)){ this.dataHandler.resetData('navigation_page') if(this.current_manuscript_iri != null){ //this.dataHandler.debug = true; /*this.dataHandler.conditionalAddHandler(IsReconstructedKonvolut.getQuery(this.current_manuscript_iri), 'current_page',{ handler: TlnNavigationPage}, { handler: TlnNavigationPage});*/ this.dataHandler.getData('manuscript_unity', this.current_manuscript_iri, this.current_iri); } else { this.dataHandler.getData('current_page', this.current_iri); } } } private setCurrentIri(pageIri: string, manuscriptIir?: string){ this.dataHandler.stop_processing.emit(true); this.current_iri = pageIri; this.updateParams(); } private showInformation() { let parentData: ParentInformation = { editor_comments: this.line_comments.concat(this.editor_comments).sort((a, b)=>{ - return (a.tLine.number < b.tLine.number) ? -1 : 1; + return (a.tLine.number <= b.tLine.number) ? -1 : 1; }), imprints: this.imprints, geneticOrders: this.geneticOrders, page: this.current_page, manuscript_iri: this.current_manuscript_iri, parentActivatedRoute: this.activatedRoute.parent } this.bottomSheet.open(TlnInformationComponent, { data: parentData, backdropClass: (parentData.editor_comments.length > 0) ? 'backdropNonFadingClass' : '' }); } private updatePageToReference(reference: Reference){ this.current_iri = reference.page.id; this.selectedLines = [ reference.line.id ] this.updateParams(); } } diff --git a/nietzsche-beta-app/src/app/tln-edition/tooltip/editor-comment.component.html b/nietzsche-beta-app/src/app/tln-edition/tooltip/editor-comment.component.html index 56a43db..7f9d792 100644 --- a/nietzsche-beta-app/src/app/tln-edition/tooltip/editor-comment.component.html +++ b/nietzsche-beta-app/src/app/tln-edition/tooltip/editor-comment.component.html @@ -1,16 +1,16 @@
{{word.lineNumber}}: ] Vk ¿ ? >? {{editor_comment.correction}} , - {{editor_comment.comment}} + {{editor_comment.comment}}{{editor_comment.isUncertain ? '?' : ''}}