@@ -22,6 +22,7 @@ export interface EntrystoreProviderProps {
22
22
entrystoreUrl : string | "admin.dataportal.se" ;
23
23
fetchMore : boolean ;
24
24
isConcept ?: boolean ;
25
+ hasResourceUri ?: string ;
25
26
}
26
27
27
28
export interface ESEntry {
@@ -74,6 +75,7 @@ export const EntrystoreProvider: React.FC<EntrystoreProviderProps> = ({
74
75
entrystoreUrl,
75
76
fetchMore,
76
77
isConcept,
78
+ hasResourceUri,
77
79
} ) => {
78
80
const [ state , setState ] = useState ( defaultESEntry ) ;
79
81
const { lang : nextLang } = useTranslation ( "common" ) ;
@@ -138,8 +140,11 @@ export const EntrystoreProvider: React.FC<EntrystoreProviderProps> = ({
138
140
139
141
const hasResource = await es
140
142
. newSolrQuery ( )
143
+ . uriProperty (
144
+ "http://www.w3.org/ns/dx/prof/hasResource" ,
145
+ hasResourceUri || entryUri ,
146
+ )
141
147
. rdfType ( [ "dcterms:Standard" , "prof:Profile" ] )
142
- . uriProperty ( "prof:hasResource" , resourceURI )
143
148
. getEntries ( ) ;
144
149
145
150
const datasetArr = await Promise . all (
@@ -278,29 +283,39 @@ export const EntrystoreProvider: React.FC<EntrystoreProviderProps> = ({
278
283
const resourceURI = entry . getResourceURI ( ) ;
279
284
const valuePromises : Promise < string > [ ] = [ ] ;
280
285
281
- const maybeSpecs = graph
282
- . find ( null , "dcterms:conformsTo" )
286
+ const conformsToURIs = graph
287
+ . find ( resourceURI , "dcterms:conformsTo" )
283
288
. map ( ( stmt : any ) => stmt . getValue ( ) ) ;
289
+ const util = new ESJS . EntryStoreUtil (
290
+ new ESJS . EntryStore ( `https://editera.dataportal.se/store` ) ,
291
+ ) ;
284
292
285
- const findSpec =
286
- maybeSpecs . length > 0
287
- ? await es
288
- . newSolrQuery ( )
289
- . resource ( maybeSpecs , null )
290
- . rdfType ( [ "dcterms:Standard" , "prof:Profile" ] )
291
- . getEntries ( )
292
- : [ ] ;
293
+ const conformsToEntries = await util . loadEntriesByResourceURIs (
294
+ conformsToURIs ,
295
+ undefined ,
296
+ true ,
297
+ ) ;
298
+ const specfications = conformsToEntries . filter ( ( s : any ) => s ) ;
299
+ const extractHREF = ( s : any ) => {
300
+ if ( s . getResourceURI ( ) . startsWith ( "https://dataportal.se" ) )
301
+ return s . getResourceURI ( ) ;
302
+ return `https://dataportal.se/externalspecification/${ s . getResourceURI ( ) } ` ;
303
+ } ;
304
+
305
+ const specificationHREF = specfications . map ( ( s : any ) =>
306
+ extractHREF ( s ) ,
307
+ ) ;
293
308
294
309
const specArr = await Promise . all (
295
- findSpec . map ( async ( spec : any ) => {
310
+ conformsToEntries . map ( async ( spec : any ) => {
296
311
return {
297
312
title : await getLocalizedValue (
298
313
spec . getAllMetadata ( ) ,
299
314
"dcterms:title" ,
300
315
nextLang ,
301
316
es ,
302
317
) ,
303
- url : spec . getResourceURI ( ) ,
318
+ url : specificationHREF [ 0 ] ,
304
319
} ;
305
320
} ) ,
306
321
) ;
0 commit comments