Skip to content
Snippets Groups Projects
Commit cbe83a91 authored by esikkala's avatar esikkala
Browse files

Update full text search results

parent daed278d
No related branches found
No related tags found
No related merge requests found
......@@ -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}
......
......@@ -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>
......
......@@ -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)
}
`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment