Skip to content

Commit

Permalink
make sparql endpoints configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sepideh Alassi committed Jan 31, 2024
1 parent 625ea38 commit 04cd6b2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/app/dsp-ui-lib/core/app-init.service.ts
Expand Up @@ -37,7 +37,8 @@ export class AppInitService {
const apiPath = (typeof dspApiConfig.apiPath === 'string' ? dspApiConfig.apiPath : '');
const jsonWebToken = (typeof dspApiConfig.jsonWebToken === 'string' ? dspApiConfig.jsonWebToken : '');
const logErrors = (typeof dspApiConfig.logErrors === 'boolean' ? dspApiConfig.logErrors : false);
const graphDBURL = (typeof dspApiConfig.graphDBURL === 'string' ? dspApiConfig.graphDBURL: '');
const fusekiUrl = (typeof dspApiConfig.fusekiUrl === 'string' ? dspApiConfig.fusekiUrl: '');
const graphDBUrl = (typeof dspApiConfig.graphDBUrl === 'string' ? dspApiConfig.graphDBUrl: '');

// init dsp-api configuration
this.dspApiConfig = new KnoraApiConfig(
Expand All @@ -59,8 +60,8 @@ export class AppInitService {
this.config['apiPath'] = apiPath;
this.config['jsonWebToken'] = jsonWebToken;
this.config['logErrors'] = logErrors;
this.config['graphDBURL'] = graphDBURL;

this.config['fusekiUrl'] = fusekiUrl;
this.config['graphDBUrl'] = graphDBUrl;
resolve();
}
).catch((err) => {
Expand Down
8 changes: 4 additions & 4 deletions src/app/services/beol.service.ts
Expand Up @@ -736,7 +736,7 @@ export class BeolService {
BIND(ofn:years-from-duration(?EndDate-?ArrivalDate) AS ?duration_y)
BIND(ofn:months-from-duration(?EndDate-?ArrivalDate) AS ?duration_m)
BIND(fn:concat( STR(?duration_y *365+ ?duration_m*30 + ?duration_d), " days") AS ?Duration)
SERVICE <http://localhost:3030/knora-test/query> {
SERVICE <${this._appInitService.config['fusekiUrl']}> {
?FromIri rdfs:label ?From .
?ToIri rdfs:label ?To .
}
Expand Down Expand Up @@ -778,7 +778,7 @@ export class BeolService {
?stay trip-onto:hasAccommodation ?accomodationRes .
?accomodationRes schema:name ?Accomodation .
}
SERVICE <${this._appInitService.config['graphDBURL']}> {
SERVICE <${this._appInitService.config['fusekiUrl']}> {
?FromIri rdfs:label ?From .
?ToIri rdfs:label ?To .
}
Expand Down Expand Up @@ -817,7 +817,7 @@ export class BeolService {
?stage trip-onto:meanOfTransportation ?meanOfTransportation .
?meanOfTransportation schema:name ?Transportation .
SERVICE <http://admin:test@localhost:3030/knora-test/query> {
SERVICE <${this._appInitService.config['fusekiUrl']}> {
?FromIri beol:hasWikiLink ?startWikiValue .
?startWikiValue <http://www.knora.org/ontology/knora-base#valueHasUri> ?startWikiIri_xsd .
?ToIri beol:hasWikiLink ?endWikiValue .
Expand Down Expand Up @@ -847,7 +847,7 @@ export class BeolService {
}

requestGraphDB(query: string): Observable<DataGraphDB> {
const url = "http://localhost:7200/repositories/Reisbuchlein";
const url = this._appInitService.config['graphDBUrl']
const httpOptions = {
headers: new HttpHeaders({
"Content-Type": "application/x-www-form-urlencoded",
Expand Down
3 changes: 2 additions & 1 deletion src/config/config.dev.json
Expand Up @@ -11,5 +11,6 @@
"ontologyIRI": "http://0.0.0.0:3333",
"iiifURL": "http://0.0.0.0:1024",
"appURL": "http://0.0.0.0:4200",
"graphDBURL": "http://admin:test@localhost:3030/knora-test/query"
"fusekiUrl": "http://localhost:3030/knora-test/query",
"graphDBUrl": "http://localhost:7200/repositories/journeyStar"
}
4 changes: 3 additions & 1 deletion src/config/config.prod.json
Expand Up @@ -11,5 +11,7 @@
"ontologyIRI": "http://0.0.0.0:3333",
"iiifURL": "http://0.0.0.0:1024",
"appURL": "http://0.0.0.0:4200",
"graphDBURL": "http://admin:test@localhost:3030/knora-test/query"
"fusekiUrl": "https://db.dhlab-journey-star.dhlab.unibas.ch/knora-test/query",
"graphDBUrl": "https://graphdb.dhlab-journey-star.dhlab.unibas.ch/repositories/journeyStar"

}

0 comments on commit 04cd6b2

Please sign in to comment.