Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Display Meditationes #264

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {SystemOntologiesComponent} from './view/dashboard/system/system-ontologi
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';
Expand All @@ -49,6 +48,7 @@ import {DialogTestComponent} from './view/test/development/dialog-test/dialog-te
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 {MeditationesComponent} from './view/templates/meditationes/meditationes.component';


const appRoutes: Routes = [
Expand Down Expand Up @@ -221,6 +221,10 @@ const appRoutes: Routes = [
path: 'leoo/:rn',
component: LeooComponent
},
{ // path to specific component for the BEOL project
path: 'meditationes/:seqnum',
component: MeditationesComponent
},
{
path: '**',
component: MessageComponent,
Expand Down
1 change: 1 addition & 0 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class AppConfig {
public static textValueHasMapping: string = AppConfig.KnoraApiV2WithValueObjectPath + 'textValueHasMapping';

public static hasStandoffLinkToValue: string = AppConfig.KnoraApiV2WithValueObjectPath + 'hasStandoffLinkToValue';
public static hasIncomingLink: string = AppConfig.KnoraApiV2WithValueObjectPath + 'hasIncomingLink';

public static dateValueHasStartYear: string = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasStartYear';
public static dateValueHasEndYear: string = AppConfig.KnoraApiV2WithValueObjectPath + 'dateValueHasEndYear';
Expand Down
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ import { SortButtonComponent } from './view/modules/action/sort-button/sort-butt
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 { MeditationesComponent } from './view/templates/meditationes/meditationes.component';

//
// import all needed services
Expand Down Expand Up @@ -299,7 +300,8 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
SortButtonComponent,
ProgressIndicatorComponent,
LeooComponent,
ObjectViewerComponent
ObjectViewerComponent,
MeditationesComponent
],
imports: [
BrowserModule,
Expand Down
2 changes: 1 addition & 1 deletion src/app/model/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class ApiService {

httpGetV2(url: string, options?: RequestOptionsArgs): Observable<ApiServiceResult> {

if (!options) options = {withCredentials: true};
options = this.appendToOptions(options);

url = (url.slice(0, 4) === 'http' ? url : environment.api + '/v2' + url);

Expand Down
71 changes: 70 additions & 1 deletion src/app/model/services/beol.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export class BeolService {
* Given the repertorium number of a letter from LEOO, searches for that letter.
*
* @param {string} repertoriumNumber the repertorium number to search for.
* @param {boolean} originalLanguage indicates if the original language or the translation should be searched for.
* @returns {string} the Gravsearch query.
*/
searchForLetterFromLEOO(repertoriumNumber: string): string {
Expand Down Expand Up @@ -224,4 +223,74 @@ export class BeolService {
return letterByNumberTemplate;

}

/**
* Given the Iri of a manuscript, gets the page with the specified sequence number and its regions and related transcriptions.
*
* @param manuscriptIri the Iri of the manuscript the page belongs to.
* @param {number} sequenceNumber the sequence number of the page.
* @param {number} offset the offset to be used in the Gravsearch query.
* @returns {string} Gravsearch query.
*/
getRegionsWithTranscriptionsForPage(manuscriptIri: string, sequenceNumber: number, offset: number): string {

if (sequenceNumber < 1) {
console.log(`sequence number must not be smaller than 1, but ${sequenceNumber} given.`);
sequenceNumber = 1;
}

const regionsWithTranscriptionTemplate = `
PREFIX knora-api: <http://api.knora.org/ontology/knora-api/simple/v2#>
PREFIX beol: <${environment.apiExternal}/ontology/0801/beol/simple/v2#>

CONSTRUCT {
?page knora-api:isMainResource true .

?page knora-api:hasStillImageFile ?image .

?region knora-api:isRegionOf ?page .

?region knora-api:hasGeometry ?geom .

?region knora-api:hasComment ?comment .

?region knora-api:hasColor ?color .

?transcription beol:transcriptionOf ?region .

?transcription beol:hasText ?text .
} WHERE {

?page a beol:page .

?page beol:seqnum ?seqnum .
FILTER(?seqnum = ${sequenceNumber})

# Meditationes
?page beol:partOf <${manuscriptIri}> .

?page knora-api:hasStillImageFile ?image .

?region a knora-api:Region .

?region knora-api:isRegionOf ?page .

?region knora-api:hasGeometry ?geom .

?region knora-api:hasComment ?comment .

?region knora-api:hasColor ?color .

?transcription beol:transcriptionOf ?region .

?transcription beol:hasText ?text .

}

OFFSET ${offset}
`;

return regionsWithTranscriptionTemplate;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@
*ngIf="resource?.incomingStillImageRepresentations?.length > 0;" [images]="resource?.stillImageRepresentationsToDisplay" [imageRangeStart]="0" [imageRangeEnd]="4" [imageChangeInterval]="5">
</salsah-still-image-osdviewer>

<div *ngIf="resource !== undefined">
<a href="{{createTEIXMlLink()}}" target="_blank">TEI/XML</a>
</div>

</mat-list>

Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ import {
RequestStillImageRepresentations,
StillImageOSDViewerComponent,
StillImageRepresentation
} from "../../../properties/still-image-osdviewer/still-image-osdviewer.component";
import {OntologyCacheService, OntologyInformation} from "../../../../model/services/ontologycache.service";
import {MatDialog, MatDialogConfig} from "@angular/material";
} from '../../../properties/still-image-osdviewer/still-image-osdviewer.component';
import {OntologyCacheService, OntologyInformation} from '../../../../model/services/ontologycache.service';
import {MatDialog, MatDialogConfig} from '@angular/material';
import {
ReadLinkValue,
ReadPropertyItem,
ReadStillImageFileValue
} from "../../../../model/webapi/knora/v2/read-property-item";
import {Utils} from "../../../../utils";
import {ObjectDialogComponent} from "../../dialog/object-dialog/object-dialog.component";
} from '../../../../model/webapi/knora/v2/read-property-item';
import {Utils} from '../../../../utils';
import {ObjectDialogComponent} from '../../dialog/object-dialog/object-dialog.component';
import {environment} from '../../../../../environments/environment';

declare let require: any; // http://stackoverflow.com/questions/34730010/angular2-5-minute-install-bug-require-is-not-defined
let jsonld = require('jsonld');
Expand Down Expand Up @@ -494,8 +495,26 @@ export class ResourceObjectComponent implements OnChanges, OnInit {
);

// generate a string separating labels by a comma
return `(${propLabels.join(", ")})`;
return `(${propLabels.join(', ')})`;

}

/**
* Create a link to the corresponding TEI/XML file.
*
* @returns {string}
*/
createTEIXMlLink() {

// TODO: take type of resource into account

return environment.apiExternal + '/v2/tei/'
+ encodeURIComponent(this.resource.id) + '?textProperty='
+ encodeURIComponent(environment.tei.letter.textProperty)
+ '&mappingIri=' + encodeURIComponent(environment.tei.letter.mappingIri)
+ '&gravsearchTemplateIri=' + encodeURIComponent(environment.tei.letter.gravsearchTemplateIri)
+ '&teiHeaderXSLTIri=' + encodeURIComponent(environment.tei.letter.teiHeaderXSLTIri)
}


}
39 changes: 34 additions & 5 deletions src/app/view/modules/other/mathjax.directive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Directive, ElementRef, HostListener, Input, OnInit} from '@angular/core';
import {Directive, ElementRef, HostListener, Input, OnChanges, OnInit} from '@angular/core';
import {MatDialog, MatDialogConfig, MatSnackBar, MatSnackBarConfig} from '@angular/material';
import {ReadTextValueAsHtml} from '../../../model/webapi/knora/v2/read-property-item';
import {OntologyInformation} from '../../../model/services/ontologycache.service';
Expand All @@ -16,9 +16,33 @@ declare var MathJax: {
* This directive makes MathJax re-render the inserted HTML in case it is a TextValue (mathematical notation may have been inserted).
*/
@Directive({selector: '[mathJax]'})
export class MathJaxDirective implements OnInit {
@Input('mathJax') private html: string = ''; // the HTML to be inserted
@Input('valueObject') private valueObject: ReadTextValueAsHtml;
export class MathJaxDirective implements OnInit, OnChanges {

@Input()
// setter method for resource classes when being updated by parent component
set mathJax(value: string) {
this._html = value;
}

get mathJax() {
return this._html;
}

private _html: string; // the HTML to be inserted

@Input()
// setter method for resource classes when being updated by parent component
set valueObject(value: ReadTextValueAsHtml) {
this._valueObject = value;
}

// getter method for resource classes (used in template)
get valueObject() {
return this._valueObject;
}

private _valueObject: ReadTextValueAsHtml;

@Input('ontologyInfo') private ontologyInfo: OntologyInformation;
@Input('bindEvents') private bindEvents: Boolean; // indicates if click and mouseover events have to be bound

Expand Down Expand Up @@ -116,8 +140,13 @@ export class MathJaxDirective implements OnInit {

ngOnInit() {
// console.log(this.bindEvents);
}

ngOnChanges() {

// console.log(this._valueObject)

this.el.nativeElement.innerHTML = this.html;
this.el.nativeElement.innerHTML = this._html;

// http://docs.mathjax.org/en/latest/advanced/typeset.html#typeset-math
MathJax.Hub.Queue(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ import {OntologyInformation} from '../../../model/services/ontologycache.service
})
export class ReadTextValueAsHtmlComponent implements OnInit {

@Input() valueObject: ReadTextValueAsHtml;
@Input()
// setter method for resource classes when being updated by parent component
set valueObject(value: ReadTextValueAsHtml) {
this._valueObject = value;
}

// getter method for resource classes (used in template)
get valueObject() {
return this._valueObject;
}

private _valueObject: ReadTextValueAsHtml;

@Input() ontologyInfo: OntologyInformation;
@Input('bindEvents') bindEvents: Boolean; // indicates if click and mouseover events have to be bound

Expand All @@ -32,8 +44,7 @@ export class ReadTextValueAsHtmlComponent implements OnInit {

ngOnInit() {

// console.log(this.valueObject);

}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.osdViewerContainer {
width: 100%;
height: 400px;
height: 800px;

max-width: 800px;

Expand Down
Loading