diff --git a/src/client/components/facet_results/MaterialTableFullTextResults.js b/src/client/components/facet_results/MaterialTableFullTextResults.js index 95723c879a963ea2089344479b4119bd8cca5659..d69bbc64d0b7f53a1a47cbc3d34a4bb7ab309f6e 100644 --- a/src/client/components/facet_results/MaterialTableFullTextResults.js +++ b/src/client/components/facet_results/MaterialTableFullTextResults.js @@ -9,9 +9,10 @@ import LastPageIcon from '@material-ui/icons/LastPage'; import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import CircularProgress from '@material-ui/core/CircularProgress'; +import ResultTableCell from './ResultTableCell'; import purple from '@material-ui/core/colors/purple'; import Paper from '@material-ui/core/Paper'; -import { has } from 'lodash'; +//import { has } from 'lodash'; const styles = () => ({ progressContainer: { @@ -43,34 +44,53 @@ class MaterialTableFullTextResults extends React.Component { { title: 'Label', field: 'prefLabel', - render: rowData => - <a - target='_blank' rel='noopener noreferrer' - href={rowData.id} - > - {rowData.prefLabel} - </a> + render: data => + <ResultTableCell + columnId='prefLabel' + data={data.prefLabel} + valueType='object' + makeLink={true} + externalLink={true} + sortValues={true} + numberedList={false} + minWidth={150} + container='div' + expanded={true} + /> }, { title: 'Type', - field: 'type.prefLabel', - render: rowData => rowData.type.prefLabel + field: 'type', + render: data => + <ResultTableCell + columnId='type' + data={data.type} + valueType='object' + makeLink={false} + externalLink={false} + sortValues={true} + numberedList={false} + minWidth={150} + container='div' + expanded={true} + /> }, { - title: 'Data provider link', - field: 'dataProviderUrl', - render: rowData => { - if (has(rowData, 'source') && has(rowData, 'dataProviderUrl')) { - return( - <a - target='_blank' rel='noopener noreferrer' - href={rowData.dataProviderUrl} - > - {rowData.source.prefLabel} - </a> - ); - } - } + title: 'Source', + field: 'source', + render: data => + <ResultTableCell + columnId='source' + data={data.source} + valueType='object' + makeLink={true} + externalLink={true} + sortValues={true} + numberedList={false} + minWidth={150} + container='div' + expanded={true} + /> }, ]} data={results} diff --git a/src/client/components/facet_results/ObjectList.js b/src/client/components/facet_results/ObjectList.js index ae2f7e52cd58e8567c88898b172638c88df04828..8972b742c68a6d9bd235b098c149f96a449d3e74 100644 --- a/src/client/components/facet_results/ObjectList.js +++ b/src/client/components/facet_results/ObjectList.js @@ -57,7 +57,7 @@ const ObjectList = props => { {props.externalLink && props.linkAsButton == null && <a target='_blank' rel='noopener noreferrer' - href={id} + href={dataProviderUrl} > {Array.isArray(prefLabel) ? prefLabel[0] : prefLabel} </a> diff --git a/src/server/sparql/SparqlQueriesGeneral.js b/src/server/sparql/SparqlQueriesGeneral.js index 9ea3cae1b07d300892a37f4f78f28a441b61729c..2b5c837c2f099bb7301f9776c5fff5793794f345 100644 --- a/src/server/sparql/SparqlQueriesGeneral.js +++ b/src/server/sparql/SparqlQueriesGeneral.js @@ -19,25 +19,24 @@ export const countQuery = ` `; export const jenaQuery = ` - SELECT ?id ?prefLabel ?dataProviderUrl ?source__id ?source__prefLabel ?type__id ?type__prefLabel + SELECT * WHERE { <QUERY> - ?id skos:prefLabel ?prefLabel . - ?id a ?type__id . - ?type__id rdfs:label|skos:prefLabel ?type__prefLabel_ . - BIND(STR(?type__prefLabel_) AS ?type__prefLabel) # ignore language tags - OPTIONAL { - ?id dct:source ?source__id . - BIND(?source__id AS ?source__prefLabel) - - # this used to work but now its painfully slow: - #OPTIONAL { ?source__id skos:prefLabel ?source__prefLabel_ } - #BIND(COALESCE(?source__prefLabel_, ?source__id) as ?source__prefLabel) + { + ?id skos:prefLabel ?prefLabel__id . + BIND(?prefLabel__id as ?prefLabel__prefLabel) + BIND(?id as ?prefLabel__dataProviderUrl) + ?id a ?type__id . + ?type__id rdfs:label|skos:prefLabel ?type__prefLabel_ . + BIND(STR(?type__prefLabel_) AS ?type__prefLabel) # ignore language tags } - OPTIONAL { - ?id mmm-schema:data_provider_url ?dataProviderUrl + UNION + { + ?id dct:source ?source__id . + OPTIONAL { ?source__id skos:prefLabel ?source__prefLabel_ } + OPTIONAL { ?source__id mmm-schema:data_provider_url ?source__dataProviderUrl } + BIND(COALESCE(?source__prefLabel_, ?source__id) as ?source__prefLabel) } - #FILTER(?type__id != frbroo:F27_Work_Conception) } `;